Skip to content

feat: BitcoinZ and Komodo, Zcash shielded fields and large amounts in the Insight listener - #41

Merged
stultusmundi merged 6 commits into
masterfrom
feat/bitcoinz-komodo
Oct 31, 2026
Merged

stultusmundi merged 6 commits into
masterfrom
feat/bitcoinz-komodo

Conversation

@stultusmundi

Copy link
Copy Markdown
Collaborator

Adds BitcoinZ and Komodo, and fixes two gaps in the Insight listener that the comparison against their stock Insight servers turned up. The second fix also changes live Zcash and Zclassic output.

Coins

  • BitcoinZ (BTCZ): factory BitcoinZ = zec.NewZCashRPC; the Zcash parser params already match (magic 0x6427e924, t1/t3). Daemon 2.3.1 pinned (the emergency release that invalidates block 1,860,181). Ports 9174/9074/8074/38374, Insight on 3001 with the UI. SLIP-44 177, 150 s blocks, fiat bitcoinz.
  • Komodo (KMD): new bchain/coins/kmd package that embeds the Zcash RPC and parser with Komodo's params (P2PKH 60 R, P2SH 85 b, magic 0x8de4eef9). Daemon 0.9.2-3 pinned (mandatory for explorers). Ports 9175/9075/8075/38375, Insight on 3001 with the UI. SLIP-44 141, 60 s blocks, fiat komodo. P2PK outputs index under the R address, as komodod's address index does.
  • Parser tests with real mainnet transactions: KMD v1, v4 Sapling, P2PK coinbase and notarisation; BTCZ v4 and funding-stream coinbase. Port checks in build/tools; docs/ports.md regenerated.

Insight listener

  • Zcash-family transaction fields and the true fee. Stock Zcash-family Insight returns vjoinsplit, fOverwintered, nVersionGroupId, nExpiryHeight, and on v4 valueBalance, spendDescs, outputDescs and bindingSig, and its fees includes the shielded parts. Ours sent transparent in − out only, so fees were wrong on t↔z transactions, and the wallet's tax export reads these fields. The new zcash extension (server/insight_zcash.go) adds them for every coin on the Zcash parser (Zcash, Zclassic, Zero, Flux, BitcoinZ, Komodo). Data comes from getrawtransaction (at most 8 concurrent calls per page, with a 32 MiB txid cache); pending txs use the JSON the worker already has. Bitcoin, Firo and Axe output is unchanged, and a test checks this.
  • Amounts above 2^53 satoshis. insightMoney returned HTTP 500 there; about the top 50 BitcoinZ addresses hold more than 90M BTCZ. Amounts are now written as exact JSON numbers, as stock did.

Not included

  • /supply, /circulation, /markets/info and statistics/* from the BTCZ stock Insight: only its UI used them, not the wallet.
  • Komodo reward (interest) values: the stock Insight never returned them; the wallet computes them itself. That calculation has its own bug, filed as ZelCore-io/ZelTreZ#1825.

Tests

go test -tags unittest ./server/ ./bchain/coins/zec/ ./bchain/coins/kmd/ ./bchain/coins/ ./build/tools/ ./api/ in the blockbook-build image: all pass.

insightMoney refused any amount past JavaScript's safe integer range with
a 500, so a BitcoinZ address holding more than 90,071,992.5 BTCZ could not
be read. Coin and satoshi numbers are now written as the exact decimal of
the integer; stock Insight emitted plain numbers there and never failed.
…on 3001

BitcoinZ is a zcashd fork (btcz/bitcoinz). Its chainparams.cpp keeps Zcash's
mainnet pchMessageStart (24 e9 27 64) and t1/t3 base58 versions (1cb8/1cbd),
and bitcoinzd reports the chain as "main", so the coin registers
zec.NewZCashRPC like Zclassic and Zero.

configs/coins/bitcoinz.json: ports 9174/9074/8074/38374 (9170-9173 belong to
Polygon and Heimdall), Insight listener and explorer UI on 3001, SLIP-44 177,
150 second block time, fiat rates from viprates coin "bitcoinz". The backend
block pins the 2.3.1 linux x86_64 tarball by sha256; it has one top-level
folder with bitcoinzd and bitcoinz-cli, hence --strip 1. The hosts run their
own bitcoinzd and Zcash parameters and do not install the backend package.

Parser tests use real BitcoinZ mainnet data from block 1865000: a v4 Sapling
transaction with five t1 outputs and the coinbase with three t3 funding stream
outputs. The public BTCZ Insight serves no raw hex, so both hexes were rebuilt
from the transparent-only /api/tx fields and are hashed back to their txids.
The Zcash-family stock Insight adds vjoinsplit, fOverwintered,
nVersionGroupId, nExpiryHeight and, on sapling txs, valueBalance,
spendDescs, outputDescs and bindingSig to every tx object, and counts the
shielded side in fees. The listener showed the clamped transparent fee,
wrong for every t->z and z->t tx, and none of the fields the wallet's tax
export reads.

Coins on the Zcash parser now get a "zcash" extension that reads the
daemon's verbose tx JSON (from the pending tx, a 32 MiB cache, or
getrawtransaction with at most 8 calls in parallel per page) and adds the
fields in stock's shape. fees = transparent in - out + sum(vpub_new -
vpub_old) + valueBalance. Other coins are unchanged.
…chain parameters

Komodo is a zcashd fork (KomodoPlatform/komodo). Its transactions are Zcash's
(v1/v2 before Overwinter, v4 Sapling after), but its base58 versions are one
byte, so the new bchain/coins/kmd package reuses the Zcash parser and RPC with
Komodo network parameters: magic f9 ee e4 8d, P2PKH 60 ('R'), P2SH 85 ('b'),
WIF 188, standard xpub/xprv versions. Only mainnet is registered and every
chain name maps to it; the magic collides with no other registered network.

P2PK outputs (notary payouts and old coinbases) are indexed under the P2PKH
descriptor of their R address, as komodod's address index does; the shared
BitcoinLikeParser already converts P2PK to P2PKH in GetAddrDescFromVout, so
no option is needed.

configs/coins/komodo.json: ports 9175/9075/8075/38375, Insight listener and
explorer UI on 3001, SLIP-44 141, 60 second block time, fiat rates from
viprates coin "komodo". The backend block pins the v0.9.2-3 linux tarball by
sha256 (flat layout, no --strip) and runs its fetch-params.sh after install;
komodo.conf, komodo-tx, wallet-utility and fetch-params-alt.sh are dropped so
the generated komodo.conf is the one installed. The hosts run their own
komodod and do not install the backend package.

Parser tests use real Komodo mainnet data hashed back to their txids: a v1
transaction and the v1 P2PK coinbase of block 1000000, a v4 Sapling
transaction from block 5168738 and the notarisation transaction of block
3500000 (P2PK to RXL3YXG2ceaB6C5hfJcN4fvmLH2C34knhA plus OP_RETURN), with R and
b address round trips.
@stultusmundi
stultusmundi merged commit 9ddaeff into master Oct 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant