On Solscan, when you go to Analytics and scroll to the bottom, I noticed some programs like Raydium, Pyth and Metaplex have public name's set and you see that instead of seeing the program account address. I also notice some instructions in programs have the actually instruction name instead of mine which says Unknown Program Instruction. I was wondering if someone knew how to change this since I'm assuming it's coming from the program itself. I think it makes the program stand out more on the client side in a lot of explorers.
1 Answer
While it's hard to find info on exactly how explorers achieve this, the single best thing you can do to ensure the they provide usable names for your instructions is to create an IDL account on chain (if you're using anchor).
You can do that by running the following command in your project's directory:
anchor idl init -f <target/idl/program.json> <program-id>
This will ensure they have an easier time indexing your program. You can find more information on IDL commands in the Anchor CLI here
Another small thing you can do to ensure program recognition is to grind a custom keypair for the program address. Adding a short moniker that corresponds to the name of the program helps when users/developers attempt to identify it. This can be done with the following:
solana-keygen grind --starts-with <something here>:1
This will spit out a .json keypair file, which you can use to replace the one in your target/deploy folder.
-
Thanks I'll look into this. I knew about grinding the keygen, but I wasn't aware of creating an IDL account– Brian M.Commented Mar 19 at 17:58