If I have an anchor program, how can I find out how much SOL it will cost me to deploy it? Afaik the raw binary size isn't accurate, as some padding is also added.
1 Answer
It'll depend on the version of the tools used. In 1.18, with https://github.com/solana-labs/solana/pull/34730, there won't be any padding included, so you can just calculate based on the size of the binary.
You'll need to pay for:
- the program account, which is 36 bytes
- the program data account, 45 bytes + the size of the program
So you'll need to add up solana rent 36
with solana rent <45+program size>
-
2Thank you! Small note for future readers: The reason Jon didn't just write
solana rent <36 + 45 + program size>
is because the36
and45 + program size
is because these two accounts are separate, meaning we need to add the rent-exempt minimum on top twice, once for each (which would only be added once if we didsolana rent <36 + 45 + program size>
)– McBainCommented Jun 11 at 19:10