Skip to main content
Once a contract is verified, its source code, ABI, and compiler settings are public. The getsourcecode action returns them for any address, so you can read a contract’s code, pull its ABI to build a call, or check whether an address is verified at all. It is the read counterpart to verifying a contract. New to the API? Start with Make your first call.
One request works on every chain, just switch the chainid. For example, set chainid=42161 to read a contract on Arbitrum. See Supported chains for the full list.

Get the source code

1

Make the request

Send a GET to the getsourcecode action with the contract address. The example reads the USDT contract on Ethereum.
2

Read the response

The result is an array with a single object. For a verified contract, it carries the source and the exact settings it was compiled with.

Check whether a contract is verified

For an unverified address, the call still returns status 1, but the ABI field reads Contract source code not verified and SourceCode is empty. Check that field before trying to use the source or ABI.
If the contract is not verified, verify it with the API or from your toolchain first.

Get just the ABI

When you only need the ABI to build a call, use getabi instead. It returns the ABI JSON directly, without the surrounding source and settings.