Force a program to have a new program ID

149 views Asked by At

I've been following this solana program tutorial https://moralis.io/solana-smart-contract-building/ and created a basic Hello World program.

I was wondering how can I force the program to have a new program ID after re-deploying?

I assume I can do it by starting the tutorial again from the start and creating a new cargo project with cargo init, but I want to know how to force the program ID to change in the current project.

For context, I don't want to update the program ID, I'm just interested in understanding how the program ID is created and how it can change.

2

There are 2 answers

0
Jon C On

If you want to change the program id, you can simply specify the exact program id keypair that you want to use during deployment, by running:

$ solana program deploy <PROGRAM.SO> --program-id <PROGRAM_ID_KEYPAIR>

To generate a new keypair, you can use:

$ solana-keygen new -o new-program-keypair.json
0
Berkay ÖZTUNÇ On

its base on a keypair. you can find under the ./target/deploy/ if you want to change new id you need to use cli command.

Or basit start you can try the https://beta.solpg.io it easy way to start building. And there is a button for that :D