Struct dbc::anchor::Anchor

source ·
pub struct Anchor<L: Proof + StrictDumb> {
    pub txid: Txid,
    pub mpc_proof: L,
    pub dbc_proof: Proof,
}
Expand description

Anchor is a data structure used in deterministic bitcoin commitments for keeping information about the proof of the commitment in connection to the transaction which contains the commitment, and multi-protocol merkle tree as defined by LNPBP-4.

Fields§

§txid: Txid

Transaction containing deterministic bitcoin commitment.

§mpc_proof: L

Structured multi-protocol LNPBP-4 data the transaction commits to.

§dbc_proof: Proof

Proof of the DBC commitment.

Implementations§

source§

impl Anchor<MerkleBlock>

source

pub fn anchor_id(&self) -> AnchorId

Returns id of the anchor (commitment hash).

source§

impl Anchor<MerkleProof>

source

pub fn anchor_id( &self, protocol_id: impl Into<ProtocolId>, message: Message ) -> Result<AnchorId, InvalidProof>

Returns id of the anchor (commitment hash).

source

pub fn into_merkle_block( self, protocol_id: impl Into<ProtocolId>, message: Message ) -> Result<Anchor<MerkleBlock>, InvalidProof>

Reconstructs anchor containing merkle block

source

pub fn to_merkle_block( &self, protocol_id: impl Into<ProtocolId>, message: Message ) -> Result<Anchor<MerkleBlock>, InvalidProof>

Reconstructs anchor containing merkle block

source

pub fn verify( &self, protocol_id: impl Into<ProtocolId>, message: Message, tx: &Tx ) -> Result<bool, VerifyError>

Verifies that the transaction commits to the anchor and the anchor commits to the given message under the given protocol.

source

pub fn convolve( &self, protocol_id: impl Into<ProtocolId>, message: Message ) -> Result<Commitment, InvalidProof>

Verifies that the anchor commits to the given message under the given protocol.

source§

impl Anchor<MerkleBlock>

source

pub fn to_merkle_proof( &self, protocol: impl Into<ProtocolId> ) -> Result<Anchor<MerkleProof>, LeafNotKnown>

Conceals all LNPBP-4 data except specific protocol and produces merkle proof anchor.

source

pub fn into_merkle_proof( self, protocol: impl Into<ProtocolId> ) -> Result<Anchor<MerkleProof>, LeafNotKnown>

Conceals all LNPBP-4 data except specific protocol and converts anchor into merkle proof anchor.

source

pub fn conceal_except( &mut self, protocols: impl AsRef<[ProtocolId]> ) -> Result<usize, LeafNotKnown>

Conceals all LNPBP-4 data except specific protocol.

source

pub fn merge_reveal(self, other: Self) -> Result<Self, MergeError>

Merges two anchors keeping revealed data.

Trait Implementations§

source§

impl<L: Clone + Proof + StrictDumb> Clone for Anchor<L>

source§

fn clone(&self) -> Anchor<L>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<L: Proof + StrictDumb> CommitEncode for Anchor<L>

source§

fn commit_encode(&self, e: &mut impl Write)

Encodes the data for the commitment by writing them directly into a io::Write writer instance
source§

impl CommitmentId for Anchor<MerkleBlock>

source§

const TAG: [u8; 32] = _

§

type Id = AnchorId

Type of the resulting commitment.
source§

fn commitment_id(&self) -> Self::Id

Performs commitment to client-side-validated data
source§

impl<L: Debug + Proof + StrictDumb> Debug for Anchor<L>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, L> Deserialize<'de> for Anchor<L>
where L: Deserialize<'de> + Proof + StrictDumb,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Ord for Anchor<MerkleBlock>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<L: PartialEq + Proof + StrictDumb> PartialEq for Anchor<L>

source§

fn eq(&self, other: &Anchor<L>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Anchor<MerkleBlock>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<L> Serialize for Anchor<L>
where L: Serialize + Proof + StrictDumb,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<L: Proof + StrictDumb> StrictDecode for Anchor<L>

source§

fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>

source§

fn strict_read(lim: usize, reader: impl Read) -> Result<Self, DecodeError>

source§

impl<L: Proof + StrictDumb> StrictDumb for Anchor<L>

source§

fn strict_dumb() -> Self

source§

impl<L: Proof + StrictDumb> StrictEncode for Anchor<L>

source§

fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>

source§

fn strict_write(&self, lim: usize, writer: impl Write) -> Result<usize, Error>

source§

impl<L: Proof + StrictDumb> StrictStruct for Anchor<L>

source§

impl<L: Proof + StrictDumb> StrictType for Anchor<L>

source§

const STRICT_LIB_NAME: &'static str = LIB_NAME_BPCORE

source§

fn strict_name() -> Option<TypeName>

source§

impl<L: Eq + Proof + StrictDumb> Eq for Anchor<L>

source§

impl<L: Proof + StrictDumb> StrictProduct for Anchor<L>

source§

impl<L: Proof + StrictDumb> StructuralEq for Anchor<L>

source§

impl<L: Proof + StrictDumb> StructuralPartialEq for Anchor<L>

Auto Trait Implementations§

§

impl<L> RefUnwindSafe for Anchor<L>
where L: RefUnwindSafe,

§

impl<L> Send for Anchor<L>
where L: Send,

§

impl<L> Sync for Anchor<L>
where L: Sync,

§

impl<L> Unpin for Anchor<L>
where L: Unpin,

§

impl<L> UnwindSafe for Anchor<L>
where L: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> VerifyEq for T
where T: Eq,

source§

fn verify_eq(&self, other: &T) -> bool

Verifies commit-equivalence of two instances of the same type.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,