Get the total number of deployed smart contracts
Returns the total number of deployed smart contracts.
Sample request
https://api.main.atgraphite.com/api
?module=contract
&action=gettotalcontractcount
&apikey=YourApiKeyToken
Sample response
{
"status": "1",
"message": "OK",
"result": "9"
}
Get ABI for verified contract
Returns ABI for verified contract.
Sample request
https://api.main.atgraphite.com/api
?module=contract
&action=getabi
&address=0x0000000000000000000000000000000000001000
&apikey=YourApiKeyToken
Request query parameters
address hex-string used for identifying contract
Sample response
{
"status": "1",
"message": "OK",
"result": "[{\"constant\":false,\"inputs\":[{\"name\":\"voucher_token\",\"type\":\"bytes32\"}],\"name\":\"burn\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"voucher_token\",\"type\":\"bytes32\"}],\"name\":\"is_expired\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"voucher_token\",\"type\":\"bytes32\"}],\"name\":\"is_burnt\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"voucher_token\",\"type\":\"bytes32\"},{\"name\":\"_lifetime\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]"
}
Get contract deployed byte code
Returns deployed bytecode for a given contract address
Sample request
https://api.main.atgraphite.com/api
?module=contract
&action=getbytecode
&address=0x0000000000000000000000000000000000001000
&apikey=YourApiKeyToken
Request query parameters
address hex-string used for identifying contract
Sample response
{
"status": "1",
"message": "OK",
"result": "0x312f378576e12537b1243c15723a31231bf23123e23167e568c57fb45b12309f9989e99dc9899"
}
Get contract creation bytecode
Returns creation bytecode for a given contract address
Sample request
https://api.main.atgraphite.com/api
?module=contract
&action=getcreationbytecode
&address=0x0000000000000000000000000000000000001000
&apikey=YourApiKeyToken
Request query parameters
address hex-string used for identifying contract
Sample response
{
"status": "1",
"message": "OK",
"result": "0x312f378576e12537b1243c15723a31231bf23123e23167e568c57fb45b12309f9989e99dc9899"
}
Get contract source code for verified contract
Returns source code for verified contract.
Sample request
https://api.main.atgraphite.com/api
?module=contract
&action=getsourcecode
&address=0x0000000000000000000000000000000000001000
&apikey=YourApiKeyToken
Request query parameters
address hex-string used for identifying contract
Sample response
{
"status": "1",
"message": "OK",
"result": {
"abi": "[{\n\"type\":\"event\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\",\"indexed\":true},{\"name\":\"b\",\"type\":\"bytes32\",\"indexed\":false}],\n\"name\":\"Event\"\n}, {\n\"type\":\"event\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\",\"indexed\":true},{\"name\":\"b\",\"type\":\"bytes32\",\"indexed\":false}],\n\"name\":\"Event2\"\n}, {\n\"type\":\"function\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\"}],\n\"name\":\"foo\",\n\"outputs\": []\n}]\n",
"compilerVersion": "v0.2.1-2016-01-30-91a6b35",
"contractName": "Test",
"optimizationUsed": "1",
"sourceCode": "pragma solidity >0.4.24;\n\ncontract Test {\nconstructor() public { b = hex\"12345678901234567890123456789012\"; }\nevent Event(uint indexed a, bytes32 b);\nevent Event2(uint indexed a, bytes32 b);\nfunction foo(uint a) public { emit Event(a, b); }\nbytes32 b;\n}\n",
"byteCode": "0x312f378576e12537b1243c15723a31231bf23123e23167e568c57fb45b12309f9989e99dc9899",
"constructorArguments": "",
"implementationAddress": null
}
}
Get Contract creator and creation transaction hash
Returns a contract's deployer address and transaction hash it was created, up to 5 at a time.
Sample request
https://api.main.atgraphite.com/api
?module=contract
&action=getcontractcreation
&contractaddresses=0xb83c27805aaca5c7082eb45c868d955cf04c337f,0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45
&apikey=YourApiKeyToken
Request query parameters
the contract address
, up to 5 at a time
Sample response
{
"status": "1",
"message": "OK",
"result": [
{
"contractAddress": "0xb83c27805aaca5c7082eb45c868d955cf04c337f",
"contractCreator": "0x390dcfddebeff949b9862ec91d7be337b8995553",
"txHash": "0x0dbad4991b6727df606650635c9e632dad8a92c6363c91652307680efd336c6e",
"blockNumber": "15062235"
},
{
"contractAddress": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45",
"contractCreator": "0x6c9fc64a53c1b71fb3f9af64d1ae3a4931a5f4e9",
"txHash": "0x7299cca7203f60a831756e043f4c2ccb0ee6cb7cf8aed8420f0ae99a16883a2b",
"blockNumber": "13804681"
}
]
}
Get contract addresses by contract method identifier
Returns a list of contract addresses by contract method identifier, sorted by creation block number
Sample request
https://api.main.atgraphite.com/api
?module=contract
&action=getcontractsbymethod
&methodid=0xa9059cbb
&offset=0
&limit=10
&sort=asc
&apikey=YourApiKeyToken
Request query parameters
the hex string representing the method id (4 bytes)
skips the offset
records before beginning to return the records, default value is 0
the number of records displayed per page, default value is 10000
the sorting preference, use asc
to sort by ascending and desc
to sort by descending, default value is asc
Sample response
{
"status": "1",
"message": "OK",
"result": [
"0x741b84be98a7181eb05d8d0fcc7ce285bc9e5c4a",
"0xd9fdf6d8340df2c358e9e4f6aecc08b8373ae054",
"0xca54e68e81915143f1fa261e253cf6777c36dbd4",
"0xac331ff69d4cf665a54013c419bcafaf90f7e1d0",
"0x32286efee48171b29e066ef8992bb3063231d61e",
"0xa0eb9b10d9e24ed8e0910f204118f44af7bf7cb9",
"0xe8df28ef22990009e1d247a329f8507ba4cfa58a",
"0x5e6c18ceea41c161118b62c8737f5ba9400ba54f",
"0x8e2b9e2764c213872b70af4586ea75a5627e4555",
"0x158c14bbedb24398785553b9ec8c71387f52df44"
]
}
Get Contract destructor and destruction transaction hash
Returns a contract's destructor address and transaction hash it was destructed, up to 5 at a time.
Sample request
https://api.main.atgraphite.com/api
?module=contract
&action=getcontractdestruction
&contractaddresses=0x838e90a2f735276d8c7824c3858b7ceb3aa6b110,0x76173df7aceeeb990839dc0c359c4a3ec1e01da7
&apikey=YourApiKeyToken
Request query parameters
the contract address
, up to 5 at a time
Sample response
{
"status": "1",
"message": "OK",
"result": [
{
"contractAddress": "0x838e90a2f735276d8c7824c3858b7ceb3aa6b110",
"contractDestructor": "0x9b2c46642caf6b936dc0633da521f1e946b7e18f",
"txHash": "0x3340c44ecdfc73450f030f01e4f95328d1df5cf11e2646f5b94325d68ecb97f1",
"blockNumber": "55245"
},
{
"contractAddress": "0x76173df7aceeeb990839dc0c359c4a3ec1e01da7",
"contractDestructor": "0x3d0768da09ce77d25e2d998e6a7b6ed4b9116c2d",
"txHash": "0x55cee382ac5ed2e48638db8fa1ae8df356a6f2d4190f270e9e8938648f8c84ad",
"blockNumber": "55502"
}
]
}
Verify a contract with its source code and contract creation information
Verifies a contract with its source code.
Body parameters (json)
the address of the contract
the compiler version for the contract
whether or not compiler optimizations were enabled
the source code of the contract
the EVM version for the contract
the number of optimization runs used during compilation
Sample request (HTTP POST)
https://api.main.atgraphite.com/api
?module=contract
&action=verifysourcecode
&apikey=YourApiKeyToken
Body (json):
{
"addressHash": "0x9271602210f21ab82999dd43792a12e63c6e3269",
"name": "test_contract",
"compilerVersion": "v0.2.1-2016-01-30-91a6b35",
"optimization": true,
"optimizationRuns": 200,
"contractSourceCode": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13; contract Counter { uint public count; function get() public view returns (uint) { return count; } function inc() public { count += 1; } function dec() public { count -= 1; }}"
}
Sample response
{
"status": "1",
"message": "OK",
"result": {
"abi": "[{\n\"type\":\"event\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\",\"indexed\":true},{\"name\":\"b\",\"type\":\"bytes32\",\"indexed\":false}],\n\"name\":\"Event\"\n}, {\n\"type\":\"event\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\",\"indexed\":true},{\"name\":\"b\",\"type\":\"bytes32\",\"indexed\":false}],\n\"name\":\"Event2\"\n}, {\n\"type\":\"function\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\"}],\n\"name\":\"foo\",\n\"outputs\": []\n}]\n",
"compilerVersion": "v0.2.1-2016-01-30-91a6b35",
"contractName": "test_contract",
"optimizationUsed": "0",
"sourceCode": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13; contract Counter { uint public count; function get() public view returns (uint) { return count; } function inc() public { count += 1; } function dec() public { count -= 1; }}",
"byteCode": "0x312f378576e12537b1243c15723a31231bf23123e23167e568c57fb45b12309f9989e99dc9899",
"constructorArguments": "",
"implementationAddress": null
}
}
Get supported compiler versions
Returns supported compiler versions.
Sample request (HTTP POST)
https://api.main.atgraphite.com/api
?module=contract
&action=getcompilerversions
&apikey=YourApiKeyToken
Sample response
{
"status": "1",
"message": "OK",
"result": [
"v0.8.10+commit.fc410830",
"v0.8.11+commit.d7f03943",
"v0.8.12+commit.f00d7308",
"v0.8.13+commit.abaa5c0e",
"v0.8.14+commit.80d49f37",
"v0.8.15+commit.e14f2714",
"v0.8.16+commit.07a7930e",
"v0.8.17+commit.8df45f5f"
]
}
Get contract creation history
Returns a contract creation history (creator address, transaction hash and block number when it was created)
Sample request
https://api.main.atgraphite.com/api
?module=contract
&action=getcreationhistory
&contractaddress=0x3293d43cf57cdd7f78e8b193e6628939400b321d
&offset=0
&limit=10
&sort=desc
&apikey=YourApiKeyToken
Request query parameters
address hex-string used for identifying contract
Sample response
{
"status": "1",
"message": "OK",
"result": [
{
"blockNumber": "18009592",
"contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
"contractCreator": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
"txHash": "0x8fe362efc9a222c8f025f9663e88bdaf331acbcf538afc64499487dd185c76c0"
},
{
"blockNumber": "17859733",
"contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
"contractCreator": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
"txHash": "0xed5a6a39d95feafa537a104b311082348e1ea9e2cf9457bac4e1c4f31c45d198"
},
{
"blockNumber": "17809911",
"contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
"contractCreator": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
"txHash": "0x194b3bed50a6a68047b87c79e9829010011eb9e79768d1926169c676c81983b1"
},
{
"blockNumber": "17565842",
"contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
"contractCreator": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
"txHash": "0x8d54a2c20ac872db263d7a3615caff32313130dc765fa6f3706c467612474a63"
},
{
"blockNumber": "17293429",
"contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
"contractCreator": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
"txHash": "0x03fd065e38fd4ac05eab45d40cd8bee8878b7985b46fa5a680ea83b1920aa3e0"
}
]
}
Get contract destruction history
Returns a contract destruction history (destructor address, transaction hash and block number when it was destructed)
Sample request
https://api.main.atgraphite.com/api
?module=contract
&action=getdestructionhistory
&contractaddress=0x3293d43cf57cdd7f78e8b193e6628939400b321d
&offset=0
&limit=10
&sort=desc
&apikey=YourApiKeyToken
Request query parameters
address hex-string used for identifying contract
Sample response
{
"status": "1",
"message": "OK",
"result": [
{
"blockNumber": "18009583",
"contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
"contractDestructor": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
"txHash": "0xff59edcb5257f2fae321d4caaf52a1793d511c9460497be82fa1fbe456e27f7b"
},
{
"blockNumber": "17859565",
"contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
"contractDestructor": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
"txHash": "0xe31c4cce8b8b531f911880fb2bd978c42b6a3da8581c63309dc5174ecc5f5a1a"
},
{
"blockNumber": "17809898",
"contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
"contractDestructor": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
"txHash": "0xb928c47de5fc18e2a968f695d9c31e0d418d4a24968fa73e2d7313f73e713f30"
},
{
"blockNumber": "17565798",
"contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
"contractDestructor": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
"txHash": "0xd6a832782779c901802063b65e33f7da890c0d758ebc3f36a177875ca713dc1f"
}
]
}