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
Parameter | Type | Required | Description |
---|---|---|---|
address | String | Yes | The 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
Field | Type | Description |
---|---|---|
status | String | 1 for success, 0 for failure. |
message | String | OK for success, or a descriptive error message. |
result | String | JSON string containing the ABI of the verified contract, which can be parsed and used directly. |