I want to test my solana program on mainnet. I know that on devnet the deployment costs 5 SOL.
So I was wondering whether I could close the program account and get some of the deployment funds back?
Yes, it is possible to close down a program. It probably has to be marked as upgradeable
and only the upgrade_authority
can close the program and recover the rent.
If the program is upgradeable, you can do:
solana program close <PROGRAM_ID>
Which will give:
Closed Program Id <PROGRAM_ID>, 5.21619288 SOL reclaimed