Expand description
Chain-view abstraction for responder-side prevout validation (#502).
A responder trusts the proposer to hand it a PSBT whose witness_utxo
values reflect the real on-chain UTXOs it is being asked to spend.
BIP-341 taproot signatures commit to every input’s prevout amount, so an
understated amount produces a signature that is valid on-chain but
bypasses every fee cap the responder computed against the (lied about)
claim: the destination check in validate_migration_sweep_destination
catches the receiving script, but a proposer can still drain the delta
between the honest amount and the declared amount into fees.
ChainView is the read-only interface responders use to fetch the
authoritative amount+script for each PSBT input. Implementations can
back it with an esplora/blockstream HTTP endpoint (the built-in
[EsploraChainView], gated on the esplora-chain-view feature), a
bitcoind JSON-RPC client, or a mock for tests.
Signing sites invoke validate_prevout_amounts_against_chain before
forwarding a PSBT sighash. A mismatch aborts the signing with the same
shape of REFUSED: error the destination guard uses, so operators see
the two defenses side by side.
Enums§
- Chain
View Error - Errors surfaced by a
ChainViewimplementation.
Constants§
- KEEP_
CHAIN_ URL_ ENV - Environment variable operators set to point every keep binary at a
shared chain-view endpoint (
https://blockstream.info/api,https://mempool.space/api, or a self-hosted esplora / mempool instance). Binaries that support #502 read this at signing time.
Traits§
- Chain
View - Read-only view resolving an outpoint’s committed
(value, script_pubkey)for #502 prevout validation.
Functions§
- validate_
prevout_ amounts_ against_ chain - Recompute-and-compare the proposer-declared prevout amount and script of
every PSBT input against the authoritative chain view. Returns
Ok(())only when every input’switness_utxomatches on both fields.