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: doc/bitcoin.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ Once the user approves, the `REGISTER_WALLET` returns to the client a 32-byte HM
65
65
| 0xE000 |`SW_INTERRUPTED_EXECUTION`| The command is interrupted, and requires the client's response |
66
66
| 0x9000 |`SW_OK`| Success |
67
67
68
-
<!-- TODO: add an introduction section explaining the comand reference notations (e.g. the Bitcoin style varint) -->
68
+
<!-- TODO: add an introduction section explaining the command reference notations (e.g. the Bitcoin style varint) -->
69
69
70
70
## Commands
71
71
@@ -106,7 +106,7 @@ The paths defined in [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-00
106
106
107
107
If the `display` parameter is `0` and the path is not standard, an error is returned.
108
108
109
-
If the `display` parameter is `1`, the result is also shown on the secure screen for verification. The UX flow shows on the device screen the exact path and the complete serialized extended pubkey as defined in [BIP-32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) for that path. If the path is not standard, an additional warning is shown to the user.
109
+
If the `display` parameter is `1`, the result is also shown on the secure screen for verification. The UX flow shows on the device screen the exact path and the complete serialized extended pubkey as defined in [BIP-32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) for that path. If the path is not standard, an additional warning is shown to the user.
110
110
111
111
### REGISTER_WALLET
112
112
@@ -214,9 +214,9 @@ Given a PSBTv2 and a registered wallet (or a standard one), sign all the inputs
214
214
|`<var>`|`global_map_size`| The number of key/value pairs of the global map of the psbt |
215
215
|`32`|`global_map_keys_root`| The Merkle root of the keys of the global map |
216
216
|`32`|`global_map_vals_root`| The Merkle root of the values of the global map |
217
-
|`<var>`|`n_inputs`| The number of inputs of the psbt |
217
+
|`<var>`|`n_inputs`| The number of inputs of the psbt |
218
218
|`32`|`inputs_maps_root`| The Merkle root of the vector of Merkleized map commitments for the input maps |
219
-
|`<var>`|`n_outputs`| The number of outputs of the psbt |
219
+
|`<var>`|`n_outputs`| The number of outputs of the psbt |
220
220
|`32`|`outputs_maps_root`| The Merkle root of the vector of Merkleized map commitments for the output maps |
221
221
|`32`|`wallet_id`| The id of the wallet |
222
222
|`32`|`wallet_hmac`| The hmac of a registered wallet, or exactly 32 0 bytes |
@@ -382,7 +382,7 @@ The response must contain:
382
382
-`1` byte: a 1-byte unsigned integer `b`, the length of the prefix of the pre-image that is part of the response;
383
383
-`b` bytes: corresponding to the first `b` bytes of the preimage.
384
384
385
-
If the pre-image is too long to be contained in a single response, the client should choose `b` to be as large as possible; subsequent bytes are enqueued as single-byte elements that the Hardware Wallet will request with one ore more `GET_MORE_ELEMENTS` requests.
385
+
If the pre-image is too long to be contained in a single response, the client should choose `b` to be as large as possible; subsequent bytes are enqueued as single-byte elements that the Hardware Wallet will request with one or more `GET_MORE_ELEMENTS` requests.
Copy file name to clipboardExpand all lines: doc/merkle.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,15 +9,15 @@ Operations on Merkle trees are composed to create commitments to more complex da
9
9
## Merkle trees
10
10
### Definition
11
11
12
-
A Merkle tree allows to create a commitment to an arbitrarily large list of values; short membership proofs can be provided that can be verified solely withthe knowledge of a single hash (the Merkle tree root)
12
+
A Merkle tree allows to create a commitment to an arbitrarily large list of values; short membership proofs can be provided that can be verified solely with the knowledge of a single hash (the Merkle tree root)
13
13
14
14
Our implementation of Merkle trees loosely follow the structure defined in [RFC 6962](https://www.rfc-editor.org/rfc/pdfrfc/rfc6962.txt.pdf), using SHA-256 as the hash function. We refer to the linked document for a more detailed description. Only one difference (the hash of the empty list) is defined below.
15
15
16
16
We call a *byte string* an arbitrary array of bytes, where each byte is a value between `0` and `255`. A *hash function* takes as input an arbitrary length byte string, and produces a fixed-length output. Outputs of SHA-256 are 32 bytes long.
17
17
18
18
Following the notation of RFC 6962, we are given an ordered list of inputs `D[n] = {d(0), d(1), ..., d(n-1)}`, where each element `d(i)` is a byte string. We denote with `||` the concatenation operator, and with `D[a:b]` the list `{d(a), d(a+1), ..., d(b - 1)}`.
19
19
20
-
We define the Merkle Tree Hash (MTH) (also called the *Merkle root*) as follows.
20
+
We define the Merkle Tree Hash (MTH) (also called the *Merkle root*) as follows.
21
21
22
22
The hash of the empty list is `MTH({}) = 0`, a string of 32 bytes identically equal to `0`. *This definition differs from RFC 6962*.
Copy file name to clipboardExpand all lines: doc/v0/bitcoin.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ Once the user approves, the `REGISTER_WALLET` returns to the client a 32-byte HM
62
62
| 0xE000 |`SW_INTERRUPTED_EXECUTION`| The command is interrupted, and requires the client's response |
63
63
| 0x9000 |`SW_OK`| Success |
64
64
65
-
<!-- TODO: add an introduction section explaining the comand reference notations (e.g. the Bitcoin style varint) -->
65
+
<!-- TODO: add an introduction section explaining the command reference notations (e.g. the Bitcoin style varint) -->
66
66
67
67
## Commands
68
68
@@ -103,7 +103,7 @@ The paths defined in [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-00
103
103
104
104
If the `display` parameter is `0` and the path is not standard, an error is returned.
105
105
106
-
If the `display` parameter is `1`, the result is also shown on the secure screen for verification. The UX flow shows on the device screen the exact path and the complete serialized extended pubkey as defined in [BIP-32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) for that path. If the path is not standard, an additional warning is shown to the user.
106
+
If the `display` parameter is `1`, the result is also shown on the secure screen for verification. The UX flow shows on the device screen the exact path and the complete serialized extended pubkey as defined in [BIP-32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) for that path. If the path is not standard, an additional warning is shown to the user.
107
107
108
108
### REGISTER_WALLET
109
109
@@ -209,9 +209,9 @@ Given a PSBTv2 and a registered wallet (or a standard one), sign all the inputs
209
209
|`<var>`|`global_map_size`| The number of key/value pairs of the global map of the psbt |
210
210
|`32`|`global_map_keys_root`| The Merkle root of the keys of the global map |
211
211
|`32`|`global_map_vals_root`| The Merkle root of the values of the global map |
212
-
|`<var>`|`n_inputs`| The number of inputs of the psbt |
212
+
|`<var>`|`n_inputs`| The number of inputs of the psbt |
213
213
|`32`|`inputs_maps_root`| The Merkle root of the vector of Merkleized map commitments for the input maps |
214
-
|`<var>`|`n_outputs`| The number of outputs of the psbt |
214
+
|`<var>`|`n_outputs`| The number of outputs of the psbt |
215
215
|`32`|`outputs_maps_root`| The Merkle root of the vector of Merkleized map commitments for the output maps |
216
216
|`32`|`wallet_id`| The id of the wallet |
217
217
|`32`|`wallet_hmac`| The hmac of a registered wallet, or exactly 32 0 bytes |
@@ -352,7 +352,7 @@ The response must contain:
352
352
-`1` byte: a 1-byte unsigned integer `b`, the length of the prefix of the pre-image that is part of the response;
353
353
-`b` bytes: corresponding to the first `b` bytes of the preimage.
354
354
355
-
If the pre-image is too long to be contained in a single response, the client should choose `b` to be as large as possible; subsequent bytes are enqueued as single-byte elements that the Hardware Wallet will request with one ore more `GET_MORE_ELEMENTS` requests.
355
+
If the pre-image is too long to be contained in a single response, the client should choose `b` to be as large as possible; subsequent bytes are enqueued as single-byte elements that the Hardware Wallet will request with one or more `GET_MORE_ELEMENTS` requests.
356
356
357
357
### GET_MERKLE_LEAF_PROOF
358
358
@@ -414,4 +414,4 @@ All the current commands use a commit-and-reveal approach: the APDU that starts
414
414
- If a Merkle proof is asked via `GET_MERKLE_LEAF_PROOF`, the proof is verified.
415
415
- If the index of a leaf is asked `GET_MERKLE_LEAF_INDEX`, the proof for that element is requested via `GET_MERKLE_LEAF_PROOF` and the proof verified, *even if the leaf value is known*.
416
416
417
-
Care needs to be taken in designing protocols, as the client might lie by omission (for example, fail to reveal that a leaf of a Merkle tree is present during a call to `GET_MERKLE_LEAF_INDEX`).
417
+
Care needs to be taken in designing protocols, as the client might lie by omission (for example, fail to reveal that a leaf of a Merkle tree is present during a call to `GET_MERKLE_LEAF_INDEX`).
Copy file name to clipboardExpand all lines: doc/v0/wallet.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,9 +27,9 @@ Key placeholder `KP` expressions consist of
27
27
- a single character `@`
28
28
- followed by a non-negative decimal number, with no leading zeros (except for `@0`).
29
29
30
-
The placeholder `@i` for some number *i* represents the *i*-th key in the vector of key orgin informations (which must be of size at least *i* + 1, or the wallet is invalid.
30
+
The placeholder `@i` for some number *i* represents the *i*-th key in the vector of key origin information (which must be of size at least *i* + 1, or the wallet is invalid.
31
31
32
-
Each element of the *key origin informations* list is a `KEY` expression.
32
+
Each element of the *key origin information* list is a `KEY` expression.
33
33
`KEY` expressions:
34
34
35
35
- Key origin information, consisting of:
@@ -61,7 +61,7 @@ The app supports a number of features related to wallet policies. In order to se
61
61
62
62
- register a wallet, validating all the information (policy and keys involved) with the user on the trusted screen;
63
63
- show the addresses for a registered wallet on the trusted screen;
64
-
- sign spends from the wallet.
64
+
- sign spends from the wallet.
65
65
66
66
Since the application is stateless, wallet registration is not persisted on device. In order to make it possible to use a registered wallet in future requests, the device returns a hmac-sha256 (32 bytes long) for the wallet upon a successful registration. The client side is responsible for persisting the wallet policy *and* the returned hmac-sha256, and to provide this information in future requests.
67
67
@@ -122,4 +122,4 @@ A few policies that correspond to standardized single-key wallets can be used wi
122
122
-``sh(wpkh(@0))`` - nested segwit addresses as per [BIP-49](https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki)
123
123
-``tr(@0)`` - single Key P2TR as per [BIP-86](https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki)
124
124
125
-
Note that the wallet policy is considered standard (and therefore usable for signing without prior registration) only if the signing paths (defined in the key origin information) adheres to the corresponding BIP.
125
+
Note that the wallet policy is considered standard (and therefore usable for signing without prior registration) only if the signing paths (defined in the key origin information) adheres to the corresponding BIP.
Copy file name to clipboardExpand all lines: doc/wallet.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ a wallet descriptor template and the vector of key placeholder expressions.
5
5
6
6
A _wallet descriptor template_ follows language very similar to output descriptor, with a few differences; the biggest one is that each `KEY` expression with a key placeholder `KP` expression, that refers to one of the keys in the _keys information vector_, plus the additional derivation steps to use for that key. Contextually, the keys information vector contains all the relevant _xpubs_, and possibly their key origin information.
7
7
8
-
Each entry in the key information vector contains an _xpub_ (other types of keys supported in output script descriptors are not allowed), possible preceeded by the key origin information. The key origin information is compulsory for internal keys.
8
+
Each entry in the key information vector contains an _xpub_ (other types of keys supported in output script descriptors are not allowed), possible preceded by the key origin information. The key origin information is compulsory for internal keys.
9
9
10
10
This section formally defines wallet policies, and how they relate to
11
11
output script descriptors.
@@ -127,7 +127,7 @@ The app supports a number of features related to wallet policies. In order to se
127
127
128
128
- register a wallet, validating all the information (policy and keys involved) with the user on the trusted screen;
129
129
- show the addresses for a registered wallet on the trusted screen;
130
-
- sign spends from the wallet.
130
+
- sign spends from the wallet.
131
131
132
132
Since the application is stateless, wallet registration is not persisted on device. In order to make it possible to use a registered wallet in future requests, the device returns a hmac-sha256 (32 bytes long) for the wallet upon a successful registration. The client side is responsible for persisting the wallet policy *and* the returned hmac-sha256, and to provide this information in future requests.
0 commit comments