Skip to content

Commit 7cd87e9

Browse files
committed
formatting fix
1 parent 1ca9cc2 commit 7cd87e9

1 file changed

Lines changed: 115 additions & 115 deletions

File tree

‎docs/16_3_Using_Miniscript_with_Descriptors.md‎

Lines changed: 115 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -17,98 +17,98 @@ create a descriptor to read into Bitcoin Core. (We call the result a
1717
Creating a minidescriptor for import into Bitcoin Core is a simple
1818
five-step process.
1919

20-
1. **Create a Spending Policy**
20+
### 1. Create a Spending Policy
2121

22-
We're going to use our president & vice-president policy from
23-
previous chapters:
22+
We're going to use our president & vice-president policy from
23+
previous chapters:
2424

25-
```
26-
or(pk(president),thresh(2,pk(vp1),pk(vp2),pk(vp3)))
27-
28-
```
25+
```
26+
or(pk(president),thresh(2,pk(vp1),pk(vp2),pk(vp3)))
27+
```
2928

30-
2. **Convert the Policy to Miniscript**
29+
### 2. Convert the Policy to Miniscript
3130

32-
Compiling our Policy at [bitcoin.sipa.be](https://bitcoin.sipa.be/miniscript/) gives us our Miniscript:
31+
Compiling our Policy at
32+
[bitcoin.sipa.be](https://bitcoin.sipa.be/miniscript/) gives us our
33+
Miniscript:
3334

34-
```
35-
or_d(pk(president),multi(2,vp1,vp2,vp3))
35+
```
36+
or_d(pk(president),multi(2,vp1,vp2,vp3))
37+
```
3638

37-
```
39+
### 3. Gather the Keys
3840

39-
3. **Gather the Keys**
41+
To enter a minidescriptor into Bitcoin Core requires that you fill
42+
in the keys that should be used using base58 format. Since these
43+
Miniscripts are currently read-only, that means entering the xpubs,
4044

41-
To enter a minidescriptor into Bitcoin Core requires that you fill
42-
in the keys that should be used using base58 format. Since these
43-
Miniscripts are currently read-only, that means entering the xpubs,
45+
Various people involved in a Minidescriptor might have created their
46+
keys in a variety of ways. Our executives used `seedtool` and
47+
`keytool` from [chapter 10](10_0_Working_with_Secrets.md) to create
48+
their secrets as follows:
4449

45-
Various people involved in a Minidescriptor might have created
46-
their keys in a variety of ways. Our executives used `seedtool` and
47-
`keytool` from [chapter 10](10_0_Working_with_Secrets.md) to create
48-
their secrets as follows:
50+
```
51+
SEEDP=$(seedtool)
52+
KEYP=$(keytool --seed $SEEDP --account-derivation-path m/84h/1h/0h/0h --network testnet account-pub-key-base58)
53+
echo $KEYP
4954
50-
```
51-
SEEDP=$(seedtool)
52-
KEYP=$(keytool --seed $SEEDP --account-derivation-path m/84h/1h/0h/0h --network testnet account-pub-key-base58)
53-
echo $KEYP
55+
| tpubDFhGpPUEJaipdEeJtXZAUwb3Hz34hRCCqhvNgRwzrnbsGfXhCNEroYbGVHaVAyTAmJK4HXxLGCTXjP9HjwQRnG3oW7hCFY96JZkmo6kkCdt
5456
55-
| tpubDFhGpPUEJaipdEeJtXZAUwb3Hz34hRCCqhvNgRwzrnbsGfXhCNEroYbGVHaVAyTAmJK4HXxLGCTXjP9HjwQRnG3oW7hCFY96JZkmo6kkCdt
57+
SEEDVP1=$(seedtool)
58+
KEYVP1=$(keytool --seed $SEEDVP1 --account-derivation-path m/84h/1h/0h/0h --network testnet account-pub-key-base58)
59+
echo $KEYVP1
5660
57-
SEEDVP1=$(seedtool)
58-
KEYVP1=$(keytool --seed $SEEDVP1 --account-derivation-path m/84h/1h/0h/0h --network testnet account-pub-key-base58)
59-
echo $KEYVP1
61+
|tpubDE1YvUwRqg2N2JfU5LKDGuuv3AM2d2CgMYQauAxgoWnGMVaHETz8n2Cdz3VGi9bbfFeY9dRrydeshyQzqPBLPwSEV8hRBZj5JMEqV3rTkc6
6062
61-
|tpubDE1YvUwRqg2N2JfU5LKDGuuv3AM2d2CgMYQauAxgoWnGMVaHETz8n2Cdz3VGi9bbfFeY9dRrydeshyQzqPBLPwSEV8hRBZj5JMEqV3rTkc6
63+
SEEDVP2=$(seedtool)
64+
KEYVP2=$(keytool --seed $SEEDVP2 --account-derivation-path m/84h/1h/0h/0h --network testnet account-pub-key-base58)
65+
echo $KEYVP2
6266
63-
SEEDVP2=$(seedtool)
64-
KEYVP2=$(keytool --seed $SEEDVP2 --account-derivation-path m/84h/1h/0h/0h --network testnet account-pub-key-base58)
65-
echo $KEYVP2
67+
| tpubDE8xY8eWp6CZcdeVQFYG7c2H12GeUpN5j5WLpGEYxurygx5HfjkcbN28vjMmTdYHRNvPauKRsKdgwuJ4hiyJ93gnXPadBoiZeUUJsQ2sP37
6668
67-
| tpubDE8xY8eWp6CZcdeVQFYG7c2H12GeUpN5j5WLpGEYxurygx5HfjkcbN28vjMmTdYHRNvPauKRsKdgwuJ4hiyJ93gnXPadBoiZeUUJsQ2sP37
68-
69-
SEEDVP3=$(seedtool)
70-
KEYVP3=$(keytool --seed $SEEDVP3 --account-derivation-path m/84h/1h/0h/0h --network testnet account-pub-key-base58)
71-
echo $KEYVP3
69+
SEEDVP3=$(seedtool)
70+
KEYVP3=$(keytool --seed $SEEDVP3 --account-derivation-path m/84h/1h/0h/0h --network testnet account-pub-key-base58)
71+
echo $KEYVP3
7272
73-
| tpubDE4kssfB4wqobfE3GWmYFkyV7giscXNG9HbXu2NykHoF1z9Tf4osozgPX4VZ8MnWxytKfeXAa89oZi9NUNauoLYcY51gFghUia34aAuj6sb
73+
| tpubDE4kssfB4wqobfE3GWmYFkyV7giscXNG9HbXu2NykHoF1z9Tf4osozgPX4VZ8MnWxytKfeXAa89oZi9NUNauoLYcY51gFghUia34aAuj6sb
7474
```
7575

76-
4. **Place the Keys in the Minidescriptor.**
76+
### 4. Place the Keys in the Minidescriptor
7777

78-
We gathered `84h/1h/0h/0h` keys. They're intended to support coins
79-
that are Segwit (`84h`), testnet (`1h`), first account (`0h`),
80-
non-change (`0h`). To allow for a range of addresses, we then
81-
supplement each key with a `/*` when we place it in our minscript.
78+
We gathered `84h/1h/0h/0h` keys. They're intended to support coins
79+
that are Segwit (`84h`), testnet (`1h`), first account (`0h`),
80+
non-change (`0h`). To allow for a range of addresses, we then
81+
supplement each key with a `/*` when we place it in our minscript.
8282

83-
(⚠️ We would have liked to collect `84h/1h/0h` keys and then defined
84-
them as `0h/*`, which would be more normative use, but Bitcoin Core
85-
currently flags that as "duplicate keys" if you try, even though
86-
they're not.)
83+
(⚠️ We would have liked to collect `84h/1h/0h` keys and then defined
84+
them as `0h/*`, which would be more normative use, but Bitcoin Core
85+
currently flags that as "duplicate keys" if you try, even though
86+
they're not.)
8787

88-
```
89-
EXEC_MINID=$(echo "or_d(pk($KEYP/*),multi(2,$KEYVP1/*,$KEYVP2/*,$KEYVP3/*))")
90-
echo $EXEC_MINID
88+
```
89+
EXEC_MINID=$(echo "or_d(pk($KEYP/*),multi(2,$KEYVP1/*,$KEYVP2/*,$KEYVP3/*))")
90+
echo $EXEC_MINID
9191
92-
| or_d(pk(tpubDFhGpPUEJaipdEeJtXZAUwb3Hz34hRCCqhvNgRwzrnbsGfXhCNEroYbGVHaVAyTAmJK4HXxLGCTXjP9HjwQRnG3oW7hCFY96JZkmo6kkCdt/*),multi(2,tpubDE1YvUwRqg2N2JfU5LKDGuuv3AM2d2CgMYQauAxgoWnGMVaHETz8n2Cdz3VGi9bbfFeY9dRrydeshyQzqPBLPwSEV8hRBZj5JMEqV3rTkc6/*,tpubDE8xY8eWp6CZcdeVQFYG7c2H12GeUpN5j5WLpGEYxurygx5HfjkcbN28vjMmTdYHRNvPauKRsKdgwuJ4hiyJ93gnXPadBoiZeUUJsQ2sP37/*,tpubDE4kssfB4wqobfE3GWmYFkyV7giscXNG9HbXu2NykHoF1z9Tf4osozgPX4VZ8MnWxytKfeXAa89oZi9NUNauoLYcY51gFghUia34aAuj6sb/*))
93-
```
92+
| or_d(pk(tpubDFhGpPUEJaipdEeJtXZAUwb3Hz34hRCCqhvNgRwzrnbsGfXhCNEroYbGVHaVAyTAmJK4HXxLGCTXjP9HjwQRnG3oW7hCFY96JZkmo6kkCdt/*),multi(2,tpubDE1YvUwRqg2N2JfU5LKDGuuv3AM2d2CgMYQauAxgoWnGMVaHETz8n2Cdz3VGi9bbfFeY9dRrydeshyQzqPBLPwSEV8hRBZj5JMEqV3rTkc6/*,tpubDE8xY8eWp6CZcdeVQFYG7c2H12GeUpN5j5WLpGEYxurygx5HfjkcbN28vjMmTdYHRNvPauKRsKdgwuJ4hiyJ93gnXPadBoiZeUUJsQ2sP37/*,tpubDE4kssfB4wqobfE3GWmYFkyV7giscXNG9HbXu2NykHoF1z9Tf4osozgPX4VZ8MnWxytKfeXAa89oZi9NUNauoLYcY51gFghUia34aAuj6sb/*))
93+
```
9494

9595
5. **Make a Wish**
9696

97-
To turn our Miniscript into a descriptor (a minidescriptor)
98-
requires one more thing. It has to be defined with a normal
99-
descriptor function.
97+
To turn our Miniscript into a descriptor (a minidescriptor)
98+
requires one more thing. It has to be defined with a normal
99+
descriptor function.
100100

101-
Minidescriptors are currently only readable in Bitcoin Core as
102-
P2WSH addresses (not P2TR addresses). That requires a final step of
103-
embedding the Minidescriptor in `wsh(...)` to create a legal
104-
descriptor for Bitcoin Core to read.
101+
Minidescriptors are currently only readable in Bitcoin Core as P2WSH
102+
addresses (not P2TR addresses). That requires a final step of
103+
embedding the Minidescriptor in `wsh(...)` to create a legal
104+
descriptor for Bitcoin Core to read.
105105

106-
```
107-
EXEC_MINID=$(echo "wsh($EXEC_MINID)")
108-
echo $EXEC_MINID
106+
```
107+
EXEC_MINID=$(echo "wsh($EXEC_MINID)")
108+
echo $EXEC_MINID
109109
110-
| wsh(or_d(pk(tpubDFhGpPUEJaipdEeJtXZAUwb3Hz34hRCCqhvNgRwzrnbsGfXhCNEroYbGVHaVAyTAmJK4HXxLGCTXjP9HjwQRnG3oW7hCFY96JZkmo6kkCdt/*),multi(2,tpubDE1YvUwRqg2N2JfU5LKDGuuv3AM2d2CgMYQauAxgoWnGMVaHETz8n2Cdz3VGi9bbfFeY9dRrydeshyQzqPBLPwSEV8hRBZj5JMEqV3rTkc6/*,tpubDE8xY8eWp6CZcdeVQFYG7c2H12GeUpN5j5WLpGEYxurygx5HfjkcbN28vjMmTdYHRNvPauKRsKdgwuJ4hiyJ93gnXPadBoiZeUUJsQ2sP37/*,tpubDE4kssfB4wqobfE3GWmYFkyV7giscXNG9HbXu2NykHoF1z9Tf4osozgPX4VZ8MnWxytKfeXAa89oZi9NUNauoLYcY51gFghUia34aAuj6sb/*)))
111-
```
110+
| wsh(or_d(pk(tpubDFhGpPUEJaipdEeJtXZAUwb3Hz34hRCCqhvNgRwzrnbsGfXhCNEroYbGVHaVAyTAmJK4HXxLGCTXjP9HjwQRnG3oW7hCFY96JZkmo6kkCdt/*),multi(2,tpubDE1YvUwRqg2N2JfU5LKDGuuv3AM2d2CgMYQauAxgoWnGMVaHETz8n2Cdz3VGi9bbfFeY9dRrydeshyQzqPBLPwSEV8hRBZj5JMEqV3rTkc6/*,tpubDE8xY8eWp6CZcdeVQFYG7c2H12GeUpN5j5WLpGEYxurygx5HfjkcbN28vjMmTdYHRNvPauKRsKdgwuJ4hiyJ93gnXPadBoiZeUUJsQ2sP37/*,tpubDE4kssfB4wqobfE3GWmYFkyV7giscXNG9HbXu2NykHoF1z9Tf4osozgPX4VZ8MnWxytKfeXAa89oZi9NUNauoLYcY51gFghUia34aAuj6sb/*)))
111+
```
112112

113113
## Import a P2WSH Minidescriptor
114114

@@ -117,71 +117,71 @@ readable anywhere that supports Miniscript descriptors. To incorporate
117117
it specifically into Bitcoin Core requires the following additional
118118
steps:
119119

120-
6. **Add the Checksum**
120+
### 6. Add the Checksum
121121

122-
As you'll recall, you always need a checksum for Bitcoin Core
123-
descriptors.
122+
As you'll recall, you always need a checksum for Bitcoin Core
123+
descriptors.
124124

125-
```
126-
EXEC_MINID_CS=$(bitcoin-cli getdescriptorinfo $EXEC_MINID | jq -r '.checksum')
127-
EXEC_MINID=$(echo $EXEC_MINID#$EXEC_MINID_CS)
128-
echo $EXEC_MINID
125+
```
126+
EXEC_MINID_CS=$(bitcoin-cli getdescriptorinfo $EXEC_MINID | jq -r '.checksum')
127+
EXEC_MINID=$(echo $EXEC_MINID#$EXEC_MINID_CS)
128+
echo $EXEC_MINID
129129
130-
| wsh(or_d(pk(tpubDFhGpPUEJaipdEeJtXZAUwb3Hz34hRCCqhvNgRwzrnbsGfXhCNEroYbGVHaVAyTAmJK4HXxLGCTXjP9HjwQRnG3oW7hCFY96JZkmo6kkCdt/*),multi(2,tpubDE1YvUwRqg2N2JfU5LKDGuuv3AM2d2CgMYQauAxgoWnGMVaHETz8n2Cdz3VGi9bbfFeY9dRrydeshyQzqPBLPwSEV8hRBZj5JMEqV3rTkc6/*,tpubDE8xY8eWp6CZcdeVQFYG7c2H12GeUpN5j5WLpGEYxurygx5HfjkcbN28vjMmTdYHRNvPauKRsKdgwuJ4hiyJ93gnXPadBoiZeUUJsQ2sP37/*,tpubDE4kssfB4wqobfE3GWmYFkyV7giscXNG9HbXu2NykHoF1z9Tf4osozgPX4VZ8MnWxytKfeXAa89oZi9NUNauoLYcY51gFghUia34aAuj6sb/*)))#fhq2j999
131-
```
130+
| wsh(or_d(pk(tpubDFhGpPUEJaipdEeJtXZAUwb3Hz34hRCCqhvNgRwzrnbsGfXhCNEroYbGVHaVAyTAmJK4HXxLGCTXjP9HjwQRnG3oW7hCFY96JZkmo6kkCdt/*),multi(2,tpubDE1YvUwRqg2N2JfU5LKDGuuv3AM2d2CgMYQauAxgoWnGMVaHETz8n2Cdz3VGi9bbfFeY9dRrydeshyQzqPBLPwSEV8hRBZj5JMEqV3rTkc6/*,tpubDE8xY8eWp6CZcdeVQFYG7c2H12GeUpN5j5WLpGEYxurygx5HfjkcbN28vjMmTdYHRNvPauKRsKdgwuJ4hiyJ93gnXPadBoiZeUUJsQ2sP37/*,tpubDE4kssfB4wqobfE3GWmYFkyV7giscXNG9HbXu2NykHoF1z9Tf4osozgPX4VZ8MnWxytKfeXAa89oZi9NUNauoLYcY51gFghUia34aAuj6sb/*)))#fhq2j999
131+
```
132132

133-
7. **Double-check Your Addresses**
133+
### 7. Double-check Your Addresses
134134

135-
Before you import your Minidescriptor it's best practice to make
136-
sure you have the right one. You can check this by verifying the
137-
addresses it creates with the `deriveaddresses` command.
135+
Before you import your Minidescriptor it's best practice to make sure
136+
you have the right one. You can check this by verifying the addresses
137+
it creates with the `deriveaddresses` command.
138138

139-
```
140-
bitcoin-cli deriveaddresses $EXEC_MINID 2
139+
```
140+
bitcoin-cli deriveaddresses $EXEC_MINID 2
141141
142-
| [
143-
| "tb1q5wj3hm4vask5zk2xzgdgw9slcpufml37yjnh0jhwf2c3sguuymhqsxc2gd",
144-
| "tb1qyxz7dv9859evxy5uutn3ueer978l73fw9ew0r2ajnj2lp5xltzpsrarv0q",
145-
| "tb1qy2s9l6jkhpnwfeyrsl88jj7e88a9k0dw0c8fyudeqv5lnqapm86q69zuue"
146-
| ]
147-
```
142+
| [
143+
| "tb1q5wj3hm4vask5zk2xzgdgw9slcpufml37yjnh0jhwf2c3sguuymhqsxc2gd",
144+
| "tb1qyxz7dv9859evxy5uutn3ueer978l73fw9ew0r2ajnj2lp5xltzpsrarv0q",
145+
| "tb1qy2s9l6jkhpnwfeyrsl88jj7e88a9k0dw0c8fyudeqv5lnqapm86q69zuue"
146+
| ]
147+
```
148148

149-
Presumably you've got another version of this miniscripted account
150-
somewhere else, on the wallet you're spending from. You should
151-
check the range of addresses you derived with Bitcoin Core against
152-
the first few addresses on that other wallet and make sure they
153-
are the same.
149+
Presumably you've got another version of this miniscripted account
150+
somewhere else, on the wallet you're spending from. You should check
151+
the range of addresses you derived with Bitcoin Core against the first
152+
few addresses on that other wallet and make sure they are the same.
154153

155-
8. **Import Your Minidescriptor**
154+
### 8. Import Your Minidescriptor
156155

157-
Finally, you're ready to import your minidescriptor. You want to do
158-
so into a brand-new wallet:
156+
Finally, you're ready to import your minidescriptor. You want to do
157+
so into a brand-new wallet:
159158

160-
```
161-
bitcoin-cli -named createwallet wallet_name="watchmini" disable_private_keys=true blank=true
162-
```
159+
```
160+
bitcoin-cli -named createwallet wallet_name="watchmini" disable_private_keys=true blank=true
161+
```
163162

164-
Like when we imported other watch-only addresses in
165-
[§7.1](07_1_Creating_Multisig_Public_Keys.md), we create the wallet
166-
without any private keys.
163+
Like when we imported other watch-only addresses in
164+
[§7.1](07_1_Creating_Multisig_Public_Keys.md), we create the wallet
165+
without any private keys.
167166

168-
Now you can import:
169-
170-
```
171-
bitcoin-cli -rpcwallet=watchmini importdescriptors '''[{ "desc": "'$EXEC_MINID'", "timestamp": 1790329126 }]'''
167+
Now you can import:
172168

173-
| [
174-
| {
175-
| "success": true,
176-
| "warnings": [
177-
| "Range not given, using default keypool range"
178-
| ]
179-
| }
180-
| ]
181-
```
182-
183-
You now have a watch-only wallet that you can use to monitor a
184-
range of addresses that you defined through Miniscript!
169+
```
170+
bitcoin-cli -rpcwallet=watchmini importdescriptors '''[{ "desc":
171+
"'$EXEC_MINID'", "timestamp": 1790329126 }]'''
172+
173+
| [
174+
| {
175+
| "success": true,
176+
| "warnings": [
177+
| "Range not given, using default keypool range"
178+
| ]
179+
| }
180+
| ]
181+
```
182+
183+
You now have a watch-only wallet that you can use to monitor a range
184+
of addresses that you defined through Miniscript!
185185

186186
## Spend Your Funds
187187

0 commit comments

Comments
 (0)