Randomization algorithm
Randomization algorithm overview
Highlight ensures that mints for generative and series collections with random distribution mechanics are fair, provably random, and decentralized.
We use an independently verifiable, deterministic algorithm to populate token metadata on random mints. This means that:
Collectors can independently verify the provable randomness of each and every token’s metadata.
Neither the creator nor Highlight knows which mints will get which metadata, meaning no party can help any collector.
While metadata is centralized during a mint, we upload revealed metadata to Arweave in parallel so that collectors can always verify the centralized metadata against its decentralized copy. Once the mint ends, the creator can update their collection to use the decentralized metadata on-chain.
Generative randomization process
The hl-gen.js script provides a number of methods intended to help you generate deterministic randomness in your artwork. These methods are seeded by a combination of the transaction hash (or a predetermined hash if you choose) and the token ID.
It is important to use these methods to generate randomness in place of Math.random or p5’s random function to ensure that, after a token is minted, it renders identically on all subsequent renders.
Series randomization process
Pre-mint: creator upload
When the creator of a Series uploads the initial folder of the Series’ metadata, our tooling indexes the metadata in the order it was uploaded. These are called metadata ids.
During mint
Token ids are minted sequentially, in ascending order.
On each mint, we run an algorithm that generates the metadata id deterministically using a Pseudo-Random Number Generator (PRNG) called Mulberry32. This PRNG function outputs a metadataId from the following inputs:
Transaction hash
Block hash
Token id
Unclaimed metadataIds
Once a valid metadataId is generated, we populate the minted token’s metadata with the metadata corresponding to the metadataId.
We also upload the metadata to the Arweave folder, updating the base uri of the decentralized copy that remains inspectable by collectors.
Verification of fairness
Any third party can independently verify the randomness of any mint
The following pseudo-code is the verification algorithm that one can run to determine the expected metadataId to be generated for all minted tokens until a certain one. To run the verification algorithm, you’ll need the transaction hashes of each minted token, in-order.
Post-mint: mint ends
Creator executes a transaction that swaps the centralized folder on-chain for a decentralized Arweave copy.
Last updated