Squads Docs
Squads Legacy (v3)
Squads Legacy (v3)
  • Getting Started
    • What's a Squad?
    • Create a Squad
  • Navigating Your Squad
    • Dashboard
    • Vault
    • Transactions
    • Developers
      • Programs
      • Token Manager
      • Validators
      • TX Builder
    • Creators
    • Apps
    • Owners and Settings
  • Integrations
    • Staking
      • Stakewiz
      • JitoSOL
      • Lido
      • Marinade
      • SolBlaze
    • Swap
    • Tensor
    • Dialect
    • Bonfida
    • Coinflow
  • Frequently Asked Questions
    • General
    • Costs of using Squads
  • Development
    • PDAs
      • Multisig
      • Transaction
      • Instruction
      • Derivation
    • Authorities
    • Anchor IDL
      • Loading the Program
      • Create a Multisig
      • Transactions
        • Create a Transaction
        • Adding Instructions
        • Activating a Transaction
        • Approve / Reject a Transaction
        • Executing
    • SDK
Powered by GitBook
On this page
  1. Development
  2. Anchor IDL

Create a Multisig

PreviousLoading the ProgramNextTransactions

To create a multisig, first derive the address. The address is technically a , and can be derived based off of the createKey. The createKey can be any public key (wallet, random, etc.), as long as its supplied as a type.

Additionally, the create method will need an approval threshold and a list of keys to act as the members of the multisig (signers).

For example, to create a multisig based on a user's wallet address or a random key:

 // using a wallet to seed the multisig & address
 const createKey = wallet.publicKey;
 // or
 const createKey = anchor.web3.Keypair.generate().publicKey;
 
 // list of members/keys
 const membersList = [wallet.publicKey, otherKey1, otherKey2];
 // threshold
 const threshold = 2;
 
 // the multisig pda
 const multisig = await anchor.web3.PublicKey.findProgramAddress(
    anchor.utils.bytes.utf8.encode("squad"),
    createKey.toBuffer(),
    anchor.utils.bytes.utf8.encode("multisig")
 );
 
 // adjust to fit your Anchor provider or if using React useAnchorWallet() hook
 const creator = wallet.publicKey;
 
 // this will create a multisig with a threshold of 2/3, with three members
 await squadsProgram.methods.create(threshold, createKey, memberList)
          .accounts({
             multisig,
             creator,
           })
           .rpc();

Read the for more information about the multisig PDA.

PDA
PublicKey
section on PDAs