Smart Contract NFTs
In order to integrate NFTs into a game, we need a smart contract for the NFTs. We'll create an NFT project locally, edit the NFT smart contract, fund the testnet account with STX and upload it there. The clarinet project should be created in the root folder of the cloned repository.
Create a basic NFT Smart Contract to integrate into the game
Follow Hiro NFT example
Edit smart contract
Rename MY-OWN-NFT to character
Change token-URI
from https://token.stacks.co/{id}.json to ipfs://QmNLo4oeN741Ai5PEafBnDtpXh2XMea8wBUGicTeErCtEB/{id}.json
Stacks Explorer
Faucet - request STX for the address
Connect wallet

Select last option from the right list and press
Request STX
Deploy .nft-trait and .my-nft smart contracts on testnet
.nft-trait and .my-nft smart contracts on testnetSelect first option from the right list, paste the nft-trait contract from the local project, rename contract name to
nft-trait, pressDeployand confirm the transaction
Paste the my-nft contract from the local project, rename contract name to
my-nftpressDeployand confirm the transaction
Wait for the smart contracts to get confirmed on the anchor block
Mint NFTs using the sandbox
Copy
my-nftcontract address
Go back to sandbox, pick the second option from the right list and paste the contract name there

Select
claimand call the function


Last updated
Was this helpful?