ERC721Psi: A truly scalable NFT implementation for low-gas on-chain applications and randomized metadata generation.

TL;DR

  • We designed ERC721Psi, an ERC721 compliant implementation, ground up.
  • Inspired by Azuki’s ERC721A, ERC721Psi also provides batch minting at a fixed gas cost. We further optimized the amount of the data written to the storage to achieve a lower minting cost.
  • ERC721Psi solves the scaling issue of ERC721A in token transfer and on-chain metadata querying in a large batch through the use of bitmaps and the de Bruijn sequence.
  • ERC721Psi provides the extension for batch minting tokens with tamper-proof on-chain randomness at the individual token level while maintaining a constant gas cost.
  • With a batch of 10 tokens, ERC721Psi uses >90% less gas than OpenZepplin’s ERC721Enumerable and ~20% less gas than ERC721A in minting, and up to ~30% gas savings in first-time token transfer compared to ERC721A. In addition, ERC721Psi significantly reduces the cost of burning multiple tokens with close token IDs, which are ~70% and ~80% savings compared to ERC721A and ERC721Enumerable, respectively.
  • The source code of ERC721Psi will be released along with Medieval’s native NFT, Medieval Adventurer.

Challenges on locating ownership / metadata with ERC721A

Introducing ERC721Psi

Searching the head of a batch efficiently: de Bruijn sequence

Batch minting with on-chain random metadata at the individual token level.

Due to the Avalanche effect of the keccak256 hash function, each token has a completely different seed.
Due to the Avalanche effect of the keccak256 hash function, each token has a completely different seed.

Benchmark

Batch Mint Optimization

Token Transfer Optimization

Burning Multiple Tokens

Azuki stores address and burned information in the same storage slot.

Conclusion

  • ERC721Psi improves the gas consumption on batch minting and solves the scaling problem of ERC721A by Azuki in first-time token transfer in a large batch.
  • Although not implemented in our specific implementation. It is possible to stake extra bitmaps layers to track the batch head, and the scaling is highly efficient.
  • For example, by adding one extra layer, we will need to load one extra storage slot, but the amount of tokens we can search at once is increased to 256 * 256 = 65536 at once.
  • ERC721Psi also retains flexibility for burning function and on-chain randomized metadata, hoping the flexibility can help other NFT projects create more exciting features.
  • The source code of ERC721Psi will be released along with Medieval DAO’s first product, the Adventurer NFTs. To learn more about the exciting features of the Adventurer NFTs, see our article on the medium!

Join us on:

--

--

--

A social and strategic game with quests to earn multiple rewards.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

DisCas DAO

Update Journal #3: Adding to Asia Blockchain Week, Going Mobile & Honoring the Winner!

Minting Your NFT Collection

Warrior: A Community Driven Game

Metaverse

The GDPR Right to be forgotten for blockchain DAOs

What is InsureDAO? Did you understand about Defi?

MeshBox Biweekly Report (2021.08.07–2021.08.20)

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
Medieval Dao

Medieval Dao

A social and strategic game with quests to earn multiple rewards.

More from Medium

Gaming Lifehack: How to integrate a custom contract and ABI using the ChainSafe Gaming SDK

Laika Blockchain Lab (5 Jan 2022 Update)

Creating A Whitelist Token With Candy Machine V2

Medieval DAO Integrates Chainlink VRF v2 Into Novel ERC721Psi Token Standard