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:
| Method | Path | Returns |
|---|---|---|
| GET | {base}/api/address/{addr}/utxo | Vec<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§
- Gitmark
Anchorer - A
BlockAnchorerover a git-mark trail: each anchored state is the commit hash itself, as text (blocktrails/git-mark b852d7d), with no MRC20 wrapper. - Mempool
Block Anchorer - A
BlockAnchorerimplementing 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 andMempoolHttpClientdrives it in production — without changing the logic. - Mempool
Http Client - A
MempoolLookupbacked by the mempool.space REST API overreqwest. - Mempool
Selection - The resolved mempool endpoint: which URL, which chain, and why.
Enums§
- Bitcoin
Network - The Bitcoin network a mempool endpoint is understood to serve.
- Mempool
Config Source - 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§
- Mempool
TxPresence - Whether the mempool knows a transaction, with a definite “no” kept apart
from a transport failure (
MempoolLookup::txcannot tell them apart).GitmarkAnchorerresolves 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_selectionat 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 toselect_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.