ERC-721 n00b here,

Problem: I want to control the price of the cost of minting my token. I want the first 1-100 tokens to cost x and 101-200 tokens to cost y and so on.

My understanding is that ERC-721 minting cost is determined by the size of the metadata being put on the token plus gas.

I am not sure how to control the cost of minting specific token by token minted thus far.

What’s done so far: I’ve implemented my first ERC-721 on remix using open zeppelin.

I am able to deploy my contact on ropsten using truffle migrations and have built a front end where users can call the mint function and sign the transaction.


There are a few concepts here a bit mixed up:

a) Token value vs token cost

If it's about value, the token price is linked to an offer-demand balance determined by the market, so nothing related to the cost of minting it.

If it's about cost of generating the token, you could define a minting function that starting from token 101 (by looking at a counter), you could add random read/write operations to consume gas and therefore, generating an additional cost to execute such as transaction.

b) Transaction cost vs. Mining complexity

When you increase the gas consumption to execute a transaction, the one who is paying for that gas is the user executing that transaction, not the miner.

The mining difficulty is managed through other parameters and miners do normally pick up transactions based on the total gas price per transaction (the higher it is, the more likely to be chosen), rather than only on the gas amount.

In summary, I kind of guess that you want to release a pre-sale offering so that the first buyers can get tokens at a lower gas consumption. If that is the case, you can do the approach of adding random operations to increase the gas cost. However, it would be easier that you just define how much ether you require to buy the first 100 tokens vs. the rest of tokens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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