Contracts
Get List of Contracts
Retrieve a list of deployed contracts.
Free [2 Credits]
Endpoint
GET
https://mainnet-oapi.kaiascan.io/api?module=contract&action=listcontracts&apikey={YourApiKey}
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
page | String | No | Nonnegative integer representing the page number. offset must also be provided. |
offset | String | No | Nonnegative integer representing the max number of records to return. page must also be provided. |
filter | String | No | verified (1 ), unverified (2 ). |
verified_at_start_timestamp | Unix timestamp | No | representing the starting timestamp for verified contracts. Only used with verified filter. |
verified_at_end_timestamp | Unix timestamp | No | Unix timestamp representing the ending timestamp for verified contracts. Only used with verified filter. |
Sample Response
{
"status": "1",
"message": "OK",
"result": [
{
"ABI": "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}]}]",
"Address": "0x3dd7fbeade9578e4ea95f357e3798ed27c9885d3",
"CompilerVersion": "v0.5.0+commit.1d4f565a",
"ContractName": "KlaytnToken",
"OptimizationUsed": 1
},
]
}
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.
Free [2 Credits]
Endpoint
GET
https://mainnet-oapi.kaiascan.io/api?module=contract&action=getabi&address={addressHash}&apikey={YourApiKey}
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\"}, ... ]"
}
Get contract source code for a verified contract
Retrieve the verified source code of a smart contract deployed on the blockchain.
Free [2 Credits]
Endpoint
GET
https://mainnet-oapi.kaiascan.io/api?module=contract&action=getsourcecode&address={contractAddress}&apikey={YourApiKey}
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
address | String | Yes | The contract address whose source code is requested. |
Sample Response
{
"status": "1",
"message": "OK",
"result": [
{
"ABI": "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}]}]",
"CompilerVersion": "v0.5.0+commit.1d4f565a",
"ContractName": "KlaytnToken",
"FileName": ".sol",
"Address": "0x754288077d0ff82af7a5317c7cb8c444d421d103",
"IsProxy": false,
"OptimizationUsed": 1,
"SourceCode": ""
}
]
}
Get Contract Creation
Retrieve information about the contract creation transaction, including the transaction hash, creator address, and block number.
Free [2 Credits]
Endpoint
GET
https://mainnet-oapi.kaiascan.io/api?module=contract&action=getcontractcreation&address={contractAddress}&apikey={YourApiKey}
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
address | String | Yes | The contract address to retrieve the creation information for. |
Sample Response
{
"status": "1",
"message": "OK",
"result": [
{
"contractAddress": "0x6a6184283af9f62da739f8b309c5fca61e2f1400",
"contractCreator": "0x99bc4365844dd4d7dcdd366c06007b44000cd17b",
"txHash": "0x7f5f886b90a1d216aeb25cf5a1d23f1fcb56b18f6680ac6cae5e7efaaafbbb65",
"blockNumber": 60229264,
"timestamp": 1621951605,
"creationBytecode": "0x60806040526000600560006101000"
}
]
}