1

Can the Solana Program ID be the same as the provider wallet?

For example, in the Anchor.toml file, can

[programs.localnet]
my_program_name = "address_defined_in_declare_id_macro_of_librs_file"

and the public key of the wallet

[provider]
cluster = "Devnet"
wallet = "/Users/johndoe/my-program-name/target/deploy/my_program_name-keypair.json"

be the same?

I have seen someone mention in the Anchor discord server that they can, but when I had them as the same I ran into deploy errors and was only able to deploy after I change the wallet provider in the Anchor.toml file. When I did have them as the same, I would fund the wallet by running the solana airdrop AMOUNT WALLET_ADDRESS command, and when I would run anchor deploy I would get this error:

Error: Account address_defined_in_declare_id_macro_of_librs_file is not an upgradeable program or already in use
There was a problem deploying: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "" }.

And I am almost certain that was due to the fact that the Account had SOL funds in it.

1 Answer 1

2

Not sure what was discussed in the discord, but I assume that is not possible. If I understand you correctly you mean the address in the librs and the provider wallet. The program name can be what ever you want afaik.

Usually when you build and deploy an anchor program it creates a new keypair in the target folder. That will be address that your program will be deployed to. The deployment of the program will be done by the provider wallet. It sends all the programs data transaction by transaction into a buffer account and then into the executable data account of your program. If that wallet has already sol in it it cant become the program and if you already deployed the program it will not be able to pay for transaction fees anymore, because it wont be owned by the system program anymore but instead by the BPF Upgradeable Loader program. So I would say they can not be the same.

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.