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 | 954720 |
ERC721B | 967479 |
ERC721K | 1060730 |
OpenZeppelin Consecutive | 1123404 |
OpenZeppelin Enumerable | 1171505 |
OpenZeppelin | 965879 |
Solady | 640268 |
Solmate | 910361 |
How much gas to deploy the ERC2309 compliant contracts when minting N tokens in the constructor?
Implementation | 5 | 10 | 50 | 100 | 200 | 300 |
---|---|---|---|---|---|---|
ERC721A | 831018 | 831017 | 831040 | 831050 | 831084 | 831062 |
OpenZeppelin Consecutive | 1074653 | 1074652 | 1074675 | 1074685 | 1074719 | 1074697 |
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 | 52969 | 90017 | 178578 | 289256 |
ERC721B | 295145 | 273900 | 179381 | 44109 |
ERC721K | 55971 | 94485 | 189652 | 308666 |
OpenZeppelin Consecutive | 29239 | 29261 | 29262 | 29240 |
OpenZeppelin Enumerable | 80428 | 68150 | 68151 | 68129 |
OpenZeppelin | 28926 | 28948 | 28949 | 28927 |
Solady | 27951 | 27973 | 27974 | 27952 |
Solmate | 28369 | 28391 | 28392 | 28370 |
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 70047 | 107095 | 195656 | 306378 |
ERC721B | 295123 | 273878 | 179359 | 44131 |
ERC721K | 73049 | 111563 | 206730 | 325788 |
OpenZeppelin Consecutive | 46317 | 46339 | 46340 | 46362 |
OpenZeppelin Enumerable | 77606 | 80428 | 80429 | 80451 |
OpenZeppelin | 46004 | 46026 | 46027 | 46049 |
Solady | 45029 | 45051 | 45052 | 45074 |
Solmate | 45447 | 45469 | 45470 | 45492 |
How much gas to transfer the nth
token id if you own all tokens from 1 to 100?
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 55772 | 92821 | 181336 | 292037 |
ERC721B | 297999 | 276755 | 182190 | 46941 |
ERC721K | 58758 | 97273 | 192394 | 311432 |
OpenZeppelin Consecutive | 32086 | 32109 | 32064 | 32065 |
OpenZeppelin Enumerable | 83297 | 71020 | 70975 | 70976 |
OpenZeppelin | 31773 | 31796 | 31751 | 31752 |
Solady | 30654 | 30677 | 30632 | 30633 |
Solmate | 31107 | 31130 | 31085 | 31086 |
Implementation | 1 | 10 | 50 | 100 |
---|---|---|---|---|
ERC721A | 72850 | 109899 | 198481 | 309158 |
ERC721B | 297977 | 276733 | 182235 | 46962 |
ERC721K | 75836 | 114351 | 209539 | 328553 |
OpenZeppelin Consecutive | 49164 | 49187 | 49209 | 49186 |
OpenZeppelin Enumerable | 80475 | 83298 | 83320 | 83297 |
OpenZeppelin | 48851 | 48874 | 48896 | 48873 |
Solady | 47732 | 47755 | 47777 | 47754 |
Solmate | 48185 | 48208 | 48230 | 48207 |
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 |