The Gas-Efficient Way of Building and Launching an ERC721 NFT Project For 2022

Table of Contents

  • Getting Caught Up
  • The Problem and Building A Real Solution
    👉 — The Resources You May Want and Need
    👉 — Enabling the Optimizer When Compiling The Contracts
    👉 — Avoiding LTE/GTE When Possible
    👉 — Stop Catching Events Red-Handed
    👉 — Removing OpenSea Listing Fees
    👉 — Preventing Bots, Massive Losses, and Extraneous Costs
    👉 — Building With Extendable Project Proxy Approvals In Mind
    👉 — Handling Loops That Constantly Grow
    👉 — Handling Allowlisting With Merkle Trees
  • Building A Project With Each Optimized Piece
    👉 — The Thoughts of the Nuclear Nerd Founders
    👉 — What's Coming Next
  • Moving Forward

Getting Caught Up

  • Some wrote articles claiming to be a pioneer after reverting to older methods.
  • Some projects attempted to use the savings as a marketing method only for the potential of the project to remain the same.
  • Some projects have saved their community millions of dollars and gone above and beyond.
  • Some projects said they fixed the issue when they just avoided it and introduced a slew of other problems and inadequacies.
  • Some projects failed to dig deeper than the initial knowledge, resulting in massively incorrect conclusions.
  • Perhaps when prototyping.
  • Perhaps in-house usage.
  • Shouldn't the highest level of quality and effort be expected from a developer at all times?
  • Don't we all want to buy into projects from competent teams that operate at levels beyond the one needed to optimize their contract?
  • Isn't the job of a blockchain developer to know how to save their buyers the highest amount of gas while offering exceptionally high levels of security at all times?

The Problem and Building A Real Solution

  1. Having to store redundant/unneeded information on-chain.
  2. Managing increasingly large loops.

The Resources You May Want and Need

Enabling the Optimizer When Compiling The Contracts

The optimizer should always be enabled.
With the optimizer enabled.
With the optimizer disabled.

Avoiding LTE/GTE When Possible

With a simple increase of 1, we can avoid an extra arithmetic check and an increased mint cost.

Stop Catching Events Red-Handed

Creating a subscription for function calls is extremely easy with Block Native.

Removing OpenSea Listing Fees

With this, we can connect to OpenSea.
With a single function added to your contract, you can save your community thousands.
Super simple to track and make sure that everything will run all of the time smoothly.
  • Rinkeby: 0xf57b2c51ded3a29e6891aba85459d600256cf317
  • Mainnet: 0xa5409ec958c83c3f309868babaca7c86dcb077c1
  1. Does the developer care about their community? If yes, go to #2
  2. Does the developer know you can do this? If no, go to #3
  3. Share article, method, and resources with developer

Preventing Bots, Massive Losses, and Extraneous Costs

The Littles attempted to keep out bots and instead kept our loyal fans.
This code clearly shows us that this is a sale-based time by checking these variables and the revert message that is included with it.
They've ensured that the transaction's origin is the same as the sender so that no one can make a mass-minting contract, but people stopped using these months ago.
Seconds into The Littles mint there were already thousands of pending transactions.
Seconds into The Littles mint, there were already thousands of pending transactions.
  • Account signatures / Signed hashes.
  • Verify the transaction origin.
  • Mint limits (Easily gamed, not the best choice.)
  • Improved distribution mechanisms that aren't dependant on a first-to-arrive system.
  • Send trigger-controlling transactions through a Private Mempool.

Building With Extendable Project Proxy Approvals In Mind

https://worldwideweb3.com/ has gone full integration-focused as they connect many of the most popular NFT projects into one pixelated Metaverse.
In Wreck-It Ralph, the Metaverse is the Internet. In reality, that's not the situation.
  • Tavern
  • Inventory
  • Forge

Handling Loops That Constantly Grow

Launching With Cost-Effective Allowlisting By Using Merkle Trees

  1. An allowlist that verifies an address is on a list.
  2. An allowlist that verifies how many times an address is on a list.

Building A Project With Each Optimized Piece

All the hard work came together to deliver an experience that many had never had before.
  • No one bears massive losses incurred due to minting.
  • No one felt the pain of a gas war.
  • Nuclear Nerds did not even make it to the first page of gas consumers on Ethereum during the time of this final minting peak.
  • The most gas paid by a single person was .2 ETH, and they minted 60 Nuclear Nerds.

The Thoughts of the Nuclear Nerd Founders

Moving Forward

--

--

The blockchain developer you’ll remember 🤌

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store