0

Can a Solana program invoke another on-chain program via CPI with more than 35 accounts addresses?

1 Answer 1

0

No. Currently the limit of a single transaction is 1232 bytes. One address is 32 bytes, which means 35 accounts is 1120 bytes. You also require some bytes for instruction data, program data reaching the limit quite fast. Depending on the complexity of the instruction the hard cap is around 35 - 37 accounts at this moment.

CPI requires all addresses to be part of the transaction. Therefore its nearly impossible to have more than 35 accounts in one tx.

There is an architectural proposal made to solve this issue, for more info see here: https://docs.solana.com/proposals/transactions-v2

2
  • "CPI requires all addresses to be part of the transaction". Does that include read-only accounts as well or I can get them from a data-account when the transaction is being executed? Those read-only accounts are those that are needed for the CPI.
    – Mwkan
    Sep 28, 2022 at 10:32
  • Yes, it doesnt matter if you need to write or only read data from accounts. Any account which you interact with needs to be added to the TX.
    – Omega
    Sep 28, 2022 at 14:06

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.