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
Section titled “Create a basic NFT Smart Contract to integrate into the game”Follow Hiro NFT example
Edit smart contract
Section titled “Edit smart contract”Rename MY-OWN-NFT to character
Section titled “Rename MY-OWN-NFT to character”Change token-URI
Section titled “Change token-URI”from https://token.stacks.co/{id}.json to ipfs://QmNLo4oeN741Ai5PEafBnDtpXh2XMea8wBUGicTeErCtEB/{id}.json
Stacks Explorer
Section titled “Stacks Explorer”Faucet - request STX for the address
Section titled “Faucet - request STX for the address”-
Go to https://explorer.stacks.co/sandbox/faucet?chain=testnet
-
Connect wallet

-
Select last option from the right list and press
Request STX
Deploy .nft-trait and .my-nft smart contracts on testnet
Section titled “Deploy .nft-trait and .my-nft smart contracts on testnet”-
Select 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
Section titled “Wait for the smart contracts to get confirmed on the anchor block”Mint NFTs using the sandbox
Section titled “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

