Skip to content

feat: adopt Zcash support from @openscan/network-connectors #396

Description

@MatiasOS

Summary

Adopt the Zcash support just added to @openscan/network-connectors by releasing it and bumping the explorer's dependency (currently pinned to 1.7 in package.json).

Motivation

Zcash cannot be added to the explorer until the connector exposes a ZcashClient. This issue tracks the connector release and the version bump; #397 and #398 depend on it.

The connector work also carries a routing bug fix that affects Bitcoin, so this is not purely additive — see below.

What landed in network-connectors

ZcashClient + ZcashTypes — the full Zebra (zebrad) RPC surface, ~40 methods:

Group Methods
Chain & blocks getBlockchainInfo getBlockCount getBestBlockHash getBestBlockHeightAndHash getBlockHash getBlock getBlockHeader getDifficulty
Transactions getRawTransaction sendRawTransaction getTxOut
Mempool getMempoolInfo getRawMempool
Address index getAddressBalance getAddressTxIds getAddressUtxos
Shielded zGetTreestate zGetSubtreesByIndex zValidateAddress zListUnifiedReceivers
Mining getBlockTemplate submitBlock getMiningInfo getNetworkSolPs getBlockSubsidy getStandardFee generate generateToAddress
Node & network getInfo getDeprecationInfo getNetworkInfo getPeerInfo ping addNode stop validateAddress
Chain manipulation invalidateBlock reconsiderBlock

Chain IDs (CAIP-2, both verified live via getblockhash(0)):

ZCASH_MAINNET  bip122:00040fe8ec8471911baa1db1266ea15d
ZCASH_TESTNET  bip122:05a60a92d99d85997cce3b87616c089f

Two things to be aware of

1. zcashd is dead — this targets Zebra. zcashd hit its automatic end-of-support halt on 2026-07-18 at block 3417100; every node shut down and refuses to restart, and it does not support the NU6.3/Ironwood upgrade that activated days later. ZcashClient therefore models Zebra's RPC surface, not the legacy ~130-method zcashd one. Wallet RPCs (z_sendmany, z_getbalance, …) live in the separate Zallet daemon and are out of scope.

Consequences for the explorer: Zcash is HTTP-only (Zebra's RPC server is built .http_only()), so there is no WebSocket transport and no subscriptions — live-update behaviour must fall back to polling, as Bitcoin already does.

2. Bitcoin routing bug fixed — please regression-test. Zcash is a Bitcoin fork and shares the bip122: CAIP-2 namespace. ClientFactory's isBitcoinNetwork() matched on the bare bip122: prefix, so a Zcash chain ID would have been routed into BITCOIN_REGISTRY, missed, and thrown Unsupported Bitcoin network. Both guards now test registry membership instead of prefix. Any future Bitcoin fork must follow the same pattern.

Breaking-change check: none

StrategyConfig.rpcUrls widened from string[] to (string | RpcEndpoint)[] to support providers that authenticate via headers:

interface RpcEndpoint {
  url: string;
  headers?: Record<string, string>; // HTTP transports only
}

This is additive — plain URL strings still work unchanged, and NetworkClient.getRpcUrls() keeps its string[] signature by normalising endpoint objects to their URL (so headers are never exposed). A new getRpcEndpoints() returns entries verbatim. Headers are scoped per endpoint, so a credential is never sent to the other providers in the same fallback list. rpcConfig.ts / useRpcLatencyTest.ts should keep compiling as-is.

Test status in network-connectors

Full HTTP suite runs with no new failures vs. the baseline on main (verified by diffing failing test names, not just counts). The 70-odd pre-existing failures are unrelated (Hardhat tests need a local node; some public-RPC flakiness).

Acceptance Criteria

  • Release @openscan/network-connectors with Zcash support
  • Bump the @openscan/network-connectors dependency in package.json
  • Verify ClientFactory.createClient(BITCOIN_MAINNET, …) still returns a BitcoinClient (bip122 routing regression)
  • Confirm AdapterFactory and rpcConfig.ts still typecheck against the widened rpcUrls type
  • bun run build and the existing test suite pass on the new version

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions