diff --git a/electrum/constants.py b/electrum/constants.py index ae08dc127..957d2fc92 100644 --- a/electrum/constants.py +++ b/electrum/constants.py @@ -304,8 +304,7 @@ class BitcoinPurple(AbstractNet): } XPUB_HEADERS_INV = inv_dict(XPUB_HEADERS) - # Provisional BIP44 coin type (not SLIP-0044 registered; matches BTCP P2P port) - BIP44_COIN_TYPE = 13496 + BIP44_COIN_TYPE = 0 LN_REALM_BYTE = 0 LN_DNS_SEEDS = [] diff --git a/tecnichal-data.md b/tecnichal-data.md index 5be3a5f1c..456649de2 100644 --- a/tecnichal-data.md +++ b/tecnichal-data.md @@ -519,7 +519,7 @@ Modelled after the `AbstractNet` interface (see `pallectrum` for a working examp | `BOLT11_HRP` | `"btcp"` | `"tbtcp"` | LN invoice prefix | | `GENESIS` | `000003823f…c015` | `000002fdc3…d998` | full hashes in §2.5 / §3 | | `DEFAULT_PORTS` | `{'t':'50001','s':'50002'}` | `{'t':'60001','s':'60002'}` | | -| `BIP44_COIN_TYPE` | **TBD / private project constant** | `1` | not registered for BitcoinPurple — see note | +| `BIP44_COIN_TYPE` | `0` (same as Bitcoin) | `1` | no SLIP-0044 entry; matches Bitcoin derivation | | `LN_REALM_BYTE` | `0` | `1` | LN DNS realm byte; unused while `LN_DNS_SEEDS=[]` | | `LN_DNS_SEEDS` | `[]` | `[]` | no LN seeds configured | | `SKIP_POW_DIFFICULTY_VALIDATION` | `False` only after BTCP retarget support | `False` only after BTCP retarget support | see §7.7 | @@ -527,14 +527,10 @@ Modelled after the `AbstractNet` interface (see `pallectrum` for a working examp | `COINBASE_MATURITY` | `100` | `100` | blocks before coinbase is spendable | | `BLOCK_HEIGHT_FIRST_LIGHTNING_CHANNELS` | `0` | `0` | allowed from genesis if LN is enabled | -> **BIP44 coin type:** BitcoinPurple has no SLIP-0044 entry. `BTCP` at index -> `183` is already assigned to Bitcoin Private, so do not reuse it for -> BitcoinPurple. In Electrum constants, store the non-hardened index -> (`0 <= value < 0x80000000`); wallet derivation code adds the hardened bit when -> building paths such as `m/44'/COIN_TYPE'/0'`. Use one project-wide provisional -> integer until an official SLIP-0044 slot is registered. The `13496` value below -> is a project-local placeholder chosen to match the BTCP P2P port, not a -> registered SLIP-0044 value. +> **BIP44 coin type:** BitcoinPurple uses `0` (same as Bitcoin mainnet). BTCP +> has no SLIP-0044 registration and shares the same HD derivation path +> convention as Bitcoin (`m/44'/0'/0'`). The testnet class keeps `1` +> (standard testnet coin type). ### 7.2 `constants.py` Class Definitions @@ -562,8 +558,7 @@ class BitcoinPurple(AbstractNet): COINBASE_MATURITY = 100 # consensus/consensus.h:19 POW_TARGET_SPACING = 60 # 60-second blocks - # BIP44 coin type — not registered in SLIP-0044 - BIP44_COIN_TYPE = 13496 # provisional private constant; update when registered + BIP44_COIN_TYPE = 0 # same as Bitcoin; no SLIP-0044 entry for BTCP # Lightning. Height 0 means "allowed from genesis" in Electrum. BLOCK_HEIGHT_FIRST_LIGHTNING_CHANNELS = 0 @@ -631,15 +626,14 @@ class BitcoinPurpleTestnet(BitcoinPurple): ### 7.3 Derivation Paths (BIP44 / 49 / 84 / 86) -Standard HD paths for each script type. Replace `COIN_TYPE` with the registered -value (TBD — see §7.1 note). +Standard HD paths for each script type. Mainnet uses coin type `0`; testnet uses `1`. -| BIP | Script type | Path template | xpub/xprv prefix | -|-----|-------------|---------------|-----------------| -| BIP44 | P2PKH (legacy) | `m/44'/COIN_TYPE'/0'/0/n` | `xpub` / `xprv` | -| BIP49 | P2WPKH-P2SH (wrapped SegWit) | `m/49'/COIN_TYPE'/0'/0/n` | `ypub` / `yprv` | -| BIP84 | P2WPKH (native SegWit) | `m/84'/COIN_TYPE'/0'/0/n` | `zpub` / `zprv` | -| BIP86 | P2TR (Taproot) | `m/86'/COIN_TYPE'/0'/0/n` | `xpub` / `xprv` or descriptors | +| BIP | Script type | Path template (mainnet) | xpub/xprv prefix | +|-----|-------------|------------------------|-----------------| +| BIP44 | P2PKH (legacy) | `m/44'/0'/0'/0/n` | `xpub` / `xprv` | +| BIP49 | P2WPKH-P2SH (wrapped SegWit) | `m/49'/0'/0'/0/n` | `ypub` / `yprv` | +| BIP84 | P2WPKH (native SegWit) | `m/84'/0'/0'/0/n` | `zpub` / `zprv` | +| BIP86 | P2TR (Taproot) | `m/86'/0'/0'/0/n` | `xpub` / `xprv` or descriptors | - `ACCOUNT` = `0'` (first account, hardened) - `CHANGE` = `0` (receive) or `1` (change) @@ -770,7 +764,7 @@ Files that must be added or changed in an Electrum fork: | `electrum/chains/bitcoinpurple/checkpoints.json` | Generate from a synced BTCP node | | header chain verifier | Use 120-block retarget and BTCP `powLimit` | | address module | Accept Base58 versions 56/55 and Bech32 HRP `btcp` | -| transaction/wallet formats | Use BTCP provisional BIP44 coin type consistently | +| transaction/wallet formats | Use BIP44 coin type `0` (mainnet) / `1` (testnet) | | Lightning invoice parser | Accept `lnbtcp` / `lntbtcp` BOLT11 prefixes if LN is enabled | | UI/network selector | Expose BitcoinPurple mainnet/testnet names and datadirs | diff --git a/tests/test_bitcoinpurple.py b/tests/test_bitcoinpurple.py index 3f2529103..045e95075 100644 --- a/tests/test_bitcoinpurple.py +++ b/tests/test_bitcoinpurple.py @@ -171,7 +171,7 @@ class TestBitcoinPurpleConstants(ElectrumTestCase): self.assertEqual([], BitcoinPurpleTestnet.LN_DNS_SEEDS) def test_bip44_coin_type(self): - self.assertEqual(13496, BitcoinPurple.BIP44_COIN_TYPE) + self.assertEqual(0, BitcoinPurple.BIP44_COIN_TYPE) self.assertEqual(1, BitcoinPurpleTestnet.BIP44_COIN_TYPE) # --- NETS_LIST integrity ---