A decentralized NFT marketplace built on the Solana blockchain using Anchor and Rust, enabling users to mint, list, buy, and delist NFTs. This project demonstrates a secure and extensible programmatic framework for on-chain NFT trading and rewards.
- Mint and List NFTs: Users can mint NFTs and list them for sale on the marketplace.
- Buy and Sell: Buyers can purchase listed NFTs directly from the marketplace.
- Delist NFTs: Sellers can remove their NFTs from the marketplace at any time.
- Marketplace Fees: Configurable platform fee for each transaction, collected in a treasury account.
- Rewards: Users interacting with the platform can receive rewards.
- Solana Native: All tokens and accounts are SPL and Metaplex compatible.
- Programmatic Security: Uses Anchor framework for secure Solana smart contract development.
- Solana Program (Rust): Implements the core marketplace logic (initialize, list, purchase, delist).
- Anchor Framework: Provides structured account validation, events, and CPI support.
- Metaplex Token Metadata: Ensures NFTs are standard-compliant and verifiable.
- SPL Token Program: Handles token transfers and account management.
-
Clone the repository:
git clone https://github.com/prince981620/nft-marketplace.git cd nft-marketplace -
Install dependencies:
npm install
-
Build the Solana program:
anchor build
-
Configure your localnet:
solana-test-validator # In another terminal anchor deploy -
Run tests:
anchor test
- initialize: Sets up a new marketplace with admin, fee, treasury, and reward configuration.
- list: Allows a user to list their NFT for sale, transferring it to the marketplace vault.
- purchase: Buyer purchases an NFT, facilitating payment, fee collection, reward distribution, and NFT transfer.
- delist: Removes an NFT from the marketplace and returns it to the seller.
- Marketplace: Stores marketplace configuration (admin, fee, treasury, rewards, name).
- Listing: Represents a listed NFT, including price and seller info.
- Vault: Holds NFTs during listing.
- Treasury: Collects platform fees.
- Rewards: Distributes interaction rewards to users.
- Solana (Rust, Anchor)
- @solana/web3.js (tests, scripts)
- @coral-xyz/anchor (tests)
- @metaplex-foundation/mpl-token-metadata (NFT verification)
- SPL Token (token operations)
- Tests are written using TypeScript and Anchor's Mocha framework.
- Example test:
tests/amm-nft-market-place.tsdemonstrates setup, minting, airdrop, listing, and purchasing flows.
PRs and Issues are welcome! Please open an issue to discuss any major changes before submitting a pull request.
- Fork the repo.
- Create your feature branch (
git checkout -b feature/my-feature). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature/my-feature). - Open a Pull Request.
This project is open source. Please include a license file for your preferred open source license.
Repository: prince981620/nft-marketplace