Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIP329: add optional data fields, fix a JSON type #1750

Merged
merged 19 commits into from
Feb 25, 2025
Prev Previous commit
Next Next commit
more fiat and edits
doc-hex committed Jan 23, 2025
commit e712e991c15c5b7263ddccf0b518bce0c5cb9bf3
35 changes: 21 additions & 14 deletions bip-0329.mediawiki
Original file line number Diff line number Diff line change
@@ -146,38 +146,45 @@ wallet generating the export, and yet would be hard or impossible
for importing tools to reconstruct.

All of the following values are optional for exporter to provide,
but should be given if they are readily on-hand.
but should be given if they are readily available.

=== Transactions ===

* `height`: an integer giving the block height where this fully-confirmed transaction can be found.
Omit for transactions that are confirmed by less than 6 blocks, or use value zero.
* <tt>height</tt>: An integer giving the block height where this fully-confirmed transaction can be found. Omit for transactions that are confirmed by less than 6 blocks, or use value zero.

* `time`: ISO-8601 formated timestamp of the block given by height, preferably in UTC.
Example: `2025-01-23T11:40:35-05:00`.
* <tt>time</tt>: ISO-8601 formatted timestamp of the block given by height, preferably in UTC, although ISO-8601 can represent local times. Example: <tt>2025-01-23T11:40:35-05:00</tt>.

* `fee`: integer giving the number of Satoshis that went to the miner for this transaction.
* <tt>fee</tt>: Integer giving the number of Satoshis that went to the miner for this transaction.

* <tt>rate</tt>: Exchange rate at time of transaction. This is the fiat value of a Bitcoin at the time of the transaction, based on user preferences for data source. Example: <tt>"rate": { "USD": 105620.00 }</tt>

=== Address, Inputs, and Outputs ===

* `keypath`: the data needed to build full descriptor down to the specific address.
This extends `origin` with the final two components are are unhardened (in the typical case,
assuming BIP-84). Provide string `/1/123` for `wpkh([d34db33f/84'/0'/0'/1/123])`. If
the first character is not `/`, then it should be interpreted as a full descriptior,
independant of `origin` (if any).
* <tt>keypath</tt>: The data needed to build full descriptor down to the specific address. This extends <tt>origin</tt> with the final two components are are unhardened (in the typical case, assuming BIP-84). Provide string <tt>/1/123</tt> for <tt>wpkh([d34db33f/84'/0'/0'/1/123])</tt>. If the first character is not <tt>/</tt>, then it should be interpreted as a full descriptor, independant of <tt>origin</tt> (if any).

=== Inputs, and Outputs ===

* `value`: integer with the number of Satoshis (`nValue`) of the input or output.
* <tt>value</tt>: Integer with the number of Satoshis (<tt>nValue</tt>) of the input or output.

* <tt>fmv</tt>: Fair market value of the input/output relative to some other currency, typically fiat. The value should be a mapping, from currency code to decimal number. Example: <tt>"fmv": { "USD": 1233.45 }</tt>. Most situations will have only a single currency value, and it represents the real price of the goods/services expressed in some fiat currency. This is not an exchange *rate*, but an absolute value. By dividing by the <tt>value</tt> (above), it is possible to calculate an effective change rate for the transaction.


=== Address ===

* `heights`: a list of block heights which contain inputs which deposit to the address.
* <tt>heights</tt>: a list of block heights which contain inputs which deposit to the address.

== Comment on Types in JSON ==

JSON can serialize a number of basic types, including string, integer
and boolean (true/false). Decimal values (<tt>123.45</tt>) can
also be serialized, but some parsing libraries may interpret them as floating
point values which is generally not what we want in financial applications.
When hand-crafting JSON data, be careful not to write <tt>"false"</tt> (with quotes),
since that is a string with 5 characters and not a boolean.

==Reference Implementation==

TBD
* [https://github.com/Labelbase/python-bip329 Python-BIP329 package]

==References==