Confirmation Canister
The confirmation canister handles the creation of threshold signatures and maintains blob confirmations.
Architecture
• The Confirmation Canister generates threshold signatures and manages confirmations.
• Every batch contains 12 (adjustable) blob digests, forming an immutable Merkle Tree.
• Once the batch is complete (12 digests by default), the Merkle Root is signed, and the batch is saved as a BatchConfirmation.
• Each BatchConfirmation remains active for one week (adjustable).
Canister Types
enum ConfirmationStatus {
Pending, // Awaiting signature in the confirmation canister
Confirmed(Confirmation), // Signed, returns the confirmation for the requested digest
Invalid, // Digest not found or retired/invalid
}
struct Confirmation {
root: [u8; 32], // Merkle root hash
proof: Proof, // Merkle proof
signature: String, // Hex-encoded signature
}
struct Proof {
proof_bytes: Vec<u8>, // Merkle proof for the requested digest
leaf_index: usize, // Index of the requested digest in the Merkle tree
leaf_digest: [u8; 32], // Requested digest
}
struct BatchConfirmation {
signature: Option<String>, // Signature of the Merkle Root (if signed)
root: [u8; 32], // Merkle root hash
nodes: Vec<[u8; 32]>, // Nodes of the batch's Merkle tree (normally 12 digests)
}
// Signature Canister Configuration
struct Config {
confirmation_batch_size: usize, // Number of digests per batch
confirmation_live_time: u32, // Duration (in seconds) for which confirmations are stored (1 week recommended)
da_canisters: HashSet<Principal>,// Set of data availability (storage) canisters
owner: Principal, // Principal authorized to update the configuration
}
Canister Services
// Retrieve confirmation for a blob digest
fn get_confirmation(digest: [u8; 32]) -> ConfirmationStatus {}
// Retrieve the public key of the canister
fn public_key() -> Vec<u8> {}
// Add a new blob digest to the confirmation canister (restricted to storage canisters)
fn insert_digest(digest: [u8; 32]) {}
// Update the configuration of the signature canister
fn update_config(config: Config) {}
Candid Interfaces
type Config = record {
confirmation_live_time : nat32;
owner : principal;
da_canisters : vec principal;
confirmation_batch_size : nat64;
};
type Confirmation = record { signature : text; root : blob; proof : Proof };
type ConfirmationStatus = variant {
Invalid;
Confirmed : Confirmation;
Pending;
};
type Proof = record {
leaf_digest : blob;
leaf_index : nat64;
proof_bytes : blob;
};
service : {
get_confirmation : (blob) -> (ConfirmationStatus);
get_public_key : () -> (blob) query;
init : () -> ();
insert_digest : (blob) -> ();
public_key : () -> (blob);
update_config : (Config) -> ();
}
Last updated