Bitcoin2x is independent and runs a testnet only. There are no BTCX tokens for sale, and no one from the project will ever ask for your seed or keys. Learn more
Bitcoin2xBTCX

Developer documentation

What you need to build wallets, explorers, Lightning-style contracts and tooling on BTCX. If you know Taproot, you already know most of it.

Contents

P2MR address tool

Enter one leaf script for a single-leaf tree, or two leaf scripts to build a two-leaf tree. Everything runs locally in your browser using Web Crypto. The leaf defaults are the p2mr_two_leaf_same_version test vector from BIP 360; choose the bc prefix to compare the address with the BIP.

Expected root for the defaults: ab179431c28d3b68fb798957faf5497d69c883c6fb1e1cd9f81483d87bac90cc.

Constructing a P2MR output

leaf_hash   = tagged_hash("TapLeaf", leaf_version || compact_size(len(script)) || script)
branch_hash = tagged_hash("TapBranch", min(a, b) || max(a, b))
root        = top of the tree built from leaf and branch hashes
scriptPubKey = 0x52 0x20 || root            # OP_2 OP_PUSHBYTES_32 root
address      = bech32m(hrp, witver=2, root)  # "z" after the separator

tagged_hash(tag, m) = SHA256(SHA256(tag) || SHA256(tag) || m)

The difference from BIP 341 is what is missing: no internal key, no tweak, no parity bit. Never create a P2MR output from a key alone, and never create a depth-zero tree, which is anyone-can-spend.

Building a spend

witness = [ <signature(s) / script inputs>,
            <leaf script>,
            <control block> ]           # optional annex last, starting 0x50

control_block = (leaf_version | 0x01) || sibling_hash_1 || ... || sibling_hash_m

Signature hashing follows BIP 341/342 "common signature message" rules, so existing tapscript signing code needs only small changes. The control block is 1 + 32m bytes instead of 33 + 32m.

Post-quantum signatures

BTCX adds post-quantum signature verification for use inside P2MR leaves:

SchemeUseStatus on BTCX testnet
ML-DSA-87 (FIPS 204)Default post-quantum signature; the level NSA CNSA 2.0 specifiesBeing integrated
ML-DSA-44 (FIPS 204)Smaller, cheaper lattice signatureBeing integrated
LMS / XMSS (SP 800-208)Stateful hash-based signatures, which CNSA 2.0 uses for firmware signing. Hard to use safely in wallets because state must never repeatResearch only
SLH-DSA-SHA2-128s (FIPS 205)Conservative hash-based fallback that does not rely on latticesBeing integrated
Schnorr (BIP 340)Classical leaves and hybrid treesSupported, unchanged

Each post-quantum check is charged a validation weight against the tapscript budget: 150 for ML-DSA-44, 400 for ML-DSA-87 and 1,200 for SLH-DSA (a Schnorr check is 50). Measured one-input transactions are 1,027 vB (ML-DSA-44), 1,899 vB (ML-DSA-87) and 2,065 vB (SLH-DSA-SHA2-128s).

Exact opcodes, leaf versions and signature-hash rules will be documented here alongside the node release. Until then, treat any opcode name you see on this site as illustrative.

Network parameters

ParameterBTCX testnet
Block productionSignet (BIP 325): SHA-256d at the signet minimum, and every block signed by one of the two seed servers' keys (1-of-2 challenge, shown as signet_challenge by getblockchaininfo)
P2MR witness version2
Chain"BTCX testnet", a signet of its own, relaunched on 4 December 2026 (the first chain was a fork of Bitcoin testnet4)
Address prefix (HRP)tbtcx, so P2MR addresses start with tbtcx1z. Regtest keeps Bitcoin's bcrt so the upstream test suite runs unchanged
P2P port19777
RPC port19776
BinariesBitcoin Core's names: bitcoind, bitcoin-cli, bitcoin-wallet, bitcoin-tx, bitcoin-util, bitcoin-qt
Chain flag / name-btcxtest / btcxtest (data dir ~/.bitcoin/btcxtest)
Network magicf3 b7 58 d2
Genesis block000003238ff124028657e0fe29fb5b1d5bcc151601b50b54ece72b8b774cade5; P2MR and the post-quantum leaf are active from block 1
Post-quantum key in a scriptOne algorithm ID byte, then the key: 01 ML-DSA-44, 02 ML-DSA-87 (default), 03 SLH-DSA-SHA2-128s. Unknown IDs are reserved for soft forks
P2MR scriptPubKey typewitness_v2_p2mr
MainnetNot launched

RPC

The JSON-RPC interface is Bitcoin Core's, with these additions for P2MR. Run bitcoin-cli -btcxtest help <command> for arguments. Every change to Bitcoin Core is in five patches against v32.1, one per area, with the consensus change on its own.

pqkeygen                          # generate a post-quantum key pair (ML-DSA / SLH-DSA)
createp2mraddress                 # build a P2MR address from one or more leaf keys
signp2mrtransaction               # sign P2MR inputs of a raw transaction
p2mrupdatepsbt                    # PSBT: record the leaf each P2MR input spends
p2mrsignpsbt                      # PSBT: sign P2MR inputs, also on an offline node
p2mrfinalizepsbt                  # PSBT: build the P2MR witnesses and the final transaction
decodescript 5220<root>          # scriptPubKey type "witness_v2_p2mr"

Libraries and references