If I have an Anchor IDL json, is it possible to generate an Anchor program (Rust) script with it?

1 Answer 1


To put it simply, no. You'll also need to clone the program executable from the chain. For example, if the program address is ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL, you'll need to do:

$ solana program dump ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL program.so
Wrote program to atoken.so
$ solana program deploy program.so
Program Id: PzZM4jv8R8MMWwx9QRep9o78eSUhipUQ4j8LBE9gAq8

Note that this may not work as expected, since some programs hard-code the expected address of the program when checking ownership or deriving PDAs. In our example, that means that ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL is hardcoded somewhere in the executable.

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.