0

So, how many sub-instructions are allowed in a transaction?

For example, I want to transfer 100 tokens to 100 different people and I wanna do it from a DAO multisig wallet - is it possible to do 100 subinstructions in an instruction?

1

2 Answers 2

3

There is a size limit on solana transactions of 1232 bytes. However many instructions you can fit in 1232 bytes would be the limit.

1
  • IIRC you can do something like this transaction.serialize().length; to calculate the size of your Tx. It can be helpful if you're debugging/trying to fix as much into a transaction w/o going over the limit.
    – AMilz
    Jan 30 at 1:11
0

The other limitation is on the number of accounts.

From the Solana docs,

An instruction contains a program id index, followed by a compact-array of account address indexes, followed by a compact-array of opaque 8-bit data. The program id index is used to identify an on-chain program that can interpret the opaque data. The program id index is an unsigned 8-bit index to an account address in the message's array of account addresses. The account address indexes are each an unsigned 8-bit index into that same array.

Since account indexes are 1 byte, you can't have more than 256 accounts in a single transaction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.