-
Notifications
You must be signed in to change notification settings - Fork 7
/
unroll.hack
54 lines (51 loc) · 898 Bytes
/
unroll.hack
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// unroll-closure
// constructorInputs:
left_taproot_key:
type: schnorr public key
left_amount:
type: little-endian uint64
right_taproot_key:
type: schnorr public key
right_amount:
type: little-endian uint64
// witness (empty)
// script:
OP_0
OP_INSPECTOUTPUTSCRIPTPUBKEY
OP_1
OP_EQUALVERIFY
OP_DATA_32
<left_taproot_key>
OP_EQUALVERIFY
OP_0
OP_INSPECTOUTPUTVALUE
OP_1
OP_EQUALVERIFY
OP_DATA_8
<left_amount>
OP_EQUALVERIFY
OP_1
OP_INSPECTOUTPUTSCRIPTPUBKEY
OP_1
OP_EQUALVERIFY
OP_DATA_32
<right_taproot_key>
OP_EQUALVERIFY
OP_1
OP_INSPECTOUTPUTVALUE
OP_1
OP_EQUALVERIFY
OP_DATA_8
<right_amount>
OP_EQUAL
// miniscript policy
and_v(
and_v(
spk_eq(out_spk(0), "5120" + <left_taproot_key>),
value_eq(out_value(0), <left_amount>)
),
and_v(
spk_eq(out_spk(1), "5120" + <right_taproot_key>),
value_eq(out_value(1), <right_amount>)
)
)