Posts

ERC721A - Buying Multiple NFTs and Only Paying Gas Once!

avatar of @agr8buzz
25
@agr8buzz
·
·
0 views
·
2 min read

Ever wonder why you pay gas on each individual NFT when you're buying a batch of 5 in a single transaction? Time to get gas optimized!

source

Transacting on Ethereum is hella expensive, in case you hadn't noticed!

When it comes to buying NFTs sometimes the gas you pay is enough to buy another NFT or two on it's own. Paying gas per NFT has always felt like something inefficient was going on behind the scenes.

If you're buying multiple NFTs in a single transaction, why are you paying a gas fee per NFT? Turns out there's a few processes in the transaction that are run on every NFT you buy, even if all purchased at the same time. It's true that the per NFT fee is slightly lower after the first NFT in the batch but not by much.

ERC721A Is Trying To Change This!

I've been working in the NFT space for the past year at least and I'm now starting to here community members speak up and ask "hey is this contract gas optimized"?

Turns out there's a new implementation making the rounds, and of course it's popular if it means paying less gas!

INTRODUCING ERC721A: AN IMPROVED ERC721 IMPLEMENTATION

It's being adopted by more and more NFT projects every week, and its a real crowd pleaser, I can see why. It's not a standard yet and will need time to be picked apart by the solidity dev community before it becomes a go to implementation, or a Standard if you will.

But look at those gas savings! For avid NFT collectors out there you'll be saving thousands of dollars a year.

How Does it Work?

If you read through the documentation the new implementation looks to focus on three main optimizations.

  1. Removing duplicate storage from OpenZeppelin’s (OZ) ERC721Enumerable.
  2. Updating the owner’s balance once per batch mint request, instead of per minted NFT.
  3. Updating the owner data once per batch mint request, instead of per minted NFT.

If anyone reading this is an experienced Solidity dev I would love to get your take on the new implementation!

Obviously the the changes focus on completing some calculations only once per batch vs per NFT which is great news for anyone that likes to by more than 1 NFT at a time when possible.

If this is adopted as a standard I can definitely see the number of NFTs per transactions increasing overall.

Great for business and great for the customer, looks like a no brainer assuming the code is solid and can't be exploited. Time will tell but there's potentially some really good news on the horizon for NFT collectors everywhere.

Ciao for now,

@agr8buzz


Additional LeoFinance Content:


Posted Using LeoFinance Beta