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

Allow fixed-length decimal amount representation #195

Open
bigspider opened this issue Sep 7, 2023 · 1 comment
Open

Allow fixed-length decimal amount representation #195

bigspider opened this issue Sep 7, 2023 · 1 comment
Labels
enhancement New feature or request ux

Comments

@bigspider
Copy link
Collaborator

bigspider commented Sep 7, 2023

Currently, we use the truncated amount representation for transaction amounts, e.g.:

0.0012 BTC

In order to facilitate thinking about amounts in smaller units (sats) some wallets started representing the decimals in a fixed 8-digits length, with spaces in between:

0.00 120 000 BTC

This has the advantage to allow reading the amount in sats as a normal number, with the usual grouping of 3-digits at a time, for amounts below 1 BTC.

Allowing the software wallet to customize the visualization to match the one they use would improve the UX and avoid confusion.

@bigspider bigspider added enhancement New feature or request ux labels Sep 7, 2023
@bigspider
Copy link
Collaborator Author

bigspider commented Sep 7, 2023

Since version 2.1.2, #133 is merged, which allows using a non-zero p1 byte (currently ignored). Therefore, we could reserve (for example) the two lowest-significant digits of p1 for the preferred format

  • 00: use whatever is Ledger's default
  • 01: truncate (e.g.: 1.23456 BTC)
  • 10: fixed-length (e.g.: 1.23 456 000 BTC
  • 11: ERROR (undefined, shouldn't use!)

(perhaps we should reserve 3 bits to leave room for future formats)

Then in client libraries, we could use this logic:

  • if version <2.1.2: set p1 := 0 (other values would error!)
  • otherwise: pass the flag as requested from the software wallet (it will be gracefully ignored in versions before this feature is merged).

That could be an optional parameter in the sign_psbt command.

@bigspider bigspider changed the title Allow fixed-decimal amount representation Allow fixed-length decimal amount representation Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ux
Projects
None yet
Development

No branches or pull requests

1 participant