Skip to content

Commit dbb81b3

Browse files
committed
bip-0322: move "legacy" section up, separate "proof of funds", summarize the signature types
1 parent f778098 commit dbb81b3

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

bip-0322.mediawiki

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,31 @@ Additionally, the current message signature format uses ECDSA signatures which d
2323

2424
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.
2525

26-
== Specification ==
26+
== Types of Signatures ==
2727

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.
2929

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>.
3151

3252
The "to_spend" transaction is:
3353

@@ -63,6 +83,16 @@ When a proof of funds is being created, additional inputs should be included for
6383
6484
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.
6585

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+
6696
A validator must verify it is valid and meets the description of virtual transactions as specified above. See "Validation" below.
6797

6898
=== Validation ===
@@ -83,12 +113,6 @@ To validate a proof of funds, the following steps must be taken:
83113
# for each proof of fund input, set the corresponding values in the coins map; abort if the input cannot be found
84114
# check the signature of each input using consensus rules, then upgradable rules
85115
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-
92116
=== Signing ===
93117

94118
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

Comments
 (0)