Benchmarks for implementations of the ERC20 standard.
The most popular way of implementing ERC721 is by having sequential ids for each token, so if a collection has 10000 tokens, the ids of each token are in the range 1~10000. Some of the latest implementations focus on making mint cheaper at the cost of an expensive transfer, this bechmark highlights that.
We'll be comparing the following implementations:
- deploy
- mint (not in the specification, but common)
- safeMint (not in the specification, but common)
- burn (not in the specification, but common)
- balanceOf
- ownerOf
- transferFrom
- safeTransferFrom
- approve
- setApprovalForAll
- getApproved
- isApprovedForAll
How much gas to deploy the contract as is?
Implementation | -- |
---|---|
ERC721A | 956503 |
ERC721B | 969269 |
ERC721K | 1062527 |
OpenZeppelin Consecutive | 1123587 |
OpenZeppelin Enumerable | 1173288 |
OpenZeppelin | 967662 |
Solady | 640668 |
Solmate | 910145 |
How much gas to deploy the ERC2309 compliant contracts when minting N tokens in the constructor?
Implementation | 5 | 10 | 50 | 100 | 200 | 300 |
---|---|---|---|---|---|---|
ERC721A | 832802 | 832801 | 832824 | 832834 | 832868 | 832846 |
OpenZeppelin Consecutive | 1074812 | 1074811 | 1074834 | 1074844 | 1074878 | 1074856 |
How much gas to mint N tokens?
Implementation | 1 | 2 | 3 | 4 | 5 | 10 | 50 | 100 |
---|---|---|---|---|---|---|---|---|
ERC721A | 57009 | 59007 | 60995 | 62993 | 64883 | 74802 | 153398 | 251741 |
ERC721B | 52140 | 54377 | 56604 | 58841 | 60970 | 72084 | 160240 | 270533 |
ERC721K | 57279 | 59305 | 61321 | 63347 | 65265 | 75324 | 155040 | 254783 |
OpenZeppelin Consecutive | 79517 | 105510 | 131493 | 157486 | 183371 | 313265 | 1351661 | 2649754 |
OpenZeppelin Enumerable | 146258 | 260848 | 375428 | 490018 | 604500 | 1177379 | 5759655 | 11487598 |
OpenZeppelin | 74572 | 99620 | 124658 | 149706 | 174646 | 299815 | 1300411 | 2551254 |
Solady | 74127 | 98733 | 123329 | 147935 | 172433 | 295392 | 1278308 | 2507051 |
Solmate | 74359 | 99194 | 124019 | 148854 | 173581 | 297685 | 1289761 | 2529954 |
How much gas to safeMint N tokens?
Implementation | 1 | 2 | 3 | 4 | 5 | 10 | 50 | 100 |
---|---|---|---|---|---|---|---|---|
ERC721A | 59812 | 61711 | 63721 | 65697 | 67697 | 77461 | 156102 | 254369 |
ERC721B | 55141 | 57279 | 59528 | 61743 | 63982 | 74941 | 163142 | 273359 |
ERC721K | 60023 | 61950 | 63988 | 65992 | 68020 | 77924 | 157685 | 257352 |
OpenZeppelin Consecutive | 82453 | 108637 | 134932 | 161193 | 187478 | 318667 | 1368713 | 2681246 |
OpenZeppelin Enumerable | 149083 | 263864 | 378756 | 493614 | 608496 | 1182670 | 5776596 | 11518979 |
OpenZeppelin | 77508 | 102747 | 128097 | 153413 | 178753 | 305217 | 1317463 | 2582746 |
Solady | 77001 | 101736 | 126582 | 151394 | 176230 | 300174 | 1292260 | 2532343 |
Solmate | 77191 | 102116 | 127152 | 152154 | 177180 | 302074 | 1301755 | 2551322 |
How much gas to burn the nth
token?
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 69586 | 106655 | 195194 | 305849 |
ERC721B | 8238 | 8281 | 8260 | 8215 |
ERC721K | 72586 | 111121 | 206266 | 325257 |
OpenZeppelin Consecutive | 21167 | 21210 | 21189 | 21144 |
OpenZeppelin Enumerable | 47549 | 52064 | 52047 | 52011 |
OpenZeppelin | 18518 | 18561 | 18540 | 18495 |
Solady | 18133 | 18176 | 18155 | 18110 |
Solmate | 18144 | 18187 | 18166 | 18121 |
How much gas to transfer the nth
token id if you own all tokens from 1 to 100?
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 52973 | 90021 | 178582 | 289260 |
ERC721B | 295149 | 273904 | 179385 | 44113 |
ERC721K | 55975 | 94489 | 189656 | 308670 |
OpenZeppelin Consecutive | 29243 | 29265 | 29266 | 29244 |
OpenZeppelin Enumerable | 80432 | 68154 | 68155 | 68133 |
OpenZeppelin | 28930 | 28952 | 28953 | 28931 |
Solady | 27955 | 27977 | 27978 | 27956 |
Solmate | 28373 | 28395 | 28396 | 28374 |
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 70051 | 107099 | 195660 | 306382 |
ERC721B | 295127 | 273882 | 179363 | 44135 |
ERC721K | 73053 | 111567 | 206734 | 325792 |
OpenZeppelin Consecutive | 46321 | 46343 | 46344 | 46366 |
OpenZeppelin Enumerable | 77610 | 80432 | 80433 | 80455 |
OpenZeppelin | 46008 | 46030 | 46031 | 46053 |
Solady | 45033 | 45055 | 45056 | 45078 |
Solmate | 45451 | 45473 | 45474 | 45496 |
How much gas to transfer the nth
token id if you own all tokens from 1 to 100?
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 55776 | 92825 | 181340 | 292041 |
ERC721B | 298003 | 276759 | 182194 | 46945 |
ERC721K | 58762 | 97277 | 192398 | 311436 |
OpenZeppelin Consecutive | 32090 | 32113 | 32068 | 32069 |
OpenZeppelin Enumerable | 83301 | 71024 | 70979 | 70980 |
OpenZeppelin | 31777 | 31800 | 31755 | 31756 |
Solady | 30658 | 30681 | 30636 | 30637 |
Solmate | 31111 | 31134 | 31089 | 31090 |
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 72854 | 109903 | 198485 | 309162 |
ERC721B | 297981 | 276737 | 182239 | 46966 |
ERC721K | 75840 | 114355 | 209543 | 328557 |
OpenZeppelin Consecutive | 49168 | 49191 | 49213 | 49190 |
OpenZeppelin Enumerable | 80479 | 83302 | 83324 | 83301 |
OpenZeppelin | 48855 | 48878 | 48900 | 48877 |
Solady | 47736 | 47759 | 47781 | 47758 |
Solmate | 48189 | 48212 | 48234 | 48211 |
How much gas for setApprovalForAll
?
Implementation | -- |
---|---|
ERC721A | 32550 |
ERC721B | 32590 |
ERC721K | 32590 |
OpenZeppelin Consecutive | 32602 |
OpenZeppelin Enumerable | 32624 |
OpenZeppelin | 32602 |
Solady | 32391 |
Solmate | 32528 |
How much gas to approve the nth
token id if you own all tokens from 1 to 100?
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 37089 | 56992 | 145530 | 256253 |
ERC721B | 271508 | 250218 | 155676 | 37549 |
ERC721K | 37494 | 58863 | 154007 | 273066 |
OpenZeppelin Consecutive | 35288 | 35265 | 35243 | 35266 |
OpenZeppelin Enumerable | 35163 | 35140 | 35118 | 35141 |
OpenZeppelin | 35163 | 35140 | 35118 | 35141 |
Solady | 34768 | 34745 | 34723 | 34746 |
Solmate | 34829 | 34806 | 34784 | 34807 |
How much gas to run balanceOf in an account with N tokens.
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 7868 | 7802 | 7847 | 7814 |
ERC721B | 2738097 | 2738166 | 2738811 | 2739528 |
ERC721K | 7868 | 7802 | 7847 | 7814 |
OpenZeppelin Consecutive | 7840 | 7774 | 7819 | 7786 |
OpenZeppelin Enumerable | 7884 | 7818 | 7863 | 7830 |
OpenZeppelin | 7840 | 7774 | 7819 | 7786 |
Solady | 7815 | 7749 | 7794 | 7761 |
Solmate | 7840 | 7774 | 7819 | 7786 |
How much gas to find the owner of a token when the owner owns 100 tokens and the token to find is the nth token.
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 9965 | 29936 | 118495 | 229141 |
ERC721B | 244297 | 223075 | 128554 | 10350 |
ERC721K | 10219 | 31656 | 126821 | 245804 |
OpenZeppelin Consecutive | 7887 | 7932 | 7931 | 7877 |
OpenZeppelin Enumerable | 7806 | 7851 | 7850 | 7796 |
OpenZeppelin | 7762 | 7807 | 7806 | 7752 |
Solady | 7732 | 7777 | 7776 | 7722 |
Solmate | 7720 | 7765 | 7764 | 7710 |
How much gas to find the approved address of the nth token when the onwer owns 100 tokens and there are no approved addresses.
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 10010 | 29913 | 118495 | 229163 |
ERC721B | 244342 | 223052 | 128554 | 10372 |
ERC721K | 10264 | 31633 | 126821 | 245826 |
OpenZeppelin Consecutive | 7932 | 7909 | 7931 | 7899 |
OpenZeppelin Enumerable | 7851 | 7828 | 7850 | 7818 |
OpenZeppelin | 7807 | 7784 | 7806 | 7774 |
Solady | 7777 | 7754 | 7776 | 7744 |
Solmate | 7765 | 7742 | 7764 | 7732 |
How much gas to check if an address is allowed to control another's nfts.
Implementation | -- |
---|---|
ERC721A | 8039 |
ERC721B | 8051 |
ERC721K | 8006 |
OpenZeppelin Consecutive | 8029 |
OpenZeppelin Enumerable | 8051 |
OpenZeppelin | 8029 |
Solady | 7906 |
Solmate | 7984 |