Skip to content

Instantly share code, notes, and snippets.

@ordishs
Created March 5, 2026 11:50
Show Gist options
  • Select an option

  • Save ordishs/96efbccf2b9d270ad324e06ac00665dc to your computer and use it in GitHub Desktop.

Select an option

Save ordishs/96efbccf2b9d270ad324e06ac00665dc to your computer and use it in GitHub Desktop.
BlackjackBet contract in Rúnar
class BlackjackBet extends StatefulSmartContract {
readonly playerPubKey: PubKey;
readonly housePubKey: PubKey;
readonly oraclePubKey: RabinPubKey;
readonly betAmount: bigint;
// ...
public settleBlackjack(outcomeType: bigint, rabinSig: RabinSig,
padding: ByteString, playerSig: Sig) {
// Natural 21: player takes everything (2.5x bet)
}
public settleWin(outcomeType: bigint, rabinSig: RabinSig,
padding: ByteString, playerSig: Sig) {
// Regular win: player gets 2x, house gets remainder
}
public settleLoss(outcomeType: bigint, rabinSig: RabinSig,
padding: ByteString, houseSig: Sig) {
// Loss: house takes everything
}
public cancel(playerSig: Sig, houseSig: Sig) {
// Push/tie: cooperative refund, each gets their stake back
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment