Various account types in Squads V4, and how to derive them.
This section outlines the different account types you will encounter when interacting with Squads v4, including seeds and the struct associated with the account type. The program for all derivations in this section is the Squads v4 program ID.
Multisig
The multisig account is the main config for your Squad. This will contain your threshold, members, config authority, and handle any time-locks.
PDA Derivation
A multisig account is derived with the following seeds:
["multisig", "multisig", createKey]
The createKey is a unique Public Key, made specifically to derive the Multisig PDA.
Multisig Account Content
#[account]pubstructMultisig {/// Key that is used to seed the multisig PDA.pub create_key:Pubkey,/// The authority that can change the multisig config./// This is a very important parameter as this authority can change the members and threshold.////// The convention is to set this to `Pubkey::default()`./// In this case, the multisig becomes autonomous, so every config change goes through/// the normal process of voting by the members.////// However, if this parameter is set to any other key, all the config changes for this multisig/// will need to be signed by the `config_authority`. We call such a multisig a "controlled multisig".pub config_authority:Pubkey,/// Threshold for signatures.pub threshold:u16,/// How many seconds must pass between transaction voting settlement and execution.pub time_lock:u32,/// Last transaction index. 0 means no transactions have been created.pub transaction_index:u64,/// Last stale transaction index. All transactions up until this index are stale./// This index is updated when multisig config (members/threshold/time_lock) changes.pub stale_transaction_index:u64,/// Reserved for future use.pub _reserved:u8,/// Bump for the multisig PDA seed.pub bump:u8,/// Members of the multisig.pub members:Vec<Member>,}
Proposal
The proposal account tracks votes cast by members pertaining to a given transaction. It stores the status of the given transaction, allowing it to be executed once the multisig threshold has been met.
PDA Derivation
A proposal account is derived with the following seeds:
The transaction index is a number auto incrementing based on your Multisig's total transactions.
Proposal Account Content
#[account]pubstructProposal {/// The multisig this belongs to.pub multisig:Pubkey,/// Index of the multisig transaction this proposal is associated with.pub transaction_index:u64,/// The status of the transaction.pub status:ProposalStatus,/// PDA bump.pub bump:u8,/// Keys that have approved/signed.pub approved:Vec<Pubkey>,/// Keys that have rejected.pub rejected:Vec<Pubkey>,/// Keys that have cancelled (Approved only).pub cancelled:Vec<Pubkey>,}
Vault Transaction
The vault transaction account stores a transaction message that is subsequently voted on via a proposal.
PDA Derivation
A vault transaction account is derived with the following seeds:
The transaction index is a number auto incrementing based on your Multisig's total transactions.
Vault Transaction Account Content
#[account]pubstructVaultTransaction {/// The multisig this belongs to.pub multisig:Pubkey,/// Member of the Multisig who submitted the transaction.pub creator:Pubkey,/// Index of this transaction within the multisig.pub index:u64,/// bump for the transaction seeds.pub bump:u8,/// Index of the vault this transaction belongs to.pub vault_index:u8,/// Derivation bump of the vault PDA this transaction belongs to.pub vault_bump:u8,/// Derivation bumps for additional signers./// Some transactions require multiple signers. Often these additional signers are "ephemeral" keypairs/// that are generated on the client with a sole purpose of signing the transaction and be discarded immediately after./// When wrapping such transactions into multisig ones, we replace these "ephemeral" signing keypairs/// with PDAs derived from the MultisigTransaction's `transaction_index` and controlled by the Multisig Program;/// during execution the program includes the seeds of these PDAs into the `invoke_signed` calls,/// thus "signing" on behalf of these PDAs. pub ephemeral_signer_bumps:Vec<u8>,/// data required for executing the transaction.pub message:VaultTransactionMessage,}
Batch
The batch account stores a collection of vault transactions, allowing them to be subsequently voted on, and executed with minimal actions.
PDA Derivation
A batch account is derived with the following seeds:
#[account]#[derive(InitSpace)]pubstructBatch {/// The multisig this belongs to.pub multisig:Pubkey,/// Member of the Multisig who submitted the batch.pub creator:Pubkey,/// Index of this batch within the multisig transactions.pub index:u64,/// PDA bump.pub bump:u8,/// Index of the vault this batch belongs to.pub vault_index:u8,/// Derivation bump of the vault PDA this batch belongs to.pub vault_bump:u8,/// Number of transactions in the batch.pub size:u32,/// Index of the last executed transaction within the batch./// 0 means that no transactions have been executed yet.pub executed_transaction_index:u32,}
Config Transaction
The config transaction account is similar to a vault transaction, but deals directly with configuration parameters in your multisig account. These are used in cases where there is no set config authority.
PDA Derivation
A config transaction account is derived with the following seeds:
#[account]pubstructConfigTransaction {/// The multisig this belongs to.pub multisig:Pubkey,/// Member of the Multisig who submitted the transaction.pub creator:Pubkey,/// Index of this transaction within the multisig.pub index:u64,/// bump for the transaction seeds.pub bump:u8,/// Action to be performed on the multisig.pub actions:Vec<ConfigAction>,}