Deploy an ERC-721 Token
OpenZeppelin provides secure, community-vetted smart contract templates that follow best practices for ERC-721 (NFT) development.- Deployment with Foundry
- Deployment with Hardhat
Step 0: Setup Foundry
If your Foundry project isn’t set up yet, please go to the Foundry setup section before proceeding.Step 1: Create the ERC-721 Contract
Create a contract script insrc/MyERC721.sol. Run:- Inherits from OpenZeppelin’s
ERC721contract - Sets the name to
"MyNFT"and symbol"MNFT" - Includes a
mintfunction allowing the creation of NFTs - Tracks the next available token ID
Step 2: Compile the Contract
Compile your contract:Step 3: Prepare Signer for Deployment
This tutorial uses the Foundry Keystore for increased security. Create a new keystore:Provide a password to encrypt the keystore file when running the command. If you forget the password, it cannot be recovered.
Step 4: Deploy the Contract
Deploy your ERC-721 contract:The
--legacy flag is required for SKALE Chains. For more information, see Troubleshooting.Step 5: Verify Your Smart Contract
Verify the contract on the block explorer:<DEPLOYED_ADDRESS> with your smart contract address.Next Steps
Congratulations! You’ve successfully deployed an ERC-721 token on SKALE. You can now:- Mint unique NFTs
- Transfer NFTs between addresses
- Approve operators
- Build NFT marketplaces or dApps on SKALE
