BAYC Otherside sales cost an unnecessary $100M in gas fees due to badly optimized code

Work from Home Secrets

Syndicate DAO co-founder Will Papper said on May 1 that inefficiencies in the Yuga Labs Otherside land sale caused $100 million to be needlessly wasted on gas fees.

In a Twitter thread, Papper explained how the smart contract used to mint the BAYC metaverse land was missing key optimizations. The smart contract follows the ERC721 standard, which Papper argued contains some functions and extensions that are “annoying and unnecessary.”

To combat the inefficiencies, he proposed three changes.

Remove the ERC721Enumerable extension

The first change Papper proposed is to remove the ERC721Enumerable extension, which is used to track owners of NFTs on-chain.

Papper argued that there is no need to record owners on-chain since anyone can query the blockchain through an off-chain front end to pass the data into a smart contract. He said removing the extension alone could save 70% in gas fees by removing a single word.

Use ERC721A… a standard developed by the Azuki

Papper said the ERC721A standard developed by the Azuki team is a better choice as it allows users to mint multiple NFTs during the same transaction for close to the cost of minting just one.

He added that ERC721A makes mints “dramatically cheaper,” which offsets the fact that it makes “transfers slightly more expensive.”

Based on Papper’s analysis, most users mint more than one NFT. He estimates this could have lowered the overall gas fees by $10 million.

Switch from _safeMint() to _mint()

The last optimization that Papper recommended is to replace the _safeMint() function.

He argued that this only helps ensure that a wallet can accept NFTs and since most of the community is likely using compatible and known wallets like Metamask, TrustWallet, Coinbase Wallet, and SafePal; this function wastes gas fees.

Papper goes on to clarify that he is not attacking Yuga Labs for incompetence and acknowledged their contributions to the industry. He said:

“[I have] spent countless hours on gas optimizations and wanted to share a few tricks. This thread is to educate and doesn’t take away from the work that Yuga does for the ecosystem.”

He also shares a methodology that SyndicateDAO uses for the minting process to ensure that no one is trying to mint at the same time, thus driving up gas fees.

How to Start an Online Business

Leave a Reply

Your email address will not be published. Required fields are marked *