Multisig, in every public/private combination
Shows: the seat (4) · the proof-carrying message (7) · pseudonym (8) · async message for strangers (9) · seed-authorized custody (13) · group-owned private PDA (18)
Goal
A vault that pays out only when k of its n members approve. The same program must work with the vault and each member public or hidden, in any mix.
The three choices
-
The vault is a PDA: its state and funds live on an account with no spending key. Only the multisig program can move the funds, by granting the PDA’s seed (pattern 13), as long as the program is immutable. For a hidden vault, the PDA is private and its keys come from a group secret (pattern 18).
-
A member is a seat. Each member has an actor of the multisig program on their own account:
(member_account, multisig). The member tells the seat to approve, and the seat tells the vault. The vault checks that the message comes from its own program and from a registered seat (patterns 4 and 7). -
Seats speak by AsyncMessage. An AsyncMessage to a public vault the transaction declares is delivered at once; one to a hidden vault is stored for a member to collect. The seat’s code is the same either way (pattern 9).
A hidden member is a seat at a blinded address. For a hidden vault, only the member who operates it writes its state.
Actors
| Actor | What it holds | Placement |
|---|---|---|
(vault, multisig) | threshold, seat list, approvals so far | public PDA, or group-owned private PDA |
(vault, native) | the funds | same account as above |
(member, multisig): a seat | which vault it belongs to | on each member’s account, public or private |
The member list holds seat addresses. A private member registers a blinded address, so the list never names their account (pattern 8).
Messages
enum Message {
/// To a seat, by its owner: approve paying `amount` to `to` out of `vault`.
Approve { vault: AccountId, to: AccountId, amount: u128 },
/// From a seat to the vault.
Approved { to: AccountId, amount: u128 },
}
There is no separate “propose” step: a payment exists once one member has approved it.
Handler
fn handle_message(input: &ReceiveInput, message: Message) -> Response {
let program = input.receiver.program_account_id;
match message {
// A member's seat: check the owner, tell the vault.
Message::Approve { vault, to, amount } => {
assert!(input.is_authorized() && input.from.is_none(), "only the member uses the seat");
Response::keep_state()
.send_async(Actor::new(vault, program), &Message::Approved { to, amount })
}
// The vault: count approvals from its registered seats.
Message::Approved { to, amount } => {
assert!(input.from_own_program(), "only seats speak to a vault");
let seat = input.from.unwrap().account_id;
let mut vault = Vault::from_bytes(&input.pre_state);
assert!(vault.seats.contains(&seat), "not a member");
let approvals = vault.approvals.entry((to, amount)).or_default(); // a set of seats
approvals.insert(seat);
if approvals.len() < vault.threshold {
return Response::set_state(vault.to_bytes());
}
// Threshold met: pay from the vault's own balance, by seed.
vault.approvals.remove(&(to, amount));
Response::set_state(vault.to_bytes()).send(native_token::custody_transfer(
input.receiver.account_id, vault.seed, to, amount))
}
}
}
The vault’s settings (seats, threshold, seed) are written once when it is created. That first write must check that the seed derives the vault’s own account, or no payout could ever be made. For a hidden vault the derivation also takes the group’s npk and vpk (AccountId::for_private_pda), so the settings store them too.
A seat is recognised by its address, so a private member’s wallet must present the address it registered with every time, reusing its blinding factor. The reference wallet does not, and cannot create a deployed program’s group PDA, so private members and a hidden vault both need a client of your own (What works with the reference wallet today).
The payout is the native token’s Transfer, which sends the credit to the recipient as an async message. So the recipient can be public or private too, with no extra code, provided it can be reached: a public recipient must be declared by the paying transaction, a public vault’s credit to a private recipient is published in the clear and needs the address’s recovery binding on chain, and a hidden vault’s credit is sealed, which needs the recipient’s keys and factor in the operating member’s wallet (Approved carries only the address).
The four placements
Public vault, public members
An ordinary multisig. Each approval is a signed public transaction: the member’s seat runs, its AsyncMessage to the declared vault is delivered at once, and the last approval pays in the same transaction.
Public vault, hidden members
The vault’s balance and pending payments are public. A hidden member approves with a private transaction: their seat runs inside the proof and its AsyncMessage crosses to the public vault, carrying the seat’s blinded address as sender.
The vault learns that seat number three approved; nobody learns who holds it. Public and hidden members can sit on the same vault.
Hidden vault, hidden members
The vault is a group-owned private PDA. Approvals are sealed AsyncMessages, stored on chain for any member holding the group secret to collect. The protocol allows several per transaction, but the reference wallet collects one non-credit message per transaction. When the collected approval is the k-th, the same transaction pays.
An observer sees sealed messages, private actions it cannot link, each transaction’s timing, its fee reserve and the alias that paid it, and that it ran the multisig program (the reference wallet always discloses the program). If the recipient is private as well, the payment publishes nothing that names the vault, its members or the recipient. A hidden vault paying a public recipient reveals the amount and the recipient, and still hides the vault.
Hidden vault, public members
This works but is the weak combination. The vault’s address needs a recovery binding on chain before the first approval (a public transaction cannot introduce one), or the approval is charged and reverted with UnboundAsyncDestination. A public seat’s AsyncMessage is stored in the clear, so each approval is a readable message from a known account to the vault’s address. The vault’s balance stays hidden; its membership and what it approves do not.
What the group secret does and does not give
Every member of a hidden vault holds the same keys for it. That lets any of them operate the vault, not spend from it. A PDA has no spending key, and the program grants the seed only when the threshold is met. This holds while the program cannot be changed: whoever can authorize a mutable program’s header account can replace its code (UpdateHeader, lee/program_loader/src/lib.rs).
So the shared secret is a liveness tool, not a trust assumption about funds.
What leaks
| Placement | Balance | Pending payments | Who approved | That a payout happened |
|---|---|---|---|---|
| public vault, public members | yes | yes | yes | yes |
| public vault, hidden members | yes | yes | pseudonyms only | yes |
| hidden vault, hidden members | no | no | no | only to a public recipient |
| hidden vault, public members | no | yes, in the approvals | yes | only to a public recipient |
Costs
A hidden vault’s payment that needs k approvals takes k private transactions from members, and, with the reference wallet, k collecting transactions by whoever operates the vault. Each is a proof.
Two members who advance the vault at the same moment both spend the same state: one transaction lands, the other fails and must be rebuilt. A hostile member can do this on purpose: the group secret cannot take funds, but it can stall the vault.
Going further
- Signatures instead of seats. Members sign the payment off chain and one message carries
ksignatures: one transaction per payment, at the price of signature checks in the handler. - Any action, not only payments. Let an approval carry
{ target, message }for the vault to send with its seed, so the vault can hold tokens, vote, or sit on another multisig. - What does not work: a hidden vault that anyone can execute. Only a key holder can run a private handler, so a hidden vault always needs one of its members to operate it.