I am currently working on a smart contract to sell ERC721 tokens. I understand that my code should have a function that allows me (the owner) to mint a token and add it to a list which stores all the available tokens. But what I don't quite understand is when and where do I define which data can be used to mint a token.

Suppose I have a dapp that allows you to buy Colour tokens. In my frontend, the user will have Red, Yellow and Blue, and they all will have different prices. When they buy one of them, using web3 I will mint a token and transfer it to the buyer.

But how does the frontend know that the available colours are red, yellow and blue? How can I prevent someone creates a green token? Do I have to provide this data (and also the metadata) in the deploy? How?

I hope that my question is clear.

Thank you very much!

1 Answer 1


You have to define your own minting policy.

For example in the color case you can use RGB code as token ID, so there will not be two token referencing the same color.

ERC721 tokens optionally have a tokenURI property that you can use to have additional properties attached them.

You may prefer to handle everything yourself or have a more decentralized approach where the community decide.

Some policies

  • All colors are created at the beginning (you have complete control)
  • Colors are created on demand (users have complete control)
  • Colors are created through an auction (periodically sell some colors)
  • Colors are created by voting mechanism (community proposes and majority mints them)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.