bmc Bitcoin Machine Code Operations
GitHub

Operations, Networking & Interfaces

Complete operator reference for running bmcbitcoind across clearnet and anonymity networks, serving JSON-RPC / REST / Esplora / ZMQ, managing encrypted HD wallets, and performing zero-downtime binary swaps.

1. P2P & Privacy Networks

IPv4, IPv6 & BIP324 v2

Listens on IPv4 and IPv6 simultaneously (8333 main, 48333 testnet4, 38333 signet, 18444 regtest). v2transport=1 (default) enables BIP324 ElligatorSwift + ChaCha20-Poly1305 encrypted transport inbound and outbound with seamless v1 fallback.

Tor v3 & Stream Isolation

Configure onion=127.0.0.1:9050 (or proxy= for all networks). With listenonion=1 and torcontrol=127.0.0.1:9051, authenticates via HASHEDPASSWORD / NULL / SAFECOOKIE (never plaintext cookie) and publishes a persistent v3 onion service. All proxied connections (onion, IPv4, IPv6, DNS, and seed gathers) use random per-connection SOCKS5 credentials (proxyrandomize=1) for Tor circuit isolation.

I2P (SAM 3.1) & CJDNS

Set i2psam=127.0.0.1:7656 to maintain a persistent I2P destination (i2p_private_key) for outbound and inbound streams, plus transient I2P sessions for private broadcast. Enable CJDNS fc00::/8 routing with cjdnsreachable=1.

2. JSON-RPC, REST & Esplora Facade

Embedded JSON-RPC Server (162 Core Methods)

  • Authentication: Ephemeral 0600 .cookie file (default), salted-HMAC rpcauth= (compatible with Core's rpcauth.py), or rpcuser/rpcpassword. Per-user method restrictions via rpcwhitelist= + rpcwhitelistdefault= (supporting usernames up to 255 characters).
  • Multi-Lane Concurrency: Intake threads classify requests into FAST (lock-free: uptime, getblockcount, getblockchaininfo, getpeerinfo, getnetworkinfo), NOLOCK (private lane mutex: mempool reads, getblock, getrawtransaction v0/v1, getchaintxstats), and EXCL (writer-preferring rwlock, yielded around cross-process IPC and external signer execution).
  • HTTP Hardening: Rejects Transfer-Encoding, duplicate/negative/overflowing Content-Length (400 Bad Request), enforces total request deadlines (408) and bounded work queues (503).

Core REST (rest=1) & Esplora Facade (bmc.esploraport)

  • REST: Serves Core's 14 unauthenticated /rest/* routes (.json, .hex, .bin) on the RPC listener (keep loopback-bound).
  • Esplora for mempool.space: Enable bmc.esploraport=3002 with txindex=1, txospenderindex=1, and addrindex=1 to point an unpatched mempool.space backend directly at bmcbitcoind (BACKEND: "esplora"). Runs a fixed worker pool with no wildcard CORS and a background serialized mempool refresher.

3. HD Wallet, Descriptors, Miniscript & MuSig2

  • HD & Encryption: BIP32/BIP39 seed wallet with AES-256-CBC encryption (encryptwallet, walletpassphrase, walletlock), multi-wallet support (createwallet, loadwallet, unloadwallet), and 0600 O_NOFOLLOW + durable-fsync wallet backups.
  • Descriptors & Miniscript: Full parsing, range expansion, checksum verification, and non-malleable satisfaction for pkh, wpkh, sh, wsh, tr, rawtr, multi/sortedmulti, multi_a, and full iterative Miniscript (including Tapscript thresh() >255 subexpressions).
  • BIP327 MuSig2 & PSBT v0/v2: Full PSBT v0/v2 (BIP370/371/373) pipeline with musig() (BIP390) descriptors, thread-safe stack-allocated nonce generation, secret intermediate wiping, and verified 3-of-3 interoperability with Bitcoin Core wallets.
  • External Signer (signer=): HWI-compatible external signer interface executing in a dedicated process group with g_exec_lock yielded and a bounded 30s timeout (SIGTERM/SIGKILL cleanup) so a hung hardware signer cannot stall RPC.

4. Native ZMTP 3.1 ZMQ & Shell Hooks

  • Zero-Dependency ZMQ: Native ZMTP 3.1 PUB server (no libzmq dependency) supporting zmqpubhashblock, zmqpubhashtx, zmqpubrawblock, zmqpubrawtx, and zmqpubsequence (with per-topic *hwm and clean shutdown teardown).
  • Non-Blocking Shell Hooks: blocknotify, alertnotify, startupnotify, and shutdownnotify sanitize %s before execution and synchronize child startup via a CLOEXEC pipe (never blocking on unrelated children under SIGCHLD=SIG_IGN).

5. Configuration Reference (bitcoin.conf)

KeyDefaultCategoryDescription
chain / signet / testnet4 / regtestmainChainSelect network. Legacy testnet3 is explicitly refused.
signetchallengepublic signetChainCustom BIP325 signet challenge script (derives network magic).
listen / port / bind1 / default / allP2PInbound P2P listener on IPv4 & IPv6.
proxy / onion / proxyrandomize— / proxy / 1PrivacySOCKS5 proxy + random per-connection Tor circuit isolation.
torcontrol / torpassword / listenonion127.0.0.1:9051 / — / 1PrivacyEphemeral Tor v3 onion service management (SAFECOOKIE / HASHEDPASSWORD).
i2psam / i2pacceptincoming / cjdnsreachable— / 1 / 0PrivacyI2P SAM 3.1 bridge and CJDNS fc00::/8 routing.
onlynet / v2transport / asmapall / 1 / —P2PRestrict outbound networks, enable BIP324 v2 transport, ASMap bucketing.
maxmempool / mempoolexpiry / persistmempool300 MiB / 336 h / 1MempoolShared mempool byte budget, expiry, and Core-format mempool.dat persistence.
limitclustercount / limitclustersize64 / 101 kvBMempoolCore v31.1 cluster mempool acceptance limits.
minrelaytxfee / incrementalrelayfee / dustrelayfeeCore defaultsMempoolRelay, RBF increment, and dust threshold feerates (BTC/kvB).
dbcache / par / prune450 MiB / 0 (auto) / 0StorageUTXO memtable budget, script verify threads (-1..64), pruning (0, 1, ≥550 MiB).
txindex / txospenderindex / coinstatsindex0IndexesOptional indexes built incrementally as sorted runs during IBD.
blockfilterindex / addrindex0IndexesBIP158 compact filters and native address history index (set before sync).
rpcport / rpcbind / rpcallowip / rpcauthdefault / loopbackRPCJSON-RPC listener, IP allowlist, and salted-HMAC credentials.
rpcwhitelist / rpcwhitelistdefault / rpcthreads— / auto / 4RPCPer-user method whitelists and RPC execution worker threads.
rest / bmc.esploraport / bmc.esplorabind0 / 0 / 127.0.0.1HTTPUnauthenticated Core REST and Esplora facade (loopback recommended).
zmqpubhashblock / zmqpubrawtx / zmqpubsequence—ZMQNative ZMTP 3.1 publishers (wildcard tcp://* refused).
signer / walletdir / disablewallet— / chain dir / 0WalletExternal HWI signer command, wallet directory, and wallet disable flag.
bmc.asyncflush / bmc.memtableanon1 / 1TuningForked async UTXO memtable flush (B3) and anonymous huge-page memtable (B11).
bmc.lsmreads / bmc.dropappendsmmap / 0TuningSwitch to pread + page-cache drop for low-PSS sync (~22 GB peak vs ~56 GB).
bmc.benchlog / bmc.indexrunblocks0 / 20000DiagnosticsPer-stage benchmark timing logs and sorted-run height interval.

6. Atomic Upgrade & Rollback Runbook

Production deployments use versioned binaries behind a symlink (bmcbitcoind.live) so rollbacks take seconds:

# 1. Verify full Linux gate before installing
make -C asm test 2>&1 | tee /tmp/bmc_gate.log
make -C asm gate-log-check LOG=/tmp/bmc_gate.log

# 2. Build hardened runtime & install atomically beside previous release
make -C asm runtime
cp -p asm/daemon/bmcbitcoind asm/daemon/bmcbitcoind.deploy-YYYYMMDDa
ln -sfn bmcbitcoind.deploy-YYYYMMDDa asm/daemon/bmcbitcoind.live
sudo systemctl restart bmcbitcoind

# 3. Verify live build commit, tip sync, mempool & fee estimator
asm/daemon/bmc_cli -datadir=/path/to/datadir getnetworkinfo
asm/daemon/bmc_cli -datadir=/path/to/datadir getblockchaininfo
asm/daemon/bmc_cli -datadir=/path/to/datadir getmempoolinfo
asm/daemon/bmc_cli -datadir=/path/to/datadir estimatesmartfee 6