Seed and provenance

Both versions store a mint-time seed on the collection. Read tokenSeed(tokenId) rather than reconstructing it: the formulas differ, and v1 pooled ids can be minted again after burning.

V2 seed resolution

The current Surface v2 token assigns sequential ids and stores:

solidity
keccak256(abi.encode(block.prevrandao, address(this), tokenId))

There is no external seed source or seeded-mint entrypoint. tokenSeed rejects id 0 and ids above mints-ever, and stays readable after burning. Transfers and burns do not change the seed. Minted(minter, to, firstTokenId, quantity) records one range per mint call; the id itself is the mint order, so v2 has no separate mint-index field. See Surface v2.

V1 stored seed

A v1 token stores one additional per-token fact beyond ERC721 ownership: its seed, a bytes32 written once at mint. Everything else about a token's provenance, its mint order and first/final standing, is either derivable from the id and the live config or recorded permanently in the Minted event. The core stores nothing derivable.

Provenance (derived)

In Sequential mode the token id IS the mint order: ids are assigned 1, 2, 3... and never reused after burn, so:

Fact Derivation
Mint order tokenId (1-based)
First mint tokenId == 1
Final mint the cap is set and full and this is the last id: cap != 0 && minted == cap && tokenId == cap

A custom renderer can compute these as provenance attributes at tokenURI time without additional provenance storage. The final-mint trait derives from cap state alone: it appears once the collection mints out against a set cap, and raising the cap before lockSupply retracts it. There is no mint window or lifecycle status on the token to change it.

In Pooled mode ids are source ids (reused across burn and re-mint), so mint order is not derivable from the id. Order still exists: every Minted event carries firstMintIndex from a counter that never repeats, but it is event provenance for indexers, not an onchain read. A pooled work whose art or mechanics need order (or any other mint-time fact, like the mint block) records it through its own minter; see below.

The seed (tokenSeed)

tokenSeed(uint256 tokenId) returns a bytes32, computed once at mint time as:

solidity
keccak256(abi.encode(block.prevrandao, address(this), tokenId, mintIndex))
  • The only per-token storage: the seed is the one fact that can never be reconstructed later, since randomness only exists at mint time. Everything else about a mint is derivable or event-recorded, so nothing else is stored, one storage slot per mint
  • The existence sentinel: a nonzero stored seed doubles as "was ever minted"; the contract treats a zero value as absent, so tokenSeed reverts NeverMinted for an id with no mint
  • Recipient-independent: the recipient address is not mixed in, so entropy does not depend on who minted and there is no wallet-grinding surface
  • Stable across transfer: transferring a token has no effect on its seed; a renderer that depends only on that seed keeps the same output across transfers
  • Readable after burn: a burned id's seed stays readable until a pooled re-mint of the same id overwrites it
  • Re-rolls on pooled re-mint: a re-minted id is a NEW instance with a new, independent seed, a different draw from the same algorithm

prevrandao-derived entropy is public within the mint transaction. A contract can mint, inspect its seed, and revert an unwanted result; block proposers also have influence over inclusion and ordering. This applies to both versions' default seeds. It is unsuitable for lotteries or rarity-dependent financial guarantees. A work needing stronger randomness must provide its own mechanism.

Bring-your-own mint-time data

A work that needs mint-time facts the core does not store, the mint block for time-based mechanics, pooled mint order, a timestamp, records them through its own minter, which receives the mint call and can write to its own storage or a companion, then reads them back in its renderer. Only works that opt in pay that cost, rather than every mint of every collection storing fields most works never read.

What reads these

  • Renderers read tokenSeed as the entropy input to the algorithm, and derive order/first/final from the id against the version-specific config() result when they want provenance attributes
  • Indexers read the Minted event, which carries the issuing minter, the recipient and id range without per-token calls. V1 also carries firstMintIndex; the mint block is the log's own block

See Types for the exact definitions, and Write a renderer for using the seed in an algorithm.