Skip to main content

RingtailConsensus

Struct RingtailConsensus 

Source
pub struct RingtailConsensus { /* private fields */ }
Expand description

Ringtail-compatible consensus for ZAP agents

Implements threshold lattice-based signing with the following protocol:

  1. Setup: Trusted dealer generates secret shares and MAC keys
  2. Round 1: Each party generates commitment D_i and MACs
  3. Round 2: Verify MACs, compute response share z_i
  4. Finalize: Combiner aggregates into signature (c, z, Delta)

Implementations§

Source§

impl RingtailConsensus

Source

pub fn new(party_id: usize, parties: usize, threshold: usize) -> Self

Create a new Ringtail consensus party

Source

pub fn party_id(&self) -> usize

Get party ID

Source

pub fn parties(&self) -> usize

Get total parties

Source

pub fn threshold(&self) -> usize

Get threshold

Source

pub fn has_quorum(&self) -> bool

Check if connected to minimum peers for signing

Source

pub fn set_sk_share(&mut self, sk_share: PolyVector)

Set secret key share from trusted dealer

Source

pub fn set_mac_keys(&mut self, keys: HashMap<usize, [u8; 32]>)

Set MAC keys for peer authentication

Source

pub fn set_seeds(&mut self, seeds: HashMap<usize, Vec<[u8; 32]>>)

Set PRF seeds

Source

pub fn set_public_params(&mut self, a: PolyMatrix, b: PolyVector)

Set public parameters

Source

pub fn set_lambda(&mut self, lambda: Poly)

Set Lagrange coefficient

Source

pub async fn connect_peers(&mut self, addresses: Vec<String>) -> Result<()>

Connect to peer network

Source

pub async fn disconnect(&mut self)

Disconnect from peers

Source

pub async fn sign_round1(&mut self, message: &[u8]) -> Result<Round1Output>

Sign Round 1 - Generate commitment matrix D and MACs

Computes D_i = A * R_i + E_i where R_i, E_i are Gaussian-sampled

Source

pub async fn sign_round2( &self, round1_outputs: Vec<Round1Output>, ) -> Result<Round2Output>

Sign Round 2 - Verify MACs, compute response share

Verifies all received MACs and computes z_i = R_i * u + s_i * c * lambda_i - mask

Source

pub async fn finalize( &self, round2_outputs: Vec<Round2Output>, ) -> Result<RingtailSignature>

Finalize - Combine shares into final signature (combiner only)

Aggregates all z_i shares and computes Delta correction

Source

pub fn verify( message: &[u8], signature: &RingtailSignature, public_key: &[u8], ) -> bool

Verify a Ringtail signature

Checks: c = LowNormHash(A, b, h) where h = Az - bc + Delta

Auto Trait Implementations§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more