Example: Project S is going to issue 100 NFTs on Oases Seedpad. The number of tickets that can be bought is 500, and 400 tickets are finally sold successfully, which meets the NFT draw conditions.1. When the NFT draw time is up, Oases calls the NFT draw method of the Seedpad contract to initiate the draw, and the call corresponds to a smart contract call transaction on Ethereum. Assuming that this transaction is included in the block with a height of 15311984, the hash value of the block is 0xd0561120b4a21048c7a38b83bedbdd06e09891e9dca83a273388a093f7e9c6cb2. NFT draw will be initiated for the 400 tickets that have been successfully sold. The IDs of the tickets are arranged in order, ranging from NO. 1 to NO. 400. Then combine the block hash to generate the winning number of each ticket. Since the block hash is unpredictable before the draw, and the hash algorithm ensures the randomness of the distribution, the winning numbers of the NFT draw are guaranteed to be completely random.The way to generate the winning numbers is as follows, taking a few ticket IDs as examples:
// ticket id=1 keccak256("10xd0561120b4a21048c7a38b83bedbdd06e09891e9dca83a273388a093f7e9c6cb") e4f8c015b4b00614175da35a920fd0d300163c033e94814ae2d35a99d563bfc3
// ticket id=2 keccak256("20xd0561120b4a21048c7a38b83bedbdd06e09891e9dca83a273388a093f7e9c6cb") 3551b9a737f8a262eaa29ecfbbff978574a6e9cad8dd4591a66bcdaa20f13668
// ticket id=20
// ticket id=100 keccak256("1000xd0561120b4a21048c7a38b83bedbdd06e09891e9dca83a273388a093f7e9c6cb") 8c4c5f0fbef91f3f2e2f643cacf6d45fd7934d6e5c9d4398153dedc8b79f7143
// ticket id=200
f57d40f7a2018115295093fadfa344c75ba57023ac16693c8abd72a315aca10dEach winning number corresponds to a large hexadecimal number, which can be compared by size. For the winning numbers listed above: ticket id=2< ticket id=100 <ticket id=200 < ticket id=20 < ticket id= 1 < ticket id=400.3. Rank the winning numbers corresponding to each ticket from small to large after calculating. Since the number of NFTs is 100, the final winning tickets are the 100 tickets with the smallest winning numbers, which can correspondingly obtain the 100 NFTs with tokenid from small to large of this Seedpad project. The lucky list will be displayed on the winner list after the NFT draw.