Duels
A Duel is a 1v1 wager on a short game. The first format Pipoke ships is rock-paper-scissors with a commit-reveal protocol that makes peeking impossible. Both players stake POKE, both commit to a move, both reveal, and the contract settles the pot inside one epoch.
Pipoke runs on Octra Devnet today. Any fee, price, or limit referred to here is a contract setting chosen for testing. Every one is owner-settable, and mainnet values will be different. These docs describe how the mechanics work, not what the numbers are.
#The 8-shard surface
Duels run across 8 shards (GameDuelShard deployed eight times). A new duel goes to one shard. Players join, commit, and reveal on that shard.
Sharding spreads concurrent duels so throughput scales with user count.
#The state machine
A duel walks through six states.
| State | Number | Meaning |
|---|---|---|
OPEN |
0 | Created by the initiator. Anyone can join. |
JOINED |
1 | A second player joined. Both stakes are locked. |
COMMITTED |
2 | Both players hashed their moves on chain. |
SETTLED |
3 | Both players revealed. Winner paid. |
CANCELLED |
4 | The initiator cancelled before a joiner landed. |
FORFEITED |
5 | One player failed to reveal in time. The other claimed via timeout. |
#Moves
| Move | Number |
|---|---|
ROCK |
0 |
PAPER |
1 |
SCISSORS |
2 |
#Method surface
| Method | Signature |
|---|---|
create_match |
create_match(wager_raw) |
join_match |
join_match(game_id) |
commit_move |
commit_move(game_id, commit_hash) |
reveal_move |
reveal_move(game_id, move, salt) |
claim_timeout |
claim_timeout(game_id) |
cancel_open |
cancel_open(game_id) |
commit_hash = SHA-256(move || salt). The salt is a random 16-byte hex string the app generates client-side. The (move, salt) pair is saved to local browser storage so the reveal works even after a page reload.
#The commit-reveal protocol
- The creator picks a move and a random salt.
- The creator publishes
commit = SHA-256(move || salt)along with the stake. - The opponent joins, picks a move and a salt, publishes their
commit. - The creator reveals
(move, salt). The shard verifies the hash matches the commit. - The opponent reveals. Same check.
- The shard compares the two moves and pays out the pot to the winner. Ties refund both, minus the small protocol fee.
Because the commit is published before either player can see the other's commit, neither player can react to the other's move. The reveal step verifies the commit was honest.
#Action fees
The shard takes a small protocol fee from the pot. Stakes are net of the fee. Refunds on ties are full minus a smaller flat fee.
#Timeout
If a player fails to reveal within the reveal window, the other player calls claim_timeout(game_id). The state flips to FORFEITED and the claimant takes the pot.
#Session-keyed
Create, join, commit, and reveal all flow through the session key.
#More games coming
Duels is the open spec for 1v1 commit-reveal games on Pipoke. More provably-fair on-chain games are on the way: chess, dice, mini-PvP modes, and tournament layers on top of the existing games. Every new game ships with the same commit-reveal plus open-seed posture.