Skip to main content

Module mempool

Module mempool 

Source
Expand description

Native mempool.space REST client (provenance-upgrade Phase 3). Concrete solid_pod_rs::mrc20::MempoolLookup + the verify-side solid_pod_rs::provenance::BlockAnchorer. Server-side only (builds a reqwest::Client); wasm consumers implement the trait over fetch. Native mempool.space REST client — the read-side of block-trail anchors.

MempoolHttpClient is the server-side concrete implementation of the pure solid_pod_rs::mrc20::MempoolLookup trait. It speaks the mempool.space-style REST API over the reqwest client the crate already pulls in for the CORS proxy and webhook delivery:

MethodPathReturns
GET{base}/api/address/{addr}/utxoVec<Utxo>
GET{base}/api/tx/{txid}TxInfo

The wire shapes (status: {confirmed, block_height} nested objects) are deserialised into local *Wire structs and flattened into the crate’s transport-free Utxo/TxInfo value types, so the pure verification surface never learns the mempool.space schema.

§wasm boundary

This module is native-only (it builds a reqwest::Client). It mirrors the JSS verifyMrc20Anchor mempool round-trip (mrc20.js:315-327, token.js:176-187) and is the production MempoolLookup the /pay/.deposit MRC20 path and /pay/.address derivation use. wasm consumers implement MempoolLookup over fetch instead and never compile this file.

§Configuration

The base URL is read from JSS_PAY_MEMPOOL_URL (JSS mempoolUrl parity), defaulting to the testnet4 explorer https://mempool.space/testnet4. The reqwest json feature is not enabled crate-wide, so responses are read as text and parsed with serde_json (matching the proxy handler’s manual-parse style).

The endpoint choice is not silent: select_mempool_endpoint resolves the base URL, infer_network classifies the Bitcoin network it serves, and log_mempool_selection records both (plus whether the URL was operator-supplied or defaulted) in the startup log — with a warning when the pod would otherwise be anchoring against an unchosen or unclassifiable chain. MempoolSelection::to_manifest_json renders the same facts for a manifest (ADR-2007).

Structs§

GitmarkAnchorer
A BlockAnchorer over a git-mark trail: each anchored state is the commit hash itself, as text (blocktrails/git-mark b852d7d), with no MRC20 wrapper.
MempoolBlockAnchorer
A BlockAnchorer implementing both sides over a transport that can look up UTXOs (MempoolLookup) and broadcast transactions (MempoolBroadcast). Generic over that transport so a fixture drives it in tests and MempoolHttpClient drives it in production — without changing the logic.
MempoolHttpClient
A MempoolLookup backed by the mempool.space REST API over reqwest.
MempoolSelection
The resolved mempool endpoint: which URL, which chain, and why.

Enums§

BitcoinNetwork
The Bitcoin network a mempool endpoint is understood to serve.
MempoolConfigSource
Where the mempool base URL came from.

Constants§

DEFAULT_MEMPOOL_URL
Default base URL — the mempool.space testnet4 explorer. Matches the JSS default (pay.js:243, mrc20.js:282).
MEMPOOL_CONNECT_TIMEOUT_ENV
Environment override for the mempool client’s connect timeout, in seconds.
MEMPOOL_TIMEOUT_ENV
Environment override for the mempool client’s total request timeout, in seconds.
MEMPOOL_URL_ENV
Environment variable selecting the mempool REST base URL (JSS parity).

Traits§

MempoolTxPresence
Whether the mempool knows a transaction, with a definite “no” kept apart from a transport failure (MempoolLookup::tx cannot tell them apart). GitmarkAnchorer resolves an interrupted broadcast with it.

Functions§

infer_network
Classify the Bitcoin network a mempool base URL serves, purely from the URL.
log_mempool_selection
Record the selected endpoint in the startup log.
log_mempool_selection_once
Emit log_mempool_selection at most once for the lifetime of the process.
select_mempool_endpoint
Resolve the mempool endpoint from an optional configured value.
select_mempool_endpoint_from_env
Resolve the mempool endpoint from MEMPOOL_URL_ENV, delegating the (pure) decision to select_mempool_endpoint.
verify_anchor_report
Check an anchor’s portable proof and walk its trail back from the anchor’s outpoint: the read side both anchorers share.