Skip to main content
Non-fungible tokens (NFTs) are unique digital assets that represent ownership of a specific item on the blockchain. The ERC-721 standard defines a common interface for them, so platforms and marketplaces can read the same token. On peaq, teams building DePINs and dApps use ERC-721s to:
  • Represent the identity of a connected device, such as a scooter, a drone or a charging station.
  • Run DID whitelists where each person or machine is one token, which makes onboarding, access control and lifecycle management easier to track.
  • Tokenize machine activity or certificates that attest to a capability.

Prerequisites

  • You know what the EVM and smart contracts are, and you have deployed an ERC-20 token in Remix before (see Deploying ERC-20 Token).
  • Remix is open in your browser and you know your way around it.
  • MetaMask or another Web3 wallet is installed and connected to agung, or to a local chain such as Hardhat or Anvil.

Instructions

1. Obtain an ERC-721 Boilerplate

2. Create a New File in Remix

  • In Remix, click on the File explorer icon (the first icon on the left) and create a new file named, for example, MyFirstNFT.sol.
  • Paste this boilerplate ERC-721 contract into the file:

3. Fill in Relevant Details

Within the constructor and contract parameters, you can set:
  • Contract Name & Symbol: Choose a name that represents your NFT collection (e.g., MyFirstNFT) and a symbol (e.g., MFN).
  • Base URI: OpenZeppelin’s ERC721 builds tokenURI(tokenId) from the internal _baseURI() function, which returns an empty string by default. Override it to point at where your metadata lives, for example https://my-nft-metadata-api.com/metadata/. IPFS services such as Pinata can host that metadata off-chain.
  • Minting: the public mint function has to be part of the contract before you deploy it. Add access control, for example OpenZeppelin’s Ownable, if not everyone should be able to mint.

4. Compile the Contract

  • Click on the Solidity Compiler icon (usually the second icon on the left).
  • Select Solidity 0.8.24 or later, which the OpenZeppelin 5 ERC721 contracts require.
  • Click the Compile MyFirstNFT.sol button. Ensure there are no compilation errors.

5. Deploy the Contract

  • Click on the Deploy & Run Transactions icon (usually the third icon on the left).
  • In the Environment dropdown, select Browser Extension and pick MetaMask, which uses the network MetaMask is on.
  • Click Deploy.
  • Confirm the transaction in MetaMask. Once it is mined, the contract address appears in Remix’s deployed contracts section.

6. Minting and Interacting

  • In Remix’s deployed contracts section, call your mint function with the address that should receive the token.
  • After minting, read the token details with ownerOf(tokenId) and tokenURI(tokenId) in Remix.

7. Testing & Next Steps

  • Deploy on agung first and check that the token shows up on Subscan (agung).
  • When the contract behaves the way you want, deploy the same contract on peaq mainnet and look it up on Subscan (peaq).

Summary

You now have an ERC-721 contract deployed. From here you can add access control, royalties, custom metadata handling or your own mint and burn functions.