pub struct Entry {
pub num_hashes: u64,
pub hash: Hash,
pub transactions: Vec<VersionedTransaction>,
}
Expand description
Each Entry contains three pieces of data. The num_hashes
field is the number
of hashes performed since the previous entry. The hash
field is the result
of hashing hash
from the previous entry num_hashes
times. The transactions
field points to Transactions that took place shortly before hash
was generated.
If you multiply num_hashes
by the amount of time it takes to generate a new hash, you
get a duration estimate since the last Entry. Since processing power increases
over time, one should expect the duration num_hashes
represents to decrease proportionally.
An upper bound on Duration can be estimated by assuming each hash was generated by the
world’s fastest processor at the time the entry was recorded. Or said another way, it
is physically not possible for a shorter duration to have occurred if one assumes the
hash was computed by the world’s fastest processor at that time. The hash chain is both
a Verifiable Delay Function (VDF) and a Proof of Work (not to be confused with Proof of
Work consensus!)
Fields§
§num_hashes: u64
The number of hashes since the previous Entry ID.
hash: Hash
The SHA-256 hash num_hashes
after the previous Entry ID.
transactions: Vec<VersionedTransaction>
An unordered list of transactions that were observed before the Entry ID was generated. They may have been observed before a previous Entry ID but were pushed back into this list to ensure deterministic interpretation of the ledger.
Implementations§
Source§impl Entry
impl Entry
Sourcepub fn new(
prev_hash: &Hash,
num_hashes: u64,
transactions: Vec<Transaction>,
) -> Self
pub fn new( prev_hash: &Hash, num_hashes: u64, transactions: Vec<Transaction>, ) -> Self
Creates the next Entry num_hashes
after start_hash
.
pub fn new_mut( start_hash: &mut Hash, num_hashes: &mut u64, transactions: Vec<Transaction>, ) -> Self
Sourcepub fn verify(&self, start_hash: &Hash) -> bool
pub fn verify(&self, start_hash: &Hash) -> bool
Verifies self.hash is the result of hashing a start_hash
self.num_hashes
times.
If the transaction is not a Tick, then hash that as well.
pub fn is_tick(&self) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Entry
impl<'de> Deserialize<'de> for Entry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Entry
impl StructuralPartialEq for Entry
Auto Trait Implementations§
impl Freeze for Entry
impl RefUnwindSafe for Entry
impl Send for Entry
impl Sync for Entry
impl Unpin for Entry
impl UnwindSafe for Entry
Blanket Implementations§
Source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, _digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
Source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more