How it works

Every 1024 blocks, the Satoshi Lottery initiates a raffle where ticket holders get a chance to win a share of the prize pool when winners are drawn 1024 blocks later.

Tickets are purchased through the website and an inscription representing the ticket is delivered to the taproot ticket address specified by the buyer. When winning tickets are drawn, BTC is transferred from the pool to the Bitcoin address associated with the current address of the winning tickets. If the ticket is transferred to an address that is not associated with an account in the lottery, the BTC is sent directly to the address currently holding the ticket inscription.

The Satoshi Lottery leverages a tamper resistent, on-chain verifiable, and provable random drawing process explained in this document.

On-chain raffle data

A raffle is initiated by the lottery creating a raffle inscription.

The metadata of the raffle inscription immutably defines

Each child inscription made before the draw condition is met represents a valid raffle ticket, equally participating in every draw (I.e. a single ticket can win multiple prizes in the same raffle).

Verifiable drawing process

When the draw condition is met (e.g. a specific block height is reached), the lottery initiates the drawing process using the hash of the block when the draw condition was met as the source of entropy.

Specifically, the winning ticket of draw number i in a raffle is defined by its zero-based index in the raffle inscription's list of children, as follows:

winneri
= sha256( hex(blockhashB) + str(i) ) % childrenB

Where

B
The block height when the draw condition is met
childrenh
The number of child inscriptions of the raffle inscription at block height h
blockhashh
The block hash of the block at height h, interpreted as a large integer
sha256(s)
The SHA-256 value of UTF-8 string s, interpreted as a large integer
str(i)
Base 10 representation of large integer i encoded as UTF-8
hex(i)
Base 16 representation of large integer i encoded as UTF-8
l + r
String concatenation of UTF-8 strings l and r
l % r
Integer modulo operation on large integer l and r

This is a practical way to select a winner using a publicly verifiable and unpredictable seed. It aligns with Bitcoin's philosophy by leveraging the inherent randomness of the block hash, ensures transparency through a deterministic hash function, and is computationally efficient for an ongoing draw system.

Anyone can independently verify the process by checking the blockhash, performing the SHA-256 calculation, and computing the modulo with the known ticket count.

Since the blockhash is determined by the Bitcoin network's consensus and cannot be influenced by ticket buyers or the organizer, it provides a robust source of randomness.