# Create Multisig

{% hint style="warning" %}
Be sure to use `multisigCreateV2`, rather than the deprecated `multisigCreate`
{% endhint %}

This instruction will create a Multisig account with the necessary fields. This instruction requires that both the `creator` of the multisig, and the `createKey` be signers.

## Example

<pre class="language-typescript"><code class="lang-typescript">import * as multisig from "@sqds/multisig";
import { Connection, Keypair } from "@solana/web3.js";

// Defines permissions enum
const { Permission, Permissions } = multisig.types;

async function main() {
<strong>    // Cluster Connection
</strong><strong>    // Required argument if you use the .rpc method
</strong>    const connection = new Connection("&#x3C; your rpc here >");
    
    // Random Public Key that will be used to derive a multisig PDA
    // This will need to be a signer on the transaction
    const createKey = Keypair.generate().publicKey;
    
    // Creator should be a Keypair or a Wallet Adapter wallet
    const creator = Keypair.generate();
    
    // Derive the multisig PDA
    const [multisigPda] = multisig.getMultisigPda({
        createKey,
    });
    
    const programConfigPda = multisig.getProgramConfigPda({})[0];

    const programConfig =
        await multisig.accounts.ProgramConfig.fromAccountAddress(
          connection,
          programConfigPda
        );

    const configTreasury = programConfig.treasury;
    
    const ix = await multisig.instructions.multisigCreateV2({
        // Must sign the transaction, unless the .rpc method is used.
        createKey: createKey.publicKey,
        // The creator &#x26; fee payer
        creator: creator.publicKey,
        // The PDA of the multisig you are creating, derived by a random PublicKey
        multisigPda,
        // Here the config authority will be the system program
        configAuthority: null,
        // Create without any time-lock
        timeLock: 0,
        // List of the members to add to the multisig
        members: [{
                // Members Public Key
                key: creator.publicKey,
                // Granted Proposer, Voter, and Executor permissions
                permissions: Permissions.all(),
            },
            {
                key: secondMember.publicKey,
                // Member can only add votes to proposed transactions
                permissions: Permissions.fromPermissions([Permission.Vote]),
            },
        ],
        // This means that there needs to be 2 votes for a transaction proposal to be approved
        threshold: 2,
        // This is for the program config treasury account
        treasury: configTreasury,
        // Rent reclaim account
        rentCollector: null
    });
    
    console.log("Multisig created: ", signature)
}
</code></pre>

### Notes

* Must specify permissions upfront for each member
* Only specify a `configAuthority` if you want one admin key to be able to override all config
* `createKey` must be a signer if using methods other than `.rpc`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.squads.so/main/development/typescript/instructions/create-multisig.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
