pub struct MempoolBlockAnchorer<M: MempoolLookup + MempoolBroadcast + Send + Sync> { /* private fields */ }Expand description
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.
verifyre-derives the expected taproot address from the anchor’s portable proof (pubkey+state_strings) viabt_address, rejects a forgedaddress, then walks the trail back from the anchor’s outpoint (verify_anchor_report): every mark must exist, carry the key its prefix of states derives and spend the mark before it. No pod trust required, and an anchor stays verifiable after later marks spend it.
This anchorer serves the MRC20 trails a pod has already issued (their
marks and states stay as they are); new trails use GitmarkAnchorer.
anchor(Phase 4) loads the named trail from storage, appends an MRC20 state notarisingstate_hash(viaanchor_state, broadcasts the anchoring tx, persists the updated trail, and returns theBlockTrailAnchor(txid/vout/address/state_strings/pubkey). It requires astoragehandle (set viaMempoolBlockAnchorer::with_storage); the verify-only constructorMempoolBlockAnchorer::newleaves itNoneandanchor()then errors with a clear message.
Implementations§
Source§impl<M: MempoolLookup + MempoolBroadcast + Send + Sync> MempoolBlockAnchorer<M>
impl<M: MempoolLookup + MempoolBroadcast + Send + Sync> MempoolBlockAnchorer<M>
Sourcepub fn new(lookup: M) -> Self
pub fn new(lookup: M) -> Self
Wrap a transport as a verify-capable BlockAnchorer. anchor()
is unavailable (no storage) and returns an error explaining that
with_storage is required.
Sourcepub fn with_storage(lookup: M, storage: Arc<dyn Storage>) -> Self
pub fn with_storage(lookup: M, storage: Arc<dyn Storage>) -> Self
Wrap a transport + pod storage as a fully-capable BlockAnchorer
(both verify and anchor). The storage backs the trail load/save at
/.well-known/token/{ticker}.json.
Source§impl<M: MempoolLookup + MempoolBroadcast + Send + Sync> MempoolBlockAnchorer<M>
impl<M: MempoolLookup + MempoolBroadcast + Send + Sync> MempoolBlockAnchorer<M>
Sourcepub async fn verify_report(
&self,
anchor: &BlockTrailAnchor,
) -> Result<Option<TrailReport>, ProvenanceError>
pub async fn verify_report( &self, anchor: &BlockTrailAnchor, ) -> Result<Option<TrailReport>, ProvenanceError>
The per-link report behind BlockAnchorer::verify: None when the
anchor carries no portable proof or its recorded address is not the
derivation; otherwise every mark, walked back from the anchor’s
outpoint, with the TrailVerdict
(verified once every mark is confirmed).
Trait Implementations§
Source§impl<M: MempoolLookup + MempoolBroadcast + Send + Sync> BlockAnchorer for MempoolBlockAnchorer<M>
impl<M: MempoolLookup + MempoolBroadcast + Send + Sync> BlockAnchorer for MempoolBlockAnchorer<M>
Source§fn anchor<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ticker: &'life1 str,
state_hash: &'life2 str,
network: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<BlockTrailAnchor, ProvenanceError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn anchor<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ticker: &'life1 str,
state_hash: &'life2 str,
network: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<BlockTrailAnchor, ProvenanceError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Append one MRC20 state anchoring state_hash under ticker, build +
broadcast the anchoring tx, persist the updated trail, and return the
produced BlockTrailAnchor. This is the expensive-tier write the
provenance design hinges on (ADR-059 §2.2, master-plan Phase 4).
network is honoured as a guard: it must match the trail’s own network
(the trail’s chained-key addresses are network-bound). The returned
anchor’s vout is 0 (the anchoring tx pays the next chained-key UTXO
at output 0); blockheight is None until the tx confirms.