Skip to main content

Module stake

Module stake 

Source

Structs§

StakeProof
Wire format the marketplace uses to talk about stake. Travels inside ProviderOfferContent.
Utxo
What a BlockSource returns about a UTXO.

Enums§

StakeError
Errors from the stake module distinct from StakeStatus. These surface programmer-visible failures (malformed input, RPC errors); StakeStatus::Unverified(_) already covers “couldn’t talk to the chain” so verify_stake itself never returns these for the network path.
StakeStatus
Result of verifying a stake proof.

Traits§

BlockSource
Async surface for fetching Bitcoin chain data. Production wires this to two independent Esplora endpoints and requires agreement; tests pass a hand-rolled mock that returns canned values.

Functions§

canonical_signing_message
Build the canonical bytes a provider signs to prove control of the staked UTXO. Deterministic across runs and platforms — any reorder of fields breaks the signature.
stake_rank
Stake ranking score: log(sats × locked_seconds). Higher score = better stake. Returns 0.0 if either factor is zero (not staked, or already unlocked).
validate_esplora_url
Validate an Esplora endpoint URL before we make a request to it. The stake-verification flow involves issuing HTTP requests to operator-supplied URLs; without this, an attacker could point the verifier at internal services (SSRF).
verify_stake
Verify a stake proof against the chain.