You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: motoko/basic_bitcoin/README.md
+12-19
Original file line number
Diff line number
Diff line change
@@ -85,10 +85,8 @@ Candid:
85
85
86
86
Your canister is live and ready to use! You can interact with it using either the command line or the Candid UI, which is the link you see in the output above.
87
87
88
-
In the output above, to see the Candid Web UI for your bitcoin canister, you would use the URL `https://a4gq6-oaaaa-aaaab-qaa4q-cai.raw.icp0.io/?id=<YOUR-CANISTER-ID>`. Here are the two methods you will see:
89
-
90
-
*`public_key`
91
-
*`sign`
88
+
In the output above, to see the Candid Web UI for your bitcoin canister, you would use the URL `https://a4gq6-oaaaa-aaaab-qaa4q-cai.raw.icp0.io/?id=<YOUR-CANISTER-ID>`. Candid
89
+
Web UI will contain all methods implemented by the canister.
92
90
93
91
## Step 2: Generating a Bitcoin address
94
92
@@ -99,7 +97,7 @@ if you are interested in a high-level comparison of different address types.
99
97
These addresses can be generated from an ECDSA public key or a Schnorr
where the funds can be spent using the provided public key with the script
122
+
path, where the Merkelized Alternative Script Tree (MAST) consists of a
123
+
single script allowing to spend funds by exactly one key.
120
124
121
125
Note that P2TR *key path* spending with a tweaked key is currently not available
122
126
on the IC because the threshold Schnorr signing interface does not allow
@@ -128,7 +132,7 @@ post](https://bitcoin.stackexchange.com/a/111100) by Pieter Wuille.
128
132
129
133
On the Candid UI of your canister, click the "Call" button under
130
134
`get_${type}_address` to generate a `${type}` Bitcoin address, where `${type}`
131
-
is one of `[p2pkh, p2tr_raw_key_spend]`.
135
+
is one of `[p2pkh, p2tr_raw_key_spend, p2tr_script_spend]`.
132
136
133
137
Or, if you prefer the command line:
134
138
@@ -173,7 +177,7 @@ Checking the balance of a Bitcoin address relies on the [bitcoin_get_balance](ht
173
177
## Step 5: Sending bitcoin
174
178
175
179
You can send bitcoin using the `send_from_${type}` endpoint on your canister, where
176
-
`${type}` is on of `[p2pkh, p2tr_raw_key_spend]`.
180
+
`${type}` is on of `[p2pkh, p2tr_raw_key_spend, p2tr_script_spend]`.
177
181
178
182
In the Candid UI, add a destination address and an amount to send. In the example
179
183
below, we're sending 4'321 Satoshi (0.00004321 BTC) back to the testnet faucet.
@@ -226,15 +230,4 @@ For example, the following aspects are particularly relevant for this app:
226
230
*[Certify query responses if they are relevant for security](https://internetcomputer.org/docs/current/references/security/general-security-best-practices#certify-query-responses-if-they-are-relevant-for-security), since the app e.g. offers a method to read balances.
227
231
*[Use a decentralized governance system like SNS to make a canister have a decentralized controller](https://internetcomputer.org/docs/current/developer-docs/security/security-best-practices/overview)
228
232
229
-
## Taproot transactions
230
-
In addition to P2PKH transactions, this example now also suppots P2TR
231
-
transactions, namely the so-called untweaked key path P2TR transactions, which
232
-
is the most efficient way of performing a P2TR transaction. The limitation of
233
-
this type of transactions is that it cannot be used in combination with scripts.
234
-
IMPORTANT: Note that BIP341 advises against using taproot addresses that can be
235
-
spent with an untweaked key. This precaution is to prevent attacks that can
236
-
occur when creating taproot multisigner addresses using specific multisignature
237
-
schemes. However, the Schnorr API of the internet computer does not support
238
-
Schnorr multisignatures.
239
-
240
233
This implementation has only been tested locally with regtest.
0 commit comments