Skip to main content

Contracts

Get Contract ABI for Verified Contract Source Codes

This API retrieves the Application Binary Interface (ABI) of a verified smart contract deployed on the blockchain. It is useful for interacting with the contract programmatically using libraries like Web3.js or ethers.js.


Endpoint

GET

https://mainnet-oapi.kaiascan.io/api?module=contract&action=getabi&address={addressHash}

Request Parameters

ParameterTypeRequiredDescription
addressStringYesThe Ethereum address of the smart contract.

Sample Response

{
"status": "1",
"message": "OK",
"result": "[{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"proposals\",\"outputs\":[{\"name\":\"recipient\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"description\",\"type\":\"string\"},{\"name\":\"votingDeadline\",\"type\":\"uint256\"},{\"name\":\"open\",\"type\":\"bool\"},{\"name\":\"proposalPassed\",\"type\":\"bool\"},{\"name\":\"proposalHash\",\"type\":\"bytes32\"},{\"name\":\"proposalDeposit\",\"type\":\"uint256\"},{\"name\":\"newCurator\",\"type\":\"bool\"},{\"name\":\"yea\",\"type\":\"uint256\"},{\"name\":\"nay\",\"type\":\"uint256\"},{\"name\":\"creator\",\"type\":\"address\"}],\"type\":\"function\"}, ... ]"
}

Response

FieldTypeDescription
statusString1 for success, 0 for failure.
messageStringOK for success, or a descriptive error message.
resultStringJSON string containing the ABI of the verified contract, which can be parsed and used directly.