Repository navigation
BIP 377: Signing Message Encoding - #2353
pythcoiner wants to merge 12 commits into
Conversation
c40ccd8 to
984410b
Compare
jonatack
left a comment
There was a problem hiding this comment.
Looks complete. Seems to fill a real gap, provided hardware-wallet vendors would be interested to adopt it.
danielabrozzoni
left a comment
There was a problem hiding this comment.
Reviewed 383f7c7 - I gave a first read and left a few ideas.
I think the BIP is well specified, but sometimes the reading order isn't very helpful to the reader, sometimes terms are used but then specified only later (one example: POR is used on L212 but specified on L506).
What do you think of adding an overview section, to give a high level explanation of the BIP, before jumping into the specification?
I asked claude to generate one, I think is a good start (but please double check that it's correct, and rewrite/remove any part you don't like): danielabrozzoni@729ac8a
| `EXTENDED_KEY`: 78 bytes, the BIP-32 serialization of an extended public or private | ||
| key (4 version + 1 depth + 4 parent fingerprint + 4 child number + 32 chain code + | ||
| 33 key). A private key carries `0x00` followed by its 32-byte key in place of the | ||
| 33-byte public key, and its own version bytes, so both have the same length. |
There was a problem hiding this comment.
What do you mean by "and its own version bytes"? It's tripping me up a little bit. I thought you were saying "the private key has 0x00 + the 32 byte key, so it's the same length as the 33 bytes public key", what does the version have with it?
There was a problem hiding this comment.
it was about the bip32 version:
Line 131 in a7f9132
but i dropped the capability to export private key, it's purpose was to allow using bip352 with a signer, but after talking with @notTanveer we both agree it does not feel right to allow exporting a private key only for that purpose, it's a big footgun from the external signer POV, I guess the right way to do is rather to use a SP private scan key generated from an public key exported from the external signer
| | 0x00 | Stable (final) | | ||
| | 0x01 | Alpha | | ||
| | 0x02 | Beta | | ||
| | 0x03 | Release candidate | |
There was a problem hiding this comment.
Usually release candidates carry a number too - rc1 vs rc2 etc, this should be specified too
There was a problem hiding this comment.
added a byte to carry the rc number
|
|
||
| `VERSION`: in a response body, 8 bytes of device firmware version, `MAJOR` `MINOR` | ||
| `PATCH` `FLAG` (the message's protocol `VERSION` is defined under Encoding). `MAJOR` | ||
| and `MINOR` are 2-byte big-endian unsigned integers, `PATCH` is a 3-byte big-endian |
There was a problem hiding this comment.
Why are you reserving 3 bytes for patch? I can understand 2 bytes for major/minor (1 byte is 0-255 and might not be enough), but 2 seem enough for patch too...
There was a problem hiding this comment.
my bad, I think my initial intent was to reserve a byte for the rc number, fixed
| Unregister Descriptor request without bit 6, or a `musig()` key without bit 7. A | ||
| `FORM` that needs a capability the signer does not advertise, such as `FORM` `0x01` | ||
| without bit 0 or `FORM` `0x03` without bit 5, is the exception: it gets `ERROR` | ||
| `0x06` (see Error response body). |
There was a problem hiding this comment.
This should link to the "Error response" paragraph below
(Both here and in the other 3 places with the same sentence)
| policy always converts to a BIP-380 descriptor, while a descriptor converts to a | ||
| wallet policy only when it fits BIP-388's restrictions. | ||
|
|
||
| A signer taking bit 0 or bit 1 handles the basic descriptors whatever its other |
There was a problem hiding this comment.
"taking" and "whatever" read a bit weird here, I would say:
A signer that sets bit 0 or bit 1 handles the basic descriptors regardless of its other bits: ...
|
|
||
| `MODEL`: `STRING`, the device model. | ||
|
|
||
| `VERSION`: in a response body, 8 bytes of device firmware version, `MAJOR` `MINOR` |
There was a problem hiding this comment.
I think this should be called FW_VERSION, DEVICE_VERSION, or equivalent, so when reading the BIP we don't confuse it with the protocol version specified below
There was a problem hiding this comment.
right, renamed to FW_VERSION
|
Assigned 377. Please update (also have a look at the review feedback), rename the files, and add a README entry. |
|
@danielabrozzoni thanks for the review, I think all your comments are addressed @jonatack thanks for the bip #, I think everything is up to date now |
…h (0x10) error codes
…nd REQUEST_ID 0x0000
…r cannot take is refused with 0x06, an SP sighash other than ALL with 0x0A
3f9fb1f to
d68f168
Compare
|
rebased on master |
ENCODING.md drifted from draft BIP-377 (bitcoin/bips#2353), which is now the reference. The nonce cache is ahead of the BIP and can only land there once its own BIP draft has a draft PR, so NONCE_CACHE.md documents the pending changes against BIP-377 until then.
|
The Motivation opens with "No standard defines the messages a coordinator exchanges with an external signer." I don't think that holds, and the BIP has no prior art or related work section to support it. Blockchain Commons has worked on this problem for years. The UR encoding (BCR-2020-005) and its type registry (BCR-2020-006) define I think this BIP covers real gaps that none of these address. Registering a descriptor on a signer that can't store it, verifying addresses, and handling wallet policies, MuSig2 and silent payments are all new, as is returning just the signatures rather than the whole PSBT. But the case for it should come from comparing it with what exists, not from saying nothing exists. |
This is a bip for signing message encoding, a byte encoding for the messages a coordinator and an external signer exchange: get info, get keys, descriptor registration, address verification and signing.
Mailing list post: https://groups.google.com/g/bitcoindev/c/gmHOr6JRJyU/m/kkWnI_NAAgAJ
Delving post: https://delvingbitcoin.org/t/qr-based-signing-flow-payloads-in-miniscript-context/2464