Source Anchors
api-readme-contract
crates/nockchain-api/README.md
nockchain-api, NockchainService, NockchainBlockService, GetBlocks, GetTransactionDetails
1-93
Defines nockchain-api as alpha Tier 1 authority for public API runtime, deployment guidance, risk posture, cache limits, and PMA quickstart.
The README says public gRPC is enabled by --bind-public-grpc-addr, has no auth/authz/rate limiting, exposes NockchainService and NockchainBlockService, and serves block explorer responses from a heaviest-chain cache.
api-binary-bootstrap
crates/nockchain-api/src/main.rs
NockchainAPIConfig::EnablePublicServer, produce_prover_hot_state, init_with_kernel
24-45
Boots the public API binary with the normal Nockchain kernel and prover hot state, enabling the public server only when a bind address is supplied.
The binary parses normal Nockchain CLI flags, maps bind_public_grpc_addr into NockchainAPIConfig, initializes with the Nockchain kernel, and runs the NockApp.
public-grpc-cli-flag
crates/nockchain/src/config.rs
bind_public_grpc_addr, bind_private_grpc_addr, bind_private_grpc_port
217-231
Declares the public gRPC bind flag and private gRPC bind controls that decide endpoint exposure mode.
The public API bind is off by default and recommends 127.0.0.1:5555, while private gRPC defaults to port 5555 unless explicitly overridden.
api-config-driver-toggle
crates/nockchain/src/lib.rs
NockchainAPIConfig, deploy_public, grpc_server_driver, private_nockapp
147-178,542-557
Toggles public gRPC driver installation while always adding the private NockApp gRPC driver.
NockchainAPIConfig distinguishes EnablePublicServer from DisablePublicServer, and init adds public_nockchain::grpc_server_driver only when deploy_public is true.
public-grpc-driver
crates/nockapp-grpc/src/services/public_nockchain/v2/driver.rs
PublicNockchainEffect, grpc_server_driver, grpc_listener_driver
14-90
Connects public gRPC server/listener behavior to NockApp effects, including send-tx effects from wallet/public client flows.
The driver decodes nockchain-grpc send-tx effects and starts a PublicNockchainGrpcServer on the configured socket.
public-service-startup
crates/nockapp-grpc/src/services/public_nockchain/v2/server.rs
PublicNockchainGrpcServer::serve, NockchainServiceServer, NockchainBlockServiceServer, NockchainMetricsService
140-212
Starts health, reflection, NockchainService, NockchainBlockService, metrics service, gRPC-Web, CORS, and IP blocklist layers.
The service marks NockchainService serving immediately, block service not-serving until cache seed, installs reflection, API, block explorer, metrics, CORS, gRPC-Web, and blocklist layers.
block-explorer-refresh
crates/nockapp-grpc/src/services/public_nockchain/v2/server.rs
start_heaviest_chain_refresh, start_block_explorer_refresh, initialize
263-330
Refreshes heaviest-chain state and initializes the block explorer cache before marking block service as serving.
The refresh worker retries cache initialization, only sets NockchainBlockService serving after initialization succeeds, and treats decode errors as fatal.
transaction-accepted-server
crates/nockapp-grpc/src/services/public_nockchain/v2/server.rs
transaction_accepted, tx-accepted, TransactionAcceptedResponse
1408-1524
Serves TransactionAccepted by peeking the kernel's tx-accepted path and returning accepted/error, with metrics for invalid, decode, peek, and NockApp failures.
The method validates tx_id, builds a tx-accepted peek path, decodes Option<Option<bool>>, and returns accepted false when the peek is empty.
block-explorer-get-blocks
crates/nockapp-grpc/src/services/public_nockchain/v2/server.rs
NockchainBlockService, get_blocks, GetBlocksRequest
1527-1680
Serves paginated GetBlocks from the block explorer cache and reports current cached height.
GetBlocks requires a page request, clamps client limit to max page size, decodes cursor tokens, reads cache pages, and records latency metrics.
block-explorer-transaction-details
crates/nockapp-grpc/src/services/public_nockchain/v2/server.rs
get_transaction_details, GetTransactionDetailsRequest, TransactionPending
1900-2008
Serves transaction details or pending/not-found state through the block explorer cache.
Transaction details resolve tx_id, load details from cache/kernel, return pending when the cache reports TxPending, and keep pending separate from details.
public-api-proto
crates/nockapp-grpc-proto/proto/nockchain/public/v2/nockchain.proto
NockchainService, NockchainBlockService, NockchainMetricsService
12-170
Defines the public v2 gRPC service contract for wallet balance/send, tx acceptance, block explorer, transaction details, and metrics.
The proto separates wallet APIs, block explorer APIs, and metrics APIs; transaction responses can be accepted, pending, details, or error depending on method.
public-api-metrics
crates/nockapp-grpc/src/services/public_nockchain/v2/metrics.rs
NockchainGrpcApiMetrics, nockchain_public_grpc.tx_accepted_success, nockchain_public_grpc.block_explorer.seed_ready, nockchain_public_grpc.api_request_blocked
6-287
Names the observability contract for public API balance, send, tx-accepted, heaviest-chain, block explorer cache, latency, and request blocking.
Metrics include cache seed readiness, heaviest-chain age, cache span/coverage, refresh/backfill success, endpoint latency, and request-blocked counts.
wallet-public-tx-accepted
crates/nockchain-wallet/src/main.rs
run_transaction_accepted, format_transaction_accepted_markdown
1690-1765
Enforces wallet tx-accepted checks through the public client and formats accepted/not-yet-accepted output.
The wallet rejects tx-accepted unless --client public is selected, validates the tx id as base58 hash, queries the public gRPC server, and renders accepted-by-node status.