pub struct MultisigSignature {
pub version: u8,
pub threshold: u8,
pub subsignatures: Vec<MultisigSubsignature>,
}
Expand description
Represents an Algorand multisignature signature.
A multisignature signature is defined by a version, a threshold, and a list of participating addresses.
The version indicates the multisig protocol version, while the threshold specifies the minimum
number of signatures required to authorize a transaction.
While technically this accepts Address
types, it is expected that these will be
the addresses of Ed25519 public keys.
Fields§
§version: u8
Multisig version.
threshold: u8
Minimum number of signatures required.
subsignatures: Vec<MultisigSubsignature>
Sub-signatures
Implementations§
Source§impl MultisigSignature
impl MultisigSignature
Sourcepub fn from_participants(
version: u8,
threshold: u8,
participants: Vec<Address>,
) -> Result<Self, AlgoKitTransactError>
pub fn from_participants( version: u8, threshold: u8, participants: Vec<Address>, ) -> Result<Self, AlgoKitTransactError>
Creates a new multisignature signature with the specified version, threshold, and participants.
§Errors
Returns [InvalidMultisigSignature
] if:
version
is zero,participants
is empty,threshold
is zero or greater than the number of participants.
Sourcepub fn new(
version: u8,
threshold: u8,
subsignatures: Vec<MultisigSubsignature>,
) -> Result<Self, AlgoKitTransactError>
pub fn new( version: u8, threshold: u8, subsignatures: Vec<MultisigSubsignature>, ) -> Result<Self, AlgoKitTransactError>
Creates a new multisignature signature from a vector of subsignatures.
§Errors
Returns AlgoKitTransactError::InvalidMultisigSignature
if:
version
is zero,subsignatures
is empty,threshold
is zero or greater than the number of subsignatures.
Sourcepub fn participants(&self) -> Vec<Address>
pub fn participants(&self) -> Vec<Address>
Returns the list of participant addresses in this multisignature.
Sourcepub fn apply_subsignature(
&self,
address: Address,
subsignature: [u8; 64],
) -> Result<Self, AlgoKitTransactError>
pub fn apply_subsignature( &self, address: Address, subsignature: [u8; 64], ) -> Result<Self, AlgoKitTransactError>
Applies a subsignature for the given address, replacing all existing signatures for that address.
Typically, an address appears in a multisignature only once which means that only one signature for a given address should be in the list of subsignatures. However, there’s a construction of “weighted” multisignatures where the same address can appear multiple times. The node checks these subsignatures agnostic to the fact that the same address might be repeated. This allows a user to effectively give a weight to a particular address. For this reason, the code is structured to apply the signature to all the instances of address.
Since ed25519 signatures are deterministic, there’s only one valid signature for a given message and public key, which also means it’s OK to apply the same signature multiple times.
§Disclaimer
This method will overwrite any existing signature for the given address.
§Errors
Returns AlgoKitTransactError::InvalidMultisigSignature
if the address is not found among the participants.
Sourcepub fn merge(&self, other: &Self) -> Result<Self, AlgoKitTransactError>
pub fn merge(&self, other: &Self) -> Result<Self, AlgoKitTransactError>
Merges another multisignature into this one, replacing existing signatures with those from other
where present.
§Disclaimer
For each participant, the resulting signature will be taken from other
if present, otherwise from self
.
This operation does not combine signatures; it replaces them.
§Errors
Returns AlgoKitTransactError::InvalidMultisigSignature
if the version, threshold, or participants differ.
Trait Implementations§
Source§impl Clone for MultisigSignature
impl Clone for MultisigSignature
Source§fn clone(&self) -> MultisigSignature
fn clone(&self) -> MultisigSignature
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for MultisigSignature
impl Debug for MultisigSignature
Source§impl<'de> Deserialize<'de> for MultisigSignature
impl<'de> Deserialize<'de> for MultisigSignature
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>,
Source§impl Display for MultisigSignature
impl Display for MultisigSignature
Source§impl From<MultisigSignature> for Address
impl From<MultisigSignature> for Address
Source§fn from(multisig: MultisigSignature) -> Address
fn from(multisig: MultisigSignature) -> Address
Converts a MultisigSignature
into an Address
by hashing the domain separator,
version, threshold, and all participating addresses.