Randomize Tiers of Ryder NFTs
Ryder NFTs is an early campaign for the Ryder social wallet with different tiers. Each NFTs have different perks and benefits. These tiers are revealed sometime after the mint.
There are different approaches to create random distribution of these tiers so that users do not know what NFTs they will mint. For example, project managers can publish a hash of the metadata before the mint starts so that project manager can’t manipulate the outcome.
We have chosen a mathematical way. Brilliant mathematicians have provided us with tools to calculate the tiers of each NFTs in a way that is not predictable during mint.
The interested reader can lookup “permutation polynomials”, more precisely, “Dickson polynomials”. The idea is to shuffle the digital collectibles ids using one of the functions that Dickson showed to be a 1:1 mapping if the number of digital collectibles is a prime number. The 670th prime number is 5003 which is close enough to our target of 5000 NFTs .
Dickson described a few functions but one of them can be used with an arbitrary parameter making the function perfect for a random input. The function is the following:
x⁵ + a*x³ + 1/5*a²x + a
The shuffled list of our 5003 ids with parameter a = 100 starts with 2201, 4932, 4040, 515, 710, 1452, 168, 8.. and ends with 271, 3002, 100. (The last number will always be equal to parameter a).
For parameter a (Dickson parameter), we can use a number that is unknown at the start of mint like the VRF seed or the Bitcoin block header time available on the Stacks blockchain. With the current limitations of Stacks 2.05, we chose the block header time (modulo 5003) for simplicity, and we believe that the Ryder NFTs are not enough incentives for Bitcoin miners to change their mining software to get the best tiers.
For our cross-chain mint, we take the parameter determined on the Stacks blockchain and update the smart contract on Ethereum accordingly.
Now, we can calculate the tier for any given NFT id on-chain in the NFT smart contract in a sufficiently unpredictable way, thanks to Dickson and the Bitcoin block time.
How to verify the Dickson parameter submitted to the Ryder NFT contract on Ethereum?
The random element is defined by the bitcoin block during the reveal. To verify that indeed the promised value was added, you can follow the steps below:
1.Find the Stacks block of the reveal transaction (shuffle-prepare function call of the stacks contract) e.g. stacks block #83667
2.Find the corresponding Bitcoin block e.g. on the stacks explorer (that is bitcon block #763438)
3.Get the Bitcoin block details, e.g. on https://learnmeabitcoin.com/explorer
4.Take the time of the block modulo 5003, which is the value that is submitted as the so-called Dickson parameter that defines the shuffling of the ids (and thereby of the tiers).
This is the same bitcoin block time as the one available to the Stacks blockchain. You can check this for example in the stacks explorer sandbox with contract
SP3VCX5NFQ8VCHFS9M6N40ZJNVTRT4HZ62WFH5C4Q.get-block-info and function get-block-info-time for input 83667.
Our team keeps on shipping features after features! If you're ready for the #ryde of your life, join the pre-sale here.