The following is some info and recommendations to help developers get the most from the ERC721a standard (opens in a new tab) that SoundEdition implements.
ERC721A vs ERC1155
|O(1) ownerOf||Yes||No ownerOf|
|O(1) balanceOf||For all tokens||Within fungible tokens|
|O(1)* bulk mint||For all tokens||Within fungible tokens|
|# mint ||3||1 †|
* Approximately O(1) for ERC721A.
† For unique collections, ERC1155 needs a counter which needs 1 more
ERC1155 requires centralized indexing services to emulate ERC721-like functionality off-chain.
For users, it is more gas optimal to transfer bulk minted tokens in ascending token ID order.
For example, if you have bulk minted token IDs (33, 34, ..., 99),
you should transfer in the order (33, 34, ..., 99).
This is due to how the lazy-initialization mechanism works internally:
it scans uninitialized slots in descending order until it finds an initialized slot.
ERC721A._setAux to get / set per-address variables
(e.g. number of whitelist mints per address).
This can help remove an extra cold
For typical artwork collections, consider using
_safeMint if you don't expect users to mint to contracts.
During transfers, ERC721A scans through ownership storage slots until it finds an initialized slot.
To prevent expensive first-time transfer fees for tokens minted in large batches, either:
Restrict the max batch size for public mints to a reasonable number.
Break up excessively large batches into mini batches internally when minting.
ERC721a._initializeOwnershipAtevery couple tokens to reduce number of reads during a transfer.
ERC721A keeps track of additional variables in the internal mappings.
ERC721a.startTimestamp(starting time of holding) per token.
These variables hitchhike on the
SSTOREs at near zero additional gas cost (< 1%).
You can use them to design tokenomics with very minimal gas overhead.
ERC721a.startTimestamp, is available via the
You can get it from the
ERC721a._ownershipOf function or the non-reverting
ERC721A is not a one-size-fits-all solution.
It is heavily optimized for generative artwork NFT collections.
If your collection does not expect a busy mint phase (e.g. a pure utility NFT),
or does not require bulk minting,
these excellent implementations can be better for lowering overall transaction fees:
Use the right tool for the job.