[−][src]Trait snarkvm_models::objects::ledger::LedgerScheme
Associated Types
type Block: BlockScheme[src]
type Commitment[src]
type MerkleParameters[src]
type MerklePath[src]
type MerkleTreeDigest[src]
type SerialNumber[src]
type Transaction: Transaction[src]
Required methods
pub fn new(
path: &PathBuf,
parameters: Self::MerkleParameters,
genesis_block: Self::Block
) -> Result<Self>[src]
path: &PathBuf,
parameters: Self::MerkleParameters,
genesis_block: Self::Block
) -> Result<Self>
Instantiates a new ledger with a genesis block.
pub fn len(&self) -> usize[src]
Returns the number of blocks including the genesis block
pub fn parameters(&self) -> &Self::MerkleParameters[src]
Return the parameters used to construct the ledger Merkle tree.
pub fn digest(&self) -> Option<Self::MerkleTreeDigest>[src]
Return a digest of the latest ledger Merkle tree.
pub fn validate_digest(&self, digest: &Self::MerkleTreeDigest) -> bool[src]
Check that st_{ts} is a valid digest for some (past) ledger state.
pub fn contains_cm(&self, cm: &Self::Commitment) -> bool[src]
Returns true if the given commitment exists in the ledger.
pub fn contains_sn(&self, sn: &Self::SerialNumber) -> bool[src]
Returns true if the given serial number exists in the ledger.
pub fn contains_memo(
&self,
memo: &<Self::Transaction as Transaction>::Memorandum
) -> bool[src]
&self,
memo: &<Self::Transaction as Transaction>::Memorandum
) -> bool
Returns true if the given memorandum exists in the ledger.
pub fn prove_cm(&self, cm: &Self::Commitment) -> Result<Self::MerklePath>[src]
Returns the Merkle path to the latest ledger digest for a given commitment, if it exists in the ledger.
pub fn verify_cm(
parameters: &Self::MerkleParameters,
digest: &Self::MerkleTreeDigest,
cm: &Self::Commitment,
witness: &Self::MerklePath
) -> bool[src]
parameters: &Self::MerkleParameters,
digest: &Self::MerkleTreeDigest,
cm: &Self::Commitment,
witness: &Self::MerklePath
) -> bool
Returns true if the given Merkle path is a valid witness for the given ledger digest and commitment.