Commit message · Andrew PoelstraMerge rust-bitcoin/rust-bitcoin#7167: units: remove `Denomination::MicroBitcoin`
f70e925b7a8ee164f8809f26a45b5dd8301a4bf4 units: remove Denomination::MicroBitcoin (satsfy (Renato Britto))
Pull request description:
Forward note: the goal of this PR is ending [the `MicroBitcoin` discussion](https://github.com/rust-bitcoin/rust-bitcoin/issues/3865#issuecomment-6671175891) with NACKs or ACKs already.
This PR makes `MicroBitcoin` (uBTC) and micro sign forms parse into `Bit`. `Bit` and `MicroBitcoin` are the same 100 sat unit. The issue is these two variants, of equal magnitude, prevent use from using a derived `Ord` in `Denomination` and make `Eq` misleading, as well as be confusing and ugly. This is our chance to fix it, we can always add later after 1.0, but never remove.
Quick history on the subject:
- Not much reason was provided for adding `MicroBitcoin` in [#270](https://github.com/rust-bitcoin/rust-bitcoin/pull/270). Came with no rationale, neither variant is mentioned in the review, and every thread that mentioned that touched this did so tangentially, because it was about something else. The idea of dropping it has been [floated](https://github.com/rust-bitcoin/rust-bitcoin/pull/3934#issuecomment-2605422418) [around](https://github.com/rust-bitcoin/rust-bitcoin/pull/3934#issuecomment-2605438327) [before](https://github.com/rust-bitcoin/rust-bitcoin/pull/3934#issuecomment-2605424530).
- Issue [#729](https://github.com/rust-bitcoin/rust-bitcoin/issues/729) plural and singular forms accepted inconsistently
- Issue [#2820](https://github.com/rust-bitcoin/rust-bitcoin/issues/2820) / PR [#2870](https://github.com/rust-bitcoin/rust-bitcoin/pull/2870) removed MilliSatoshi, Nano and Pico as breaking
- Issue [#3865](https://github.com/rust-bitcoin/rust-bitcoin/issues/3865) should stable crates derive Ord on enums
- PR [#3866](https://github.com/rust-bitcoin/rust-bitcoin/pull/3866) / PR [#3934](https://github.com/rust-bitcoin/rust-bitcoin/pull/3934) derive vs manual Ord, both closed without Ord
- Issue [#3941](https://github.com/rust-bitcoin/rust-bitcoin/issues/3941) / PR [#3943](https://github.com/rust-bitcoin/rust-bitcoin/pull/3943) µBTC spelling in docs and parsing
- Issue [#6353](https://github.com/rust-bitcoin/rust-bitcoin/issues/6353) (still open) Ord blocked by duplicate magnitude
Using GitHub code search, I cannot find any big project using either [`Bit`](https://github.com/search?type=code&q=%2FDenomination%3A%3ABit%5Cb%2F%20language%3ARust%20NOT%20path%3Aamount.rs) or [`MicroBitcoin`](https://github.com/search?type=code&q=%2FDenomination%3A%3AMicroBitcoin%5Cb%2F%20language%3ARust%20NOT%20path%3Aamount.rs) outside rust-bitcoin forks.
Arguments for:
- [BIP 176](https://github.com/bitcoin/bips/blob/master/bip-0176.mediawiki) (Status: Complete) declare that bits is "the standard term for 100 satoshis".
- Bitcoin Core has relabelled µBTC to bits in https://github.com/bitcoin/bitcoin/pull/12035 two weeks after the BIP. Today [`bitcoinunits.cpp`](https://github.com/bitcoin/bitcoin/blob/d0f6d9953a15d7c7111d46dcb76ab2bb18e5dee3/src/qt/bitcoinunits.cpp#L36-L47) has one unit, long name `µBTC (bits)`, short name `bits`.
- Electrum has [`BTC, mBTC, bits, sat`](https://github.com/spesmilo/electrum/blob/master/electrum/util.py#L101-L103), but no µBTC.
- Coinbase shipped a [bits display option](https://www.coinbase.com/blog/its-bits) in 2014.
- Modern wallets dropped the unit altogether. [BlueWallet](https://github.com/BlueWallet/BlueWallet/blob/master/models/bitcoinUnits.ts) and Sparrow offer BTC and sats only. When users ask for it back they ask for bits, [sparrow#777](https://github.com/sparrowwallet/sparrow/issues/777) "to match Bitcoin Core (and most other wallets)", [btcpayserver#250](https://github.com/btcpayserver/btcpayserver/issues/250).
- The [Bitcoin Design Guide](https://bitcoin.design/guide/designing-products/units-and-symbols/) writes it "μBTC (bits)" and names the row `bit`.
- The [Bitcoin wiki](https://en.bitcoin.it/wiki/Units) marks `bit` as the frequent name for the micro-bitcoin.
- No wallet prints `uBTC`, which is what our `MicroBitcoin` displays as.
Arguments against:
- [BIP 177](https://github.com/bitcoin/bips/blob/master/bip-0177.mediawiki#addressing-alternative-approaches) (Status: Draft) refutes BIP 176 as "the Bits Proposal". However, it never direclty mentions µBTC, or develop it as an alternative.
- Blockstream [GDK](https://github.com/Blockstream/gdk/blob/master/docs/source/gdk-json.rst) offers both `"ubtc"` and `"bits"` as separate display units, same duplication we have.
This decision is arbitrary and causes us annoyance. I believe we can just declare that `bits` is the "consensus" name for this unit, no need to carry these 2 around. We can always add MicroBitcoin later, post 1.0. And, given the slowness, by the time these BIP discussions conclude, we may even be launching units 2.0.0+ already, so we can do another breaking change.
By ACKing this, you would be making a pragmatic decision in perfect agreement with the current BIP consensus (which may change later).
ACKs for top commit:
tcharding:
ACK f70e925b7a8ee164f8809f26a45b5dd8301a4bf4
Kixunil:
ACK f70e925b7a8ee164f8809f26a45b5dd8301a4bf4
Tree-SHA512: 46ce47703a80f9316d9402fa3ce696842ca71c653383a369750a218e9f00d4290b99338cec0023a148a9674fc9b34dabbf0215d273ed4f54144d7a8db493a5db
93/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Links an issue, advisory, or supporting reference
Why it was queuedsigning boundaryaccess controlconsensus or confidential-proof validationmerge-commit duplicate discount
AI analysis · Informational 24/100This is a routine API cleanup, not a security fix. The change removes one way of naming a Bitcoin unit ('MicroBitcoin' / 'uBTC') and keeps the equivalent 'bits' form. Any code that previously used the old name will fail to compile or fail to parse those strings, but there is no vulnerability being fixed and no new attack path being opened.