Ad
News
BAYC Otherside sales cost $100M in gas fees unnecessarily due to badly optimized code BAYC Otherside sales cost $100M in gas fees unnecessarily due to badly optimized code
๐Ÿšจ This article is 3 years old...

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

SyndicateDAO co-founder Will Papper unveiled how Yuga Labs could have saved users over $100M by changing a couple of lines of code

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

Cover art/illustration via CryptoSlate. Image includes combined content which may include AI-generated content.

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.

Mentioned in this article
Posted In: Metaverse, NFTs, Wallets