8

I'm currently learning Solana development with rust. I followed the hello-world tutorial and was wondering what are the differences between running solana deploy and solana program deploy.

I tested both using Solana Devnet cluster.

Result of running solana deploy.

Result of running solana program deploy.

My intuition tells me solana deploy is creating a simple Solana Account, while the other is creating a Program Account. What's the point of creating a simple Solana Account using a program if it is not possible to call a transaction on it?

3 Answers 3

18

They both work to deploy programs, but solana program deploy is typically the recommended route.

solana deploy is the older form and uses BPF Loader 2 to deploy the program. Programs deployed in this way are forever immutable. The SPL Token program uses this loader: https://explorer.solana.com/address/TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA

solana program deploy is the newer form, and uses the Upgradeable BPF Loader to deploy the program. Programs using this loader have the option of being upgraded if an upgrade authority is set. Otherwise, they can also be immutable if deployed using the --final flag, same as the old solana deploy. The SPL Stake Pool program uses this loader: https://explorer.solana.com/address/SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy

2
  • Thanks, that makes sense! To the client user, are both methods the same? In other words, can a Js API client program interact with both programs in the same way? Commented Nov 12, 2021 at 10:02
  • Yep, they look exactly the same from the outside if you're sending transactions to the program.
    – Jon C
    Commented Nov 12, 2021 at 13:49
2

I am not sure about what the exact difference but I can say that solana deploy doesn't create a simple Solana Account. Because you could see that the executable field of your account which is deployed by solana deploy is Yes and Assigned Program Id field is BPF Loader 2. BPF Loader can be considered as a compiler of other programming languages, and accounts which are not program accounts don't have BPF Loader assignment. I will investigate about the exact difference as well.

1
  • Thanks! I’ll continue my investigation as well. Any update I’ll post it here Commented Nov 9, 2021 at 13:35
1

solana deploy uses old BPF loader namely BPFLoader2111111111111111111111111111111111. It does not allow updating the deployed program. It would allow multiple deployments of the same program as long as program addresses are different(supplied or randomly generated).

solana program deploy allows for multiple deployments of same(or some other program) to same address so long as --final flag is not supplied. It uses the BPFLoaderUpgradeab1e11111111111111111111111 loader.

Also, solana deploy stores the program binary with the account identified by the program id whereas solana program deploy uses a separate account to store the binary content of the program.

In case of solana program deploy both the program account and program data account are owned by the BPF loader(BPFLoaderUpgradeab1e11111111111111111111111).

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