# Create Vault Transaction

Vault Transactions allow you to take actions from programs all across Solana, and execute them inside of your multisig.&#x20;

To create one, you need the latest transaction index from your multisig account, a message with the instructions you want to execute, and the index of the vault you'd like to execute from. Additionally, you can also add `n` number of ephemeral signers, in case that extra signatures are required.&#x20;

## Example

```typescript
import * as multisig from "@sqds/multisig";
import { PublicKey, Connection, SystemProgram, TransactionMessage } from "@solana/web3.js";

async function main(member: PublicKey) {
    // Cluster Connection
    const connection = new Connection("<your rpc url>");
    
    // If you've saved your createKey, you can define it as a static PublicKey
    const createKey = new PublicKey("<your createkey>")
    
    // Derive the multisig PDA
    const [multisigPda] = multisig.getMultisigPda({
        createKey,
    });
    // or
    // const multisigPda = new PublicKey("<your multisig key>");
    
    // Derive the PDA of the Squads Vault
    const [vaultPda] = multisig.getVaultPda({
        multisigPda,
        index: 0,
    });
    
    // Get deserialized multisig account info
    const multisigInfo = await multisig.accounts.Multisig.fromAccountAddress(
      connection,
      multisigPda
    );

    // Get the updated transaction index
    const currentTransactionIndex = Number(multisigInfo.transactionIndex);
    const newTransactionIndex = BigInt(currentTransactionIndex + 1);
    
    const to = new PublicKey("<>");
    
    const transferInstruction = SystemProgram.transfer({
        // The transfer is being signed by the vault that's executing
        fromPubkey: vaultPda,
        toPubkey: to,
        lamports: 1 * LAMPORTS_PER_SOL
    });
    
    // Build a message with instructions we want to execute
    const testTransferMessage = new TransactionMessage({
        payerKey: vaultPda,
        recentBlockhash: (await connection.getLatestBlockhash()).blockhash,
        instructions: [transferInstruction],
    });
    
    const ix = await multisig.instructions.vaultTransactionCreate({
        multisigPda,
        transactionIndex,
        creator: member,
        vaultIndex: 0,
        ephemeralSigners: 0,
        transactionMessage: testTransferMessage,
        memo: "Our first transfer!"
    });
}
```

### Notes

* Vault transactions are built with a TransactionMessage containing the instructions you want to execute
* Proposal accounts must be created to successfully vote and execute vault transactions
* For more information, see the [Vault Transaction](/main/development/typescript/accounts/transactions.md#vault-transactions) section and [reference](/main/development/reference/accounts.md#vault-transaction).


---

# 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-vault-transaction.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.
