'Difference bewteen `solana deploy` and `solana program deploy`
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?
Solution 1:[1]
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
Solution 2:[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.
Solution 3:[3]
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).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jon C |
| Solution 2 | rainbowemoji |
| Solution 3 | R Buragohain |
