Struct snarkvm_compiler::Block
source · [−]pub struct Block<N: Network> { /* private fields */ }
Implementations
sourceimpl<N: Network> Block<N>
impl<N: Network> Block<N>
sourcepub fn new<R: Rng + CryptoRng>(
private_key: &PrivateKey<N>,
previous_hash: N::BlockHash,
header: Header<N>,
transactions: Transactions<N>,
rng: &mut R
) -> Result<Self>
pub fn new<R: Rng + CryptoRng>(
private_key: &PrivateKey<N>,
previous_hash: N::BlockHash,
header: Header<N>,
transactions: Transactions<N>,
rng: &mut R
) -> Result<Self>
Initializes a new block from a given previous hash, header, and transactions list.
sourcepub fn from(
previous_hash: N::BlockHash,
header: Header<N>,
transactions: Transactions<N>,
signature: Signature<N>
) -> Result<Self>
pub fn from(
previous_hash: N::BlockHash,
header: Header<N>,
transactions: Transactions<N>,
signature: Signature<N>
) -> Result<Self>
Initializes a new block from a given previous hash, header, and transactions list.
sourceimpl<N: Network> Block<N>
impl<N: Network> Block<N>
sourcepub const fn previous_state_root(&self) -> &Field<N>
pub const fn previous_state_root(&self) -> &Field<N>
Returns the previous state root from the block header.
sourcepub const fn transactions_root(&self) -> &Field<N>
pub const fn transactions_root(&self) -> &Field<N>
Returns the transactions root in the block header.
sourcepub const fn coinbase_target(&self) -> u64
pub const fn coinbase_target(&self) -> u64
Returns the coinbase target for this block.
sourcepub const fn proof_target(&self) -> u64
pub const fn proof_target(&self) -> u64
Returns the proof target for this block.
sourceimpl<N: Network> Block<N>
impl<N: Network> Block<N>
sourcepub const fn transactions(&self) -> &Transactions<N>
pub const fn transactions(&self) -> &Transactions<N>
Returns the transactions in this block.
sourcepub fn transaction_ids(&self) -> impl '_ + Iterator<Item = &N::TransactionID>
pub fn transaction_ids(&self) -> impl '_ + Iterator<Item = &N::TransactionID>
Returns an iterator over the transaction IDs, for all transactions in self
.
sourcepub fn deployments(&self) -> impl '_ + Iterator<Item = &Deployment<N>>
pub fn deployments(&self) -> impl '_ + Iterator<Item = &Deployment<N>>
Returns an iterator over all transactions in self
that are deployments.
sourcepub fn executions(&self) -> impl '_ + Iterator<Item = &Execution<N>>
pub fn executions(&self) -> impl '_ + Iterator<Item = &Execution<N>>
Returns an iterator over all transactions in self
that are executions.
sourcepub fn transitions(&self) -> impl '_ + Iterator<Item = &Transition<N>>
pub fn transitions(&self) -> impl '_ + Iterator<Item = &Transition<N>>
Returns an iterator over all transitions.
sourcepub fn transition_ids(&self) -> impl '_ + Iterator<Item = &N::TransitionID>
pub fn transition_ids(&self) -> impl '_ + Iterator<Item = &N::TransitionID>
Returns an iterator over the transition IDs, for all transitions.
sourcepub fn transition_public_keys(&self) -> impl '_ + Iterator<Item = &Group<N>>
pub fn transition_public_keys(&self) -> impl '_ + Iterator<Item = &Group<N>>
Returns an iterator over the transition public keys, for all transactions.
sourcepub fn origins(&self) -> impl '_ + Iterator<Item = &Origin<N>>
pub fn origins(&self) -> impl '_ + Iterator<Item = &Origin<N>>
Returns an iterator over the origins, for all transition inputs that are records.
Returns an iterator over the tags, for all transition inputs that are records.
sourcepub fn serial_numbers(&self) -> impl '_ + Iterator<Item = &Field<N>>
pub fn serial_numbers(&self) -> impl '_ + Iterator<Item = &Field<N>>
Returns an iterator over the serial numbers, for all transition inputs that are records.
sourcepub fn commitments(&self) -> impl '_ + Iterator<Item = &Field<N>>
pub fn commitments(&self) -> impl '_ + Iterator<Item = &Field<N>>
Returns an iterator over the commitments, for all transition outputs that are records.
Trait Implementations
sourceimpl<'de, N: Network> Deserialize<'de> for Block<N>
impl<'de, N: Network> Deserialize<'de> for Block<N>
sourcefn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the block from a JSON-string or buffer.
sourceimpl<N: PartialEq + Network> PartialEq<Block<N>> for Block<N> where
N::BlockHash: PartialEq,
N::BlockHash: PartialEq,
impl<N: PartialEq + Network> PartialEq<Block<N>> for Block<N> where
N::BlockHash: PartialEq,
N::BlockHash: PartialEq,
impl<N: Eq + Network> Eq for Block<N> where
N::BlockHash: Eq,
N::BlockHash: Eq,
impl<N: Network> StructuralEq for Block<N>
impl<N: Network> StructuralPartialEq for Block<N>
Auto Trait Implementations
impl<N> RefUnwindSafe for Block<N> where
N: RefUnwindSafe,
<N as Network>::BlockHash: RefUnwindSafe,
<N as Environment>::Field: RefUnwindSafe,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: RefUnwindSafe,
<<N as Environment>::PairingCurve as PairingEngine>::G2Affine: RefUnwindSafe,
<<<N as Environment>::PairingCurve as PairingEngine>::G2Affine as PairingCurve>::Prepared: RefUnwindSafe,
<N as Environment>::Projective: RefUnwindSafe,
<N as Environment>::Scalar: RefUnwindSafe,
<N as Network>::StateRoot: RefUnwindSafe,
<N as Network>::TransactionID: RefUnwindSafe,
<N as Network>::TransitionID: RefUnwindSafe,
impl<N> Send for Block<N>
impl<N> Sync for Block<N>
impl<N> Unpin for Block<N> where
N: Unpin,
<N as Network>::BlockHash: Unpin,
<N as Environment>::Field: Unpin,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: Unpin,
<<N as Environment>::PairingCurve as PairingEngine>::G2Affine: Unpin,
<<<N as Environment>::PairingCurve as PairingEngine>::G2Affine as PairingCurve>::Prepared: Unpin,
<N as Environment>::Projective: Unpin,
<N as Environment>::Scalar: Unpin,
<N as Network>::StateRoot: Unpin,
<N as Network>::TransactionID: Unpin,
<N as Network>::TransitionID: Unpin,
impl<N> UnwindSafe for Block<N> where
N: UnwindSafe,
<N as Network>::BlockHash: UnwindSafe,
<N as Environment>::Field: UnwindSafe,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: UnwindSafe,
<<N as Environment>::PairingCurve as PairingEngine>::G2Affine: UnwindSafe,
<<<N as Environment>::PairingCurve as PairingEngine>::G2Affine as PairingCurve>::Prepared: UnwindSafe,
<N as Environment>::Projective: UnwindSafe,
<N as Environment>::Scalar: UnwindSafe,
<N as Network>::StateRoot: UnwindSafe,
<N as Network>::TransactionID: UnwindSafe,
<N as Network>::TransitionID: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more