Struct sp_consensus_babe::Transcript
source · [−]pub struct Transcript { /* private fields */ }
Expand description
A transcript of a public-coin argument.
The prover’s messages are added to the transcript using
append_message
, and the verifier’s
challenges can be computed using
challenge_bytes
.
Creating and using a Merlin transcript
To create a Merlin transcript, use Transcript::new()
. This
function takes a domain separation label which should be unique to
the application.
To use the transcript with a Merlin-based proof implementation,
the prover’s side creates a Merlin transcript with an
application-specific domain separation label, and passes a &mut
reference to the transcript to the proving function(s).
To verify the resulting proof, the verifier creates their own
Merlin transcript using the same domain separation label, then
passes a &mut
reference to the verifier’s transcript to the
verification function.
Implementing proofs using Merlin
For information on the design of Merlin and how to use it to implement a proof system, see the documentation at merlin.cool, particularly the Using Merlin section.
Implementations
sourceimpl Transcript
impl Transcript
sourcepub fn new(label: &'static [u8]) -> Transcript
pub fn new(label: &'static [u8]) -> Transcript
Initialize a new transcript with the supplied label
, which
is used as a domain separator.
Note
This function should be called by a proof library’s API consumer (i.e., the application using the proof library), and not by the proof implementation. See the Passing Transcripts section of the Merlin website for more details on why.
sourcepub fn append_message(&mut self, label: &'static [u8], message: &[u8])
pub fn append_message(&mut self, label: &'static [u8], message: &[u8])
Append a prover’s message
to the transcript.
The label
parameter is metadata about the message, and is
also appended to the transcript. See the Transcript
Protocols section of
the Merlin website for details on labels.
sourcepub fn commit_bytes(&mut self, label: &'static [u8], message: &[u8])
👎 Deprecated since 1.1.0: renamed to append_message for clarity.
pub fn commit_bytes(&mut self, label: &'static [u8], message: &[u8])
renamed to append_message for clarity.
Deprecated. This function was renamed to
append_message
.
This is intended to avoid any possible confusion between the transcript-level messages and protocol-level commitments.
sourcepub fn append_u64(&mut self, label: &'static [u8], x: u64)
pub fn append_u64(&mut self, label: &'static [u8], x: u64)
Convenience method for appending a u64
to the transcript.
The label
parameter is metadata about the message, and is
also appended to the transcript. See the Transcript
Protocols section of
the Merlin website for details on labels.
Implementation
Calls append_message
with the 8-byte little-endian encoding
of x
.
sourcepub fn commit_u64(&mut self, label: &'static [u8], x: u64)
👎 Deprecated since 1.1.0: renamed to append_u64 for clarity.
pub fn commit_u64(&mut self, label: &'static [u8], x: u64)
renamed to append_u64 for clarity.
Deprecated. This function was renamed to
append_u64
.
This is intended to avoid any possible confusion between the transcript-level messages and protocol-level commitments.
sourcepub fn challenge_bytes(&mut self, label: &'static [u8], dest: &mut [u8])
pub fn challenge_bytes(&mut self, label: &'static [u8], dest: &mut [u8])
Fill the supplied buffer with the verifier’s challenge bytes.
The label
parameter is metadata about the challenge, and is
also appended to the transcript. See the Transcript
Protocols section of
the Merlin website for details on labels.
sourcepub fn build_rng(&self) -> TranscriptRngBuilder
pub fn build_rng(&self) -> TranscriptRngBuilder
Fork the current Transcript
to construct an RNG whose output is bound
to the current transcript state as well as prover’s secrets.
See the TranscriptRngBuilder
documentation for more details.
Trait Implementations
sourceimpl Clone for Transcript
impl Clone for Transcript
sourcepub fn clone(&self) -> Transcript
pub fn clone(&self) -> Transcript
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl SigningTranscript for Transcript
impl SigningTranscript for Transcript
We delegate SigningTranscript
methods to the corresponding
inherent methods of merlin::Transcript
and implement two
witness methods to avoid abrtasting the merlin::TranscriptRng
machenry.
sourcepub fn commit_bytes(&mut self, label: &'static [u8], bytes: &[u8])
pub fn commit_bytes(&mut self, label: &'static [u8], bytes: &[u8])
Extend transcript with some bytes, shadowed by merlin::Transcript
.
sourcepub fn challenge_bytes(&mut self, label: &'static [u8], dest: &mut [u8])
pub fn challenge_bytes(&mut self, label: &'static [u8], dest: &mut [u8])
Produce some challenge bytes, shadowed by merlin::Transcript
.
sourcepub fn witness_bytes_rng<R>(
&self,
label: &'static [u8],
dest: &mut [u8],
nonce_seeds: &[&[u8]],
rng: R
) where
R: RngCore + CryptoRng,
pub fn witness_bytes_rng<R>(
&self,
label: &'static [u8],
dest: &mut [u8],
nonce_seeds: &[&[u8]],
rng: R
) where
R: RngCore + CryptoRng,
Produce secret witness bytes from the protocol transcript and any “nonce seeds” kept with the secret keys. Read more
sourcefn proto_name(&mut self, label: &'static [u8])
fn proto_name(&mut self, label: &'static [u8])
Extend transcript with a protocol name
sourcefn commit_point(
&mut self,
label: &'static [u8],
compressed: &CompressedRistretto
)
fn commit_point(
&mut self,
label: &'static [u8],
compressed: &CompressedRistretto
)
Extend the transcript with a compressed Ristretto point
sourcefn challenge_scalar(&mut self, label: &'static [u8]) -> Scalar
fn challenge_scalar(&mut self, label: &'static [u8]) -> Scalar
Produce the public challenge scalar e
.
Auto Trait Implementations
impl RefUnwindSafe for Transcript
impl Send for Transcript
impl Sync for Transcript
impl Unpin for Transcript
impl UnwindSafe for Transcript
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedConversion for T
impl<T> CheckedConversion for T
sourcefn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
Convert from a value of T
into an equivalent instance of Option<Self>
. Read more
sourcefn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
Consume self to return Some
equivalent value of Option<T>
. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
sourceimpl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
sourcefn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Convert from a value of T
into an equivalent instance of Self
. Read more
sourcefn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of T
. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
sourcepub fn unchecked_into(self) -> T
pub fn unchecked_into(self) -> T
The counterpart to unchecked_from
.
sourceimpl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
sourcepub fn unique_saturated_into(self) -> T
pub fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of T
.
sourceimpl<T> VRFSigningTranscript for T where
T: SigningTranscript,
impl<T> VRFSigningTranscript for T where
T: SigningTranscript,
type T = T
type T = T
Real underlying SigningTranscript
sourcepub fn transcript_with_malleability_addressed(self, publickey: &PublicKey) -> T
pub fn transcript_with_malleability_addressed(self, publickey: &PublicKey) -> T
Return the underlying SigningTranscript
after addressing
VRF output malleability, usually by making it non-malleable, Read more
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