Skip to content

Instantly share code, notes, and snippets.

@ariard
Last active May 14, 2022 23:51
Show Gist options
  • Save ariard/713ce396281163337c175d9122163e8f to your computer and use it in GitHub Desktop.
Save ariard/713ce396281163337c175d9122163e8f to your computer and use it in GitHub Desktop.
SETUP_TX:
nlocktime: 0
inputs: N
outputs 0:
amount : `inputs sum`
P = muSig(A, B, C, D)
scripts = []
witness:
sig(P, hash_type = GROUP|ANYPREVOUTANYSCRIPT)
UPDATE_TX N:
nlocktime: `N`
inputs 0:
prevout: `setup_txid:0` || `update_txid:0`
nsequence: 0
output 0:
amount: `inputs_sum`
P = muSig(A, B, C, D)
scripts = [
"P CHECKSIGVERIFY <N+1> CHECKLOCKTIMEVERIFY" (cooperative Eltoo update)
"0 A MERKLESUB P CHECKSIGVERIFY" (unilateral Pool withdrawal)
"0 B MERKLESUB P CHECKSIGVERIFY"
"0 C MERKLESUB P CHECKSIGVERIFY"
"0 D MERKLESUB P CHECKSIGVERIFY"
witness:
sig(P, hash_type = GROUP|ANYPREVOUTANYSCRIPT)
sig(P, hash_type = GROUP|ANYPREVOUT)
WITHDRAW_TX (Alice):
nlocktime: 0
inputs 0:
prevout: `update_txid:0` || `withdraw_txid:0`
nsequence: 0
output 0:
amount: (`pool_sum=inputs_sum` - `alice_balance`)
R = muSig(B, C, D)
scripts = [
"P CHECKSIGVERIFY <N+1> CHECKLOCKTIMEVERIFY"
"0 B MERKLESUB P CHECKSIGVERIFY"
"0 C MERKLESUB P CHECKSIGVERIFY"
"0 D MERKLESUB P CHECKSIGVERIFY"
output 1:
amount: `alice_balance`
P = (A)
scripts = []
witness:
sig(P, hash_type = GROUP|ANYPREVOUT)
SNAPSHOT_TX:
nlocktime: 0
inputs 0:
prevout: `withdraw_txid`
nsequence: 0
output: 0
amount: (`pool_sum`)
P = (B, C, D)
scripts = []
witness:
sig(P, hash_type = GROUP|ANYPREVOUT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment