ERC721 minting cost

Deploying the sample ERC721 from the work in progress ERC721 token guide

pragma solidity ^0.5.0;

import "openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol";

contract GameItem is ERC721Full {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    constructor() ERC721Full("GameItem", "ITM") public {
    }

    function awardItem(address player, string memory tokenURI) public returns (uint256) {
        _tokenIds.increment();

        uint256 newItemId = _tokenIds.current();
        _mint(player, newItemId);
        _setTokenURI(newItemId, tokenURI);

        return newItemId;
    }
}

Minting the first token used 242,796 gas.
await gameItem.awardItem('0x77737a65c296012c67f8c7f656d1df81827c9541', 'https://game.com/item-id-8u5h2m.json')
Transaction: 0x6db656953f0ad03f5b25acb707424792df19317865d7fd34d1a0bb5c14df26ae

Minting a token to a new address used 227,796 gas.
await gameItem.awardItem('0x13ebd3443fa5575F0Eb173e323D8419F7452CfB1', 'https://game.com/item-id-8u5h2m.json')
Transaction: 0x60de1dcfa4549cf0cffbb375aa006f9600cfd4b7b5730bd3150edb41e30a002a

Minting gas will vary depending on the length of the tokenURI string in this implementation.

3 Likes