Skip to content

Commit 1d15f3e

Browse files
authored
Merge pull request bitcoin#1452 from sethforprivacy/patch-1
BIP 329: Add `spendable` state to outputs
2 parents b4ea0a9 + fc0950e commit 1d15f3e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bip-0329.mediawiki

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ These standards are well supported and allow users to move easily between differ
2626
There is, however, no defined standard to transfer any labels the user may have applied to the transactions, addresses, public keys, inputs, outputs or xpubs in their wallet.
2727
The UTXO model that Bitcoin uses makes these labels particularly valuable as they may indicate the source of funds, whether received externally or as a result of change from a prior transaction.
2828
In both cases, care must be taken when spending to avoid undesirable leaks of private information.
29+
2930
Labels provide valuable guidance in this regard, and have even become mandatory when spending in several Bitcoin wallets.
3031
Allowing users to import and export their labels in a standardized way ensures that they do not experience lock-in to a particular wallet application.
32+
In addition, many wallets allow unspent outputs to be frozen or made unspendable within the wallet. Since this wallet-related metadata is similar to labels and not captured elsewhere, it is also included in this format.
3133

3234
==Rationale==
3335

@@ -62,6 +64,9 @@ Each JSON object must contain 3 or 4 key/value pairs, defined as follows:
6264
|-
6365
| <tt>origin</tt>
6466
| Optional key origin information referencing the wallet associated with the label
67+
|-
68+
| <tt>spendable</tt>
69+
| One of <tt>true</tt> or <tt>false</tt>, denoting if an output should be spendable by the wallet
6570
|}
6671

6772
The reference is defined for each <tt>type</tt> as follows:
@@ -97,6 +102,8 @@ The reference is defined for each <tt>type</tt> as follows:
97102
| <tt>xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8Nq...</tt>
98103
|}
99104

105+
Each JSON object must contain both <tt>type</tt> and <tt>ref</tt> properties. The <tt>label</tt>, <tt>origin</tt> and <tt>spendable</tt> properties are optional. If the <tt>label</tt> or <tt>spendable</tt> properties are omitted, the importing wallet should not alter these values. The <tt>origin</tt> property should only appear where type is <tt>tx</tt>, and the <tt>spendable</tt> property only where type is <tt>output</tt>.
106+
100107
If present, the optional <tt>origin</tt> property must contain an abbreviated output descriptor (as defined by BIP380<ref>[https://github.com/bitcoin/bips/blob/master/bip-0380.mediawiki BIP-0380]</ref>) describing a BIP32 compatible originating wallet, including all key origin information but excluding any actual keys, any child path elements, or a checksum.
101108
This property should be used to disambiguate transaction labels from different wallets contained in the same export, particularly when exporting multiple accounts derived from the same seed.
102109

@@ -124,7 +131,7 @@ The following fragment represents a wallet label export:
124131
{ "type": "addr", "ref": "bc1q34aq5drpuwy3wgl9lhup9892qp6svr8ldzyy7c", "label": "Address" }
125132
{ "type": "pubkey", "ref": "0283409659355b6d1cc3c32decd5d561abaac86c37a353b52895a5e6c196d6f448", "label": "Public Key" }
126133
{ "type": "input", "ref": "f91d0a8a78462bc59398f2c5d7a84fcff491c26ba54c4833478b202796c8aafd:0", "label": "Input" }
127-
{ "type": "output", "ref": "f91d0a8a78462bc59398f2c5d7a84fcff491c26ba54c4833478b202796c8aafd:1", "label": "Output" }
134+
{ "type": "output", "ref": "f91d0a8a78462bc59398f2c5d7a84fcff491c26ba54c4833478b202796c8aafd:1", "label": "Output" , "spendable" : "false" }
128135
{ "type": "xpub", "ref": "xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8", "label": "Extended Public Key" }
129136
{ "type": "tx", "ref": "f546156d9044844e02b181026a1a407abfca62e7ea1159f87bbeaa77b4286c74", "label": "Account #1 Transaction", "origin": "wpkh([d34db33f/84'/0'/1'])" }
130137
</pre>

0 commit comments

Comments
 (0)