A decentralized NFT royalty management system on Solana that enables fractional ownership and automated distribution of NFT royalties through a pool-based mechanism.
- NFT Creation & Minting: Create and mint NFTs with built-in royalty support
- Fractional Royalty Ownership: Buy and sell shares of NFT royalties
- Automated Distribution: Pool-based royalty distribution system
- Solana Integration: Built on Solana blockchain for fast and cost-effective transactions
- Smart Contract Security: Developed using Anchor framework for secure and reliable contracts
- Node.js (v16 or higher)
- Rust (latest stable)
- Solana CLI tools
- Anchor Framework
- Yarn package manager
- Clone the repository
git clone https://github.com/yourusername/solana-nft-royalty-pool.git
cd solana-nft-royalty-pool
- Install dependencies
yarn install
- Build the program
anchor build
- Deploy to localnet
anchor deploy
- Run tests
anchor test
For detailed testing with transaction inspection:
anchor test --detach --skip-deploy
This keeps the validator running, allowing you to inspect transaction signatures on the explorer.
Aspect | Creating an NFT | Minting an NFT |
---|---|---|
Focus | Defining metadata and initializing mint | Generating and assigning the token |
Ownership | No ownership established yet | Token ownership is assigned |
Blockchain Action | Setting up metadata and the mint account | Minting tokens and sending to an address |
State | Conceptual existence | Tangible existence as a token |
Initializes the contract state with:
total_items
:u64
- Total number of NFTsbump
:u8
- PDA bump seed
Creates a new NFT with metadata and royalty support.
Parameters:
ctx
:Context<CreateNft>
- Transaction contextname
:String
- NFT namesymbol
:String
- NFT symboluri
:String
- Metadata URI (IPFS)
Accounts Required:
payer
: Transaction initiatormint
: NFT mint accountmetadata
: NFT metadata accountedition_account
: Master edition accounttoken_account
: NFT holder accountroyalty_pool_account
: Royalty management accountcontract_state
: Global state account
Mints an existing NFT to a specified user.
Parameters:
ctx
:Context<MintNft>
- Transaction contextamount
:u64
- Number of tokens (always 1 for NFTs)
Enables fractional ownership of NFT royalties.
Parameters:
ctx
:Context<BuyShares>
- Transaction contextshare_amount
:u64
- Number of shares to purchase
Adds SOL to the royalty pool for distribution.
Parameters:
ctx
:Context<AddRoyaltiesToPool>
- Transaction contextamount
:u64
- Amount of SOL to add
This project follows Solana's best practices for smart contract development:
- Comprehensive test coverage
- Anchor framework security features
- PDA-based account management
- Proper access control
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by [defaimaxi]