Minting on Polygon mainnet
In this article, i would share the tricks i learn from doing bulk minting NFTs on Polygon mainnet.
- If you have not subscribed to any Matic RPC plan, you can choose a fast RPC by:
using this endpoint
https://polygon-rpc.com
instead of
https://rpc-mumbai.maticvigil.com/v1/<api_key>
2. Set a higher gas price
You can get the current gas price by calling
const gasPrice = await web3.eth.getGasPrice();
and then set a higher gas price in call to smart contract methods
const sendOption = { from: defaultAccount, gasPrice: gasPrice * 1.4};
await contractInst.methods.methodName(arg).send(sendOption);
3. Choose a not busy time to mint (when US is asleep)
4. If keep getting RPC timeout, call a smart contract read method using web3. It may help you to get access to the RPC endpoint.
5. If transaction is stuck in mempool:
In your Metamask go to Settings > Advanced > Turn on “Customize transaction nonce”
Then, send another transaction with the same nonce and higher gas price to overwrite the stuck transaction
That’s it.