2

I have to deploy same solana programs with differnt different program ids, how can I do it?

3 Answers 3

3

try to rename the JSON file in target/deploy. Then the deploy script should create a new keypair to deploy your program, and you should have a new program address

4
  • Is it possible to manage different programs with different program ids?
    – blackhorse
    Commented Jan 16 at 6:10
  • can you precise what you want to achieve please ? you mean different deployment of the same program with different program ids ?
    – Effe2
    Commented Jan 16 at 10:42
  • yes, I have achieved it by renaming the keypair file in target/deploy folder and store the earlier one for future modifications
    – blackhorse
    Commented Jan 16 at 10:45
  • perfect then :)
    – Effe2
    Commented Jan 16 at 10:51
2

Depending on how you deploy your program you need to do it differently.

In solana play ground for example you can click the little gear icon on the top left and there you can create a new program id.

When you deploy locally using anchor your key pair for the program will be under target/deploy/your_progam_name.json You can move that somewhere else and save it, rename it or delete it if you don't need it anymore. Then the next time you build and deploy your program will be pushed to the new address.

Don't forget to replace the assigned program id and redeploy your new programs.

You can actually also deploy the program to an address of your choice by grinding a keypair and putting it in the right spot.

Solana-keygen grind —-starts-with mega:1
1

Its very easy

Program File is *.so You can create a new keypair(easily, we can use above instruction - solana-keygen grind --starts-with ***:1) After that, move it to the folder contains program file and rename keypair file

For example, program's name is vesting.so, then rename keypair file to vesting.json

Now, all is ready to deploy. You only should run a Solana-cli instruction

solana program deploy vesting.so

At that time, program will be deployed in the address(public key) of keypair json file

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.