Skip to content

Latest commit

 

History

History

btc_blind_box

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

BTC Blind box example

This example demonstrates how to program with bitcoin blocks or transactions.

In this example, users can request for a blind box before the given block height. The block hash of the given block height will be used to generate a random number to determine the result of the blind box.

There are two stage for the blind box:

  1. Request stage: users can request for the blind box before the given block height, and got a random number generated by the txn context.
  2. Claim stage: users can claim the blind box after the given block height. With the random number generated in the request stage, and the Bitcoin block hash, the result of the blind box can be determined.

The box will be determined after request stage, and is not predictable, as no ones knows the block hash of the given block height in the future.