Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see the contract code in Solana?

On Ethereum, I can go to the Etherscan link for a contract address and view the code and Read/Write ABIs. I can't seem to find this on Solana Explorer, Solscan, or anything. What's the best way for me to see IDL signatures and/or the Rust code in the functions?

Thanks

like image 618
Edward Sun Avatar asked Oct 19 '25 15:10

Edward Sun


2 Answers

Like on Ethereum, some programs are submitted and verified. This is done using the Anchor verification process.

An example can be found with the Serum V3 program.

The Anchor Verified badge links to the actual source code of the program, where you can get the IDL, Anchor's version of ABI.

Note: Also like Ethereum, not all programs are verified. This feature is rather new, and still being adopted. I hope to see more programs use this feature in the future.

like image 72
Jacob Creech Avatar answered Oct 22 '25 05:10

Jacob Creech


Unlike Ethereum, Solana doesn't have a standard way to view a program's source code or verify that it matches the deployed binary

If the project is open source, you can try to find the GitHub repo manually, but there's no on-chain link to verify it's the same code that was deployed.

So if you want to find the original IDL you may go through these steps:

  1. Use anchor idl fetch <PROGRAM_ID> if you have Anchor CLI installed

  2. Go to https://solscan.io/account/<PROGRAM_ID>#anchorProgramIDL

  3. Try tools like solvitor or idlGuesser for reverse-engineering IDL/source-code:(https://solvitor.xyz/public_idl/<PROGRAM_ID>)

There are tools for verifiable builds (e.g., https://github.com/Ellipsis-Labs/solana-verifiable-build), and Anchor supports anchor build --verifiable, but there's no explorer integration that ties the build to a source repo like Etherscan does.

like image 39
Vlad Dyachenko Avatar answered Oct 22 '25 06:10

Vlad Dyachenko