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: bip-0322.mediawiki
+33-9Lines changed: 33 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,11 +23,31 @@ Additionally, the current message signature format uses ECDSA signatures which d
23
23
24
24
Ultimately no message signing protocol can actually prove control of funds, both because a signature is obsolete as soon as it is created, and because the possessor of a secret key may be willing to sign messages on others' behalf even if it would not sign actual transactions. No signmessage protocol can fix these limitations.
25
25
26
-
==Specification==
26
+
==Types of Signatures==
27
27
28
-
This BIP follows the specification of BIP-325 challenges and solutions (see Signet comparison below).
28
+
This BIP specifies three formats for signing messages: ''legacy'', ''simple''and ''full''. Additionally, a variant of the ''full'' format can be used to demonstrate control over a set of UTXOs.
29
29
30
-
Let there be two virtual transactions to_spend and to_sign.
30
+
=== Legacy ===
31
+
32
+
New proofs should use the new format for all invoice address formats, including P2PKH.
33
+
34
+
The legacy format MAY be used, but must be restricted to the legacy P2PKH invoice address format.
35
+
36
+
=== Simple ===
37
+
38
+
A ''simple'' signature consists of a witness stack, consensus encoded as a vector of vectors of bytes, and base64-encoded. Validators should construct <code>to_spend</code> and <code>to_sign</code> as defined below, with default values for all fields except that
39
+
40
+
* <code>message_hash</code> is a BIP340-tagged hash of the message, as specified below
41
+
* <code>message_challenge</code> in <code>to_spend</code> is set to the scriptPubKey being signed with
42
+
* <code>message_signature</code> in <code>to_sign</code> is set to the provided simple signature.
43
+
44
+
and then proceed as they would for a full signature.
45
+
46
+
=== Full ===
47
+
48
+
Full signatures follow an analogous specification to the BIP-325 challenges and solutions used by Signet.
49
+
50
+
Let there be two virtual transactions <code>to_spend</code> and <code>to_sign</code>.
31
51
32
52
The "to_spend" transaction is:
33
53
@@ -63,6 +83,16 @@ When a proof of funds is being created, additional inputs should be included for
63
83
64
84
Proofs of funds are the base64-encoding of the to_spend and to_sign transactions concatenated in standard network serialisation, and proofs without additional inputs or time locks (simple proofs) are the base64-encoding of the to_sign script witness.
65
85
86
+
=== Full (Proof of Funds) ===
87
+
88
+
A signer may construct a proof of funds, demonstrating control of a set of UTXOs, by constructing a full signature as above, with the following modifications.
89
+
90
+
* <code>message_challenge</code> is unused and shall be set to <code>OP_TRUE</code>
91
+
* Similarly, <code>message_signature</code> is then empty.
92
+
* All outputs that the signer wishes to demonstrate control of are included as additional inputs of <code>to_sign</code>, and their witness and scriptSig data should be set as though these outputs were actually being spent.
93
+
94
+
Unlike an ordinary signature, validators of a proof of funds need access to the current UTXO set, to learn that the claimed inputs exist on the blockchain, and to learn their scriptPubKeys.
95
+
66
96
A validator must verify it is valid and meets the description of virtual transactions as specified above. See "Validation" below.
67
97
68
98
=== Validation ===
@@ -83,12 +113,6 @@ To validate a proof of funds, the following steps must be taken:
83
113
# for each proof of fund input, set the corresponding values in the coins map; abort if the input cannot be found
84
114
# check the signature of each input using consensus rules, then upgradable rules
85
115
86
-
== Legacy format ==
87
-
88
-
New proofs should use the new format for all invoice address formats, including P2PKH.
89
-
90
-
The legacy format MAY be used, but must be restricted to the legacy P2PKH invoice address format.
91
-
92
116
=== Signing ===
93
117
94
118
Given the P2PKH invoice address <code>a</code> and the message <code>m</code>, and the pubkey-hash function <code>pkh(P) = ripemd160(sha256(P))</code>:
0 commit comments