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.
verify(Phase 3) re-derives the expected taproot address from the anchor’s portable proof (pubkey+state_strings) viabt_address, rejects a forgedaddress, and confirms a UTXO sits at the derived address. No pod trust required.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.
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.
Source§fn verify<'life0, 'life1, 'async_trait>(
&'life0 self,
anchor: &'life1 BlockTrailAnchor,
) -> Pin<Box<dyn Future<Output = Result<bool, ProvenanceError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn verify<'life0, 'life1, 'async_trait>(
&'life0 self,
anchor: &'life1 BlockTrailAnchor,
) -> Pin<Box<dyn Future<Output = Result<bool, ProvenanceError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl<M: Clone + MempoolLookup + MempoolBroadcast + Send + Sync> Clone for MempoolBlockAnchorer<M>
impl<M: Clone + MempoolLookup + MempoolBroadcast + Send + Sync> Clone for MempoolBlockAnchorer<M>
Source§fn clone(&self) -> MempoolBlockAnchorer<M>
fn clone(&self) -> MempoolBlockAnchorer<M>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more