The ALEX IDO, which launched on January 18th, 2022, was done through our Launchpad v1.0. It was an entirely on-chain lottery, meaning that each ticket had to be opened individually in a separate transaction. Every ticket claimed was a unique lottery event with required on-chain fees.
There was a combination of unforeseen factors that led to network congestion:
Having learned from the experience of our own IDO, we’ve redesigned the launchpad to provide a more streamlined experience by using a transparent hybrid on-chain/off-chain model. We’ll first provide a brief overview before going into technical details:
At block-height 52,900, that is around March 20th, registration will open for the Bitcoin Monkeys IDO on our launchpad. Tickets (each eligible for 100 $BANANA) registered will require 33 $ALEX and numbers of $APower dependent on the number of tickets validated:
When a user registers, the contract generates and assigns to the user a block. The block height is proportional to the number of tickets registered and the starting position begins at the ending position of the previous block.
At the end of the registration period, we have a chain of blocks representing all the lottery tickets registered.
Each block is subdivided into a number of walk resolution. For example, if a user registered 5 tickets, his/her block will be a length of 5 walk resolutions.
At blockheight 53,950, that is around March 27, the registration closes and the lottery drawing will occur. The lottery system is based on a random number generator called “linear congruential generator”, which is one of the oldest and best-known pseudorandom number generator algorithms.
It starts by first drawing a verifiable random function seed (“seed”) from the Stacks block following the registration end. The seed is then
This random number is then scaled by the maximum step size, the ratio of the total number of registered tickets over the total number of tickets to be won (i.e. oversubscription ratio), multiplied by 1.5 times walk resolution.
This maximum step size helps ensure the fairness of the lottery system.
If a random number drawn falls between a particular walk resolution within a block that corresponds to a ticket held by a user, the ticket is determined to have won the lottery.
To generate the next random number, we move to the end of the walk resolution of the current random number, and draw another random number using the above linear congruential generator with the current random number as its seed.
The process is repeated until we reach the end of the chain, with the tickets upon whose corresponding walk resolution random numbers fell having won the lottery.
These “winners” are first determined off-chain, without the need for any on-chain events, thereby greatly increasing the overall efficiency of the lottery system.
In order to ensure these “winners” are not tempered with or generated in error, upon submission of the list to process claim (whereby the “winners” receive the IDO tokens) and refund, the contract verifies independently that the list is correct using the same process outlined above, before triggering on-chain events (i.e. processing claims and refunds).
This hybrid on-chain/off-chain lottery system therefore allows ALEX Bitcoin DeFi to create a Launchpad that combines the efficiency/speed of off-chain processing, while maintaining verifiability/immutability of on-chain processing.