Source Anchors
fakenet-miner-script
scripts/run_nockchain_miner_fakenet.sh
MINING_PKH, --mine, --fakenet, --mining-pkh, --peer, --no-default-peers
1-6
Defines the upstream fakenet miner command source: load .env, export MINING_PKH, mine against a local fakenet peer, and suppress default peers.
The script runs nockchain with --mine --fakenet --mining-pkh ${MINING_PKH}, dials /ip4/127.0.0.1/udp/3006/quic-v1, and uses --no-default-peers.
node-fakenet-script
scripts/run_nockchain_node_fakenet.sh
MINING_PKH, --fakenet, --bind-public-grpc-addr, --bind
1-6
Defines the local fakenet hub side that binds QUIC and public gRPC for local miner and wallet/API testing.
The node script binds public gRPC to 127.0.0.1:5555 and QUIC to /ip4/127.0.0.1/udp/3006/quic-v1 while running --fakenet.
mainnet-miner-script
scripts/run_nockchain_miner.sh
MINING_PKH, get_cpu_count, --mine, --num-threads
1-28
Defines upstream operator command shape for non-fakenet mining and automatic CPU-thread selection.
The script exports MINING_PKH, computes logical CPU count, subtracts two threads with a minimum of one, and runs nockchain --mine --num-threads.
mining-cli-flags
crates/nockchain/src/config.rs
mine, mining_pkh, mining_pkh_adv, num_threads, fakenet_pow_len, fakenet_log_difficulty
121-194
Declares the operator-facing mining and fakenet PoW flags that receipts must capture before interpreting mining results.
Mining requires --mine with --mining-pkh or --mining-pkh-adv, supports --num-threads, and exposes fakenet-only PoW length and log difficulty overrides.
fakenet-constants-poke
crates/nockchain/src/lib.rs
fakenet_blockchain_constants, PokeFakenetConstants, with_asert_phase
416-440
Pokes fakenet blockchain constants into the kernel before fakenet operation and applies optional v1/bythos/ASERT/candidate interval overrides.
The fakenet boot path constructs fakenet_blockchain_constants from CLI PoW length/log difficulty, applies phase overrides, and sends PokeFakenetConstants.
fakenet-blockchain-constants
crates/nockchain-types/src/blockchain_constants.rs
DEFAULT_FAKENET_POW_LEN, DEFAULT_FAKENET_LOG_DIFFICULTY, fakenet_blockchain_constants, with_genesis_target_atom_bex, with_pow_len
510-526
Defines relaxed fakenet mining constants derived from mainnet defaults for local testing.
Fakenet overrides update candidate interval, PoW length, genesis target by bex difficulty, first-month coinbase minimum, timelock minimum, base fee, and early phases.
mining-driver-bootstrap
crates/nockchain/src/lib.rs
MiningPkhConfig, create_mining_driver, add_io_driver
481-512
Installs the mining driver with parsed public-key-hash target, mine flag, and thread count before libp2p and gRPC drivers.
The node translates --mining-pkh into share=1 PKH config, derives mine/threads, creates the mining driver, and adds it to the NockApp.
mining-wire-contract
crates/nockchain/src/mining.rs
MiningWire, MiningWire::Mined, MiningWire::Candidate, MiningWire::SetPubKey, MiningWire::Enable
24-50
Names the typed mining wire tags used for key setup, enablement, candidate work, and mined-block submission.
MiningWire maps SetPubKey to setpubkey, Enable to enable, Candidate to candidate, and Mined to mined under wire source miner version 1.
candidate-effect-handler
crates/nockchain/src/mining.rs
mine, MiningData, pow_len, start_mining_attempt
290-378
Receives kernel %mine effects, captures version/header/target/pow_len, starts mining threads, and cancels stale attempts when a new candidate arrives.
The driver accepts a %mine effect payload, stores block_header/version/target/pow_len, starts SerfThread miners, and cancels old attempts when the candidate changes.
mined-pow-poke
crates/nockchain/src/mining.rs
create_poke, set-mining-key-advanced, enable-mining, start_mining_attempt
386-525
Constructs candidate proof pokes, sets mining keys, enables mining, creates random nonce cells, and submits mined PoW back to the main kernel.
The driver builds [version header nonce target pow_len], sends set-mining-key-advanced and enable-mining commands, then pokes MiningWire::Candidate on each mining attempt.
miner-kernel-pow-check
hoon/apps/dumbnet/miner.hoon
prove-block-inner, check-target:mine, %mine-result, %command %pow
38-60
Runs the miner kernel proof attempt and emits either success with command %pow or retry with the digest.
The miner kernel builds prover input, calls prove-block-inner, checks proof hash against target, and returns %mine-result with success/failure.
pow-library
hoon/common/pow.hoon
check-target, prove-block-inner, proof-to-pow
5-27
Defines the common PoW target check and proof-to-pow digest conversion used by the miner kernel.
check-target compares proof hash to target atom, and prove-block-inner dispatches proof versions 0/1/2 before converting proof to PoW.
candidate-block-state
hoon/apps/dumbnet/lib/miner.hoon
update-candidate-block, candidate-block, add-txs-to-candidate
86-113
Refreshes candidate block timestamp and transaction set when the candidate update interval is reached.
The miner library updates candidate block timestamp, logs the change, and adds transactions to the candidate block.
structured-miner-traces
crates/nockchain/src/traces.rs
new_heaviest_chain, new_heaviest_miner, block_height, heaviest_block_digest
1-17,76-110
Translates miner and heaviest-chain kernel spans into stdout-visible structured events used by monitoring and tests.
The traces driver records new_heaviest_chain and new_heaviest_miner with block height and digest fields.
libp2p-request-pow-separation
crates/nockchain-libp2p-io/src/messages.rs
gen2_pow_preimage, gossip_pow_preimage, solve_pow, verify_pow, AuthenticatedGossip
807-1130
Separates network request/gossip EquiX anti-spam PoW from block-mining PoW so diagnostics do not conflate the two.
Libp2p request PoW uses sender/receiver/message preimages, verifies inbound request PoW, and authenticates gossip independently of miner candidate proof.