Full tutorial: https://jamesbachini.com/soroban-nft/
A Stellar Soroban NFT based on ERC-721 and SEP-0039
Deployed to: Testnet: CCOMN26TIW2LJW4A7NWY5UF47X6HNYAF44ZFA2GIIGCSMBEIWVIH2DMA Mainnet: CDA5FGE4LZP4S45LP6AJLWMLKWHVWMKFSIKVYEBSIYOB25NWLKCLL7RY
To use this repository, ensure you have the following installed:
- Rust: Install Rust from rust-lang.org.
- Soroban CLI: Install Soroban CLI using:
cargo install --locked --version <latest-version> soroban-cli
- Stellar Wallet: You'll need a wallet and some funds to deploy on mainnet
Follow these steps to deploy and interact with the NFT contract:
git clone https://github.com/jamesbachini/Soroban-NFT.git
cd Soroban-NFTRun the following command to compile the contract to WebAssembly (WASM):
cargo build --target wasm32-unknown-unknown --releaseThe compiled .wasm file will be located in the target/wasm32-unknown-unknown/release directory.
Use the Soroban CLI to deploy the contract to the Stellar testnet:
soroban deploy --wasm target/wasm32-unknown-unknown/release/soroban_nft.wasm --network testnetThe command will return a contract-id. Save this ID for future interactions.
Initialize an NFT with a unique ID and owner:
soroban invoke --contract <contract-id> --fn mint --args '["<owner>"]' --network testnetReplace <owner> with the Stellar address of the new owner.
Transfer the NFT to a new owner:
soroban invoke --contract <contract-id> --fn transfer --args '["<id>", "<from>", "<to>", "<tokenid>"]' --network testnetRetrieve the current owner of the NFT:
soroban invoke --contract <contract-id> --fn owner --args '["<tokenid>"]' --network testnetContributions are welcome! Feel free to open issues or submit pull requests to enhance or update the project.
This project is licensed under the MIT License. See the LICENSE file for details.
- Stellar for creating the Soroban platform.
- The Rust and blockchain development communities for their support and resources.
For questions or feedback, feel free to reach out via Twitter