Repository navigation
feat: BitcoinZ and Komodo, Zcash shielded fields and large amounts in the Insight listener - #41
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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=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, fiatbitcoinz.bchain/coins/kmdpackage that embeds the Zcash RPC and parser with Komodo's params (P2PKH 60R, P2SH 85b, 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, fiatkomodo. P2PK outputs index under the R address, as komodod's address index does.build/tools;docs/ports.mdregenerated.Insight listener
vjoinsplit,fOverwintered,nVersionGroupId,nExpiryHeight, and on v4valueBalance,spendDescs,outputDescsandbindingSig, and itsfeesincludes 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 newzcashextension (server/insight_zcash.go) adds them for every coin on the Zcash parser (Zcash, Zclassic, Zero, Flux, BitcoinZ, Komodo). Data comes fromgetrawtransaction(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.insightMoneyreturned 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/infoandstatistics/*from the BTCZ stock Insight: only its UI used them, not the wallet.Tests
go test -tags unittest ./server/ ./bchain/coins/zec/ ./bchain/coins/kmd/ ./bchain/coins/ ./build/tools/ ./api/in theblockbook-buildimage: all pass.