A decentralized lottery platform on the Magi Network where you can create and participate in customizable lotteries with transparent prize distributions and provably fair winner selection.
Recommended: Use the Okinoko.io UI for the best user experience.
Ōkinoko Takara lets you create custom lotteries with your own rules or join existing ones. Every lottery is:
- Transparent – All rules are public and stored on-chain
- Provably Fair – Winner selection is deterministic and verifiable
- Decentralized – No central authority controls the lottery
- Customizable – Choose ticket prices, deadlines, prize distributions, and burn rates
Each lottery benefits the HIVE price by burning a portion of the ticket prices.
As a lottery creator, you define:
- Lottery Name – Give your lottery a memorable name (1 - 100 characters)
- Duration – Set how many hours until the lottery closes (1-2160 hours)
- Ticket Price – Choose the price per ticket in HIVE (min. 0.001 HIVE)
- Burn Rate – Percentage of the pool to burn (5-75%)
- Prize Distribution – Define how prizes are split among winners
- Donation (Optional) – Optionally dedicate a percentage to a charity or cause (0-50%)
- Metadata (Optional) – Store a free-form string (max 500 chars)
- Max Tickets (Optional) – Cap total tickets that can be sold
Example:
- Name: "Happy New Year"
- Duration: 168 hours
- Ticket Price: 1 HIVE
- Burn Rate: 30%
- Prize Distribution: 1st place gets 100%
- Donation: 5% to hive:charity (optional)
To join a lottery:
- Find an active lottery you want to join on Okinoko.io
- Fill out the form and the amount of tickets you want to buy
- The more tickets you have, the better your chances of winning
You can join the same lottery multiple times to increase your odds or simply buy mutiple tickets at once.
When the lottery deadline passes, anyone can execute the lottery:
- A portion of the prize pool is burned (sent to
hive:null) - If configured, a donation is sent to the specified account
- Winners are selected randomly based on ticket weight
- Prizes are automatically distributed to winners on the Magi Network
- If there are fewer participants than winner positions, unclaimed prizes are also burned
Important: The more tickets you have, the higher your chance of winning!
- Minimum: 1 hour
- Maximum: 2160 hours
- Minimum: 5%
- Maximum: 75%
- You can have one or multiple winners
- Winner shares must add up to 100%
- Examples:
- Single winner:
100% - Three winners:
50%, 30%, 20% - Five winners:
30%, 25%, 20%, 15%, 10%
- Single winner:
- Any positive amount in HIVE (e.g., 1.000, 5.000, 10.000)
- Minimum: 0% (no donation)
- Maximum: 50%
- The donation account must be a valid Hive address
- Combined burn rate + donation rate cannot exceed 90%
- Stored as a raw string (max 500 characters)
- Contents are not validated or parsed
- If provided, total tickets sold cannot exceed the limit
Setup:
- Name: "Big Jackpot"
- Duration: 168 hours
- Ticket Price: 5 HIVE
- Burn Rate: 10%
- Winners: 1 (gets 100%)
Participants:
- Alice buys 1 ticket (5 HIVE)
- Bob buys 2 tickets (10 HIVE)
- Charlie buys 1 ticket (5 HIVE)
Total Pool: 20 HIVE
After Execution:
- Burned: 2 HIVE (10%)
- Prize Pool: 18 HIVE
- Winner: Selected randomly (Bob has 50% chance, Alice and Charlie each have 25%)
- Winner receives: 18 HIVE
Setup:
- Name: "Triple Threat"
- Duration: 72 hours
- Ticket Price: 10 HIVE
- Burn Rate: 15%
- Winners: 3 (50%, 30%, 20%)
Participants:
- 7 people buy tickets totaling 100 HIVE
After Execution:
- Burned: 15 HIVE (15%)
- Prize Pool: 85 HIVE
- 1st Place: 42.5 HIVE (50%)
- 2nd Place: 25.5 HIVE (30%)
- 3rd Place: 17 HIVE (20%)
Setup:
- Name: "Help the Ocean"
- Duration: 336 hours
- Ticket Price: 2 HIVE
- Burn Rate: 10%
- Donation: 20% to hive:oceanDAO
- Winners: 2 (60%, 40%)
Participants:
- 10 people buy tickets totaling 50 HIVE
After Execution:
- Burned: 5 HIVE (10%)
- Donated: 10 HIVE (20%) → sent to hive:oceanDAO
- Prize Pool: 35 HIVE
- 1st Place: 21 HIVE (60%)
- 2nd Place: 14 HIVE (40%)
This allows lottery creators to support charitable causes while still offering attractive prizes to participants!
If there are fewer participants than winner positions, the unclaimed prize shares are automatically burned to hive:null.
Example:
- Lottery has 3 winner positions (50%, 30%, 20%)
- Only 2 people participate
- After execution:
- 1st place gets 50% of the remaining pool
- 2nd place gets 30% of the remaining pool
- The unclaimed 20% is burned along with the configured burn rate
All lottery activities emit events that can be indexed by off-chain systems. Each event contains complete information needed for indexing, verification, and analytics.
Emitted when a new lottery is created.
Format:
lc|id:<id>|creator:<address>|name:<name>|created_at:<unix_timestamp>|deadline:<unix_timestamp>|burn:<percent>|ticket:<price>|asset:<asset>|winners:<count>|shares:<csv>|donation_account:<account>|donation_percent:<percent>
Fields:
id– Unique lottery IDcreator– Address of lottery creatorname– Lottery namecreated_at– Creation timestamp (Unix)deadline– Deadline timestamp (Unix)burn– Burn percentage (e.g., 10.00)ticket– Ticket price (e.g., 5.000)asset– Asset type (e.g., HIVE)winners– Number of winner positionsshares– Prize distribution CSV (e.g., "50.00,30.00,20.00")donation_account– (Optional) Donation recipient addressdonation_percent– (Optional) Donation percentage
Example:
lc|id:1|creator:hive:alice|name:Weekly Draw|created_at:1703001600|deadline:1703606400|burn:10.00|ticket:5.000|asset:HIVE|winners:3|shares:50.00,30.00,20.00
Emitted when metadata is set or updated.
Format:
lm|id:<id>|metadata:<metadata>
Fields:
id– Unique lottery IDmetadata– Free-form metadata string
Example:
lm|id:1|metadata:ipfs://example
Emitted every time someone buys tickets.
Format:
lj|id:<id>|participant:<address>|tickets:<count>|paid:<amount>|asset:<asset>|ticket_start:<start>|ticket_end:<end>
Fields:
id– Lottery IDparticipant– Buyer's addresstickets– Number of tickets purchasedpaid– Total amount paid (e.g., 15.000)asset– Asset typeticket_start– First ticket number in range (0-indexed)ticket_end– Last ticket number in range (inclusive)
Example:
lj|id:1|participant:hive:bob|tickets:3|paid:15.000|asset:HIVE|ticket_start:0|ticket_end:2
lj|id:1|participant:hive:bob|tickets:2|paid:10.000|asset:HIVE|ticket_start:3|ticket_end:4
Note: The ticket range allows indexers to track exactly which ticket numbers belong to each participant.
Emitted when a lottery is executed and winners are selected.
Format:
le|id:<id>|pool:<amount>|burned:<amount>|donated:<amount>|asset:<asset>|winners:<count>|seed:<seed>|tickets:<total>|participants:<count>|executed_at:<unix_timestamp>
Fields:
id– Lottery IDpool– Total pool before distributionburned– Total amount burned (includes undistributed funds)donated– Amount donated to charity (0 if none)asset– Asset typewinners– Number of actual winnersseed– Random seed used for selectiontickets– Total tickets soldparticipants– Number of unique participantsexecuted_at– Execution timestamp (Unix)
Example:
le|id:1|pool:100.000|burned:15.500|donated:0.000|asset:HIVE|winners:3|seed:12345678901234567890|tickets:20|participants:5|executed_at:1703606500
Emitted for each winner when prizes are distributed.
Format:
lp|id:<id>|winner:<address>|amount:<amount>|share:<percent>|asset:<asset>|position:<n>
Fields:
id– Lottery IDwinner– Winner's addressamount– Prize amount (e.g., 42.250)share– Prize share percentage (e.g., 50.00)asset– Asset typeposition– Winner position (1st, 2nd, 3rd, etc.)
Example:
lp|id:1|winner:hive:charlie|amount:42.250|share:50.00|asset:HIVE|position:1
lp|id:1|winner:hive:alice|amount:25.350|share:30.00|asset:HIVE|position:2
lp|id:1|winner:hive:bob|amount:16.900|share:20.00|asset:HIVE|position:3
Emitted when a donation is sent to the configured charity/cause.
Format:
ld|id:<id>|recipient:<address>|amount:<amount>|percent:<percent>|asset:<asset>
Fields:
id– Lottery IDrecipient– Donation recipient addressamount– Donation amountpercent– Donation percentageasset– Asset type
Example:
ld|id:1|recipient:hive:oceanDAO|amount:10.000|percent:10.00|asset:HIVE
Emitted when undistributed funds (from rounding or unclaimed shares) are burned.
Format:
lu|id:<id>|amount:<amount>|asset:<asset>
Fields:
id– Lottery IDamount– Amount of undistributed funds burnedasset– Asset type
Example:
lu|id:1|amount:0.500|asset:HIVE
Note: This ensures complete accounting transparency. The total burned = configured burn + undistributed funds.
These events provide complete information to:
- ✅ Track exact ticket ownership and ranges per participant
- ✅ Verify lottery fairness independently using the seed
- ✅ Provide full accounting (every token accounted for)
- ✅ Reconstruct complete lottery history
- ✅ Display user's specific ticket numbers
- ✅ Track all timestamps and state changes
- ✅ Monitor donation flows
- ✅ Account for rounding errors and undistributed funds
All events can be tracked, indexed, and verified by anyone monitoring the blockchain.
Winner selection uses cryptographically secure randomness (SHA-256) based on:
- Transaction ID (unique to each execution)
- Block height and timestamp
- Executor's address
This makes the lottery:
- Verifiable – Anyone can verify the results were determined fairly
- Unpredictable – Results cannot be predicted before execution
- Transparent – All randomness sources are public on-chain
- Auditable – Complete execution history is available
After a lottery is executed, anyone can independently verify that the winners were selected fairly.
The built-in way to verify is using the verify_lottery contract function:
// Call the verify_lottery contract function
// Format: lotteryID|seed
const result = await contract.call("verify_lottery", "1|12345678901234567890")
// Result will be:
// Success: "verification successful: 3 winner(s) match|1:hive:alice|2:hive:bob|3:hive:charlie"
// Failure: "verification failed: winners do not match"To verify a lottery:
- Retrieve the lottery seed from the execution event or on-chain data
- Call
verify_lotterywith the lottery ID and seed - The contract re-runs the selection algorithm and compares results
- Returns success or failure with the winner list
Because the random seed is stored on-chain and the selection algorithm is deterministic, verification always produces the same results. This makes cheating impossible without detection.
- You cannot join a lottery after its deadline
- A lottery cannot be executed before its deadline
- These rules are enforced by the smart contract
Anyone can execute a lottery after its deadline - the creator has no special privileges.
The easiest way to use Ōkinoko Takara is through the Okinoko.io web interface, where you can:
- Browse active lotteries
- Create your own lottery with custom parameters
- Join lotteries with a simple interface
- Track your participation and winnings
- View lottery history and results
| Action | Function | Format | Example |
|---|---|---|---|
| Create Lottery | create_lottery |
name|hours|burn%|shares|price|donationAccount|donationPercent|metaData|max_tickets=<count> |
Weekly Draw|168|10|100|5.000 or Charity Draw|168|10|100|5.000|hive:charity|10|meta|max_tickets=1000 |
| Change Metadata | change_lottery_metadata |
lotteryID|metaData |
1|ipfs://example |
| Join Lottery | join_lottery |
lotteryID |
1 |
| Execute Lottery | execute_lottery |
lotteryID |
1 |
| Verify Lottery | verify_lottery |
lotteryID|seed |
1|12345678901234567890 |
Notes:
- When creating a lottery, the donation parameters are optional. If omitted, no donation is configured.
- When joining, you must also provide a
transfer.allowintent with the amount of HIVE you want to spend on tickets. - When verifying, use the seed from the lottery execution event to independently verify the results.