Skip to main content

Mining RPCs

RPC commands for MatMul proof-of-work mining, block template construction, and difficulty monitoring.

getblocktemplate

Returns data needed to construct a block. The miner must solve the MatMul proof-of-work over the returned header fields.

btx-cli getblocktemplate '{"rules": ["segwit"]}'

Key response fields for MatMul mining:

FieldDescription
previousblockhashHash of the current chain tip
targetCurrent difficulty target
matmul_dimMatrix dimension (512 mainnet)
seed_a, seed_bDeterministic base matrix seeds derived from chain state
noncerange64-bit nonce range: 0000000000000000ffffffffffffffff

Mining Algorithm

For each nonce candidate:

  1. Derive perturbation matrices E, F from candidate header + nonce
  2. Compute C' = (A+E)(B+F) over F(2^31 − 1)
  3. Hash the transcript: H(A+E ∥ B+F ∥ C')
  4. If hash < target, submit the block

submitblock

Submit a solved block to the network.

btx-cli submitblock "hexdata"

getmininginfo

Returns current mining state including MatMul parameters.

btx-cli getmininginfo

Response includes:

  • blocks — current block height
  • difficulty — current network difficulty
  • matmul_n — matrix dimension (512)
  • matmul_b — transcript block size (16)
  • matmul_r — noise rank (8)
  • networkhashps — estimated network hash rate

getdifficultyhealth

Returns comprehensive difficulty health metrics for network monitoring.

btx-cli getdifficultyhealth

Response categories:

  • recent_interval_stats — mean, p50, p90, p99, stddev of recent block intervals
  • reward_distribution — HHI, Gini coefficient, top miner share, longest streak
  • reorg_protection — configuration state and rejection counters
  • consensus_guards — Freivalds transcript-binding, ASERT half-life visibility

getnetworkhashps

Returns estimated network hashes per second.

btx-cli getnetworkhashps [nblocks] [height]

getmatmulchallenge

Get the current network-bound MatMul challenge with full header context.

btx-cli getmatmulchallenge

Returns the exact header context for sigma reproduction, work profile metrics, and pre-hash lottery exposure.

generatetoaddress

Generate blocks to a specific address (regtest/testing only).

btx-cli generatetoaddress 1 "btx1z..."

Note: Regtest uses fSkipMatMulValidation=true by default, so MatMul proofs are not verified in regtest mode.