Skip to content

Instantly share code, notes, and snippets.

@AdamISZ
Last active August 25, 2026 16:29
Show Gist options
  • Select an option

  • Save AdamISZ/67ce2af8cb354e39cabd42219a53aab2 to your computer and use it in GitHub Desktop.

Select an option

Save AdamISZ/67ce2af8cb354e39cabd42219a53aab2 to your computer and use it in GitHub Desktop.
ascii diagram of aggregated babilonia
Alice input Bob input
(her stakes + cushion) (his stakes)
\ /
\ /
v v
+-----------------------------------------------------+
| U1 - 2-of-2 pot, key = MuSig2(Alice, Bob) | TX1 (funding)
| value = S1 + S2 + S3 + cushion | <<< on-chain
+-----------------------------------------------------+
|
off-chain resolution (no tx): Alice reveals d1, d2, d3 (blind to who won)
Bob returns a win-PoK for each sub-bet he won
|
====== U1 is spent by EXACTLY ONE of these paths ======
| | |
COOPERATIVE (common) ENFORCEMENT (fallback) ABORT (fallback)
| | |
v v v
+-----------+ +-----------+ +-----------+
| Aggregate | TX2 | Splitter | | RefundU1 |
| | <<<chain | | | nLock=t_r |
+-----------+ +-----------+ +-----------+
| | | | | | |
v v v v v v v
net_B net_A SubPot SubPot SubPot stakes back
->Bob ->Alice 1 2 3 to Alice & Bob
(NO , (remainder \ | /
fixed + cushion \ | /
amount) returned) each SubPot_i is spent by EXACTLY ONE of:
|
+----------------+------------------+
| |
+--------------+ +---------------+
| Settle_i | | SubRefund_i |
| adaptor /D_i | | CSV = t_s |
| posts d_i | | stakes back |
+--------------+ +---------------+
|
v
+--------------+
| O_K_i | P2TR, internal key K_i = W_b,i + A_y,i
+--------------+
| |
v v
player dealer timeout leaf
key-path (CSV = t_1): reclaims
claim if Bob didn't claim
(if won) in time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment