All pages
Powered by GitBook
1 of 8

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Stats

?module=stats

RPC API Endpoints

This API is provided for developers transitioning applications from Etherscan to BlockScout and applications requiring general API and data support. It supports GET and POST requests.

URLs vary by instance. With typical installations, access the API by adding /api to the end of the url. For example with the Goerli instance.

  • URL:

The following modules are supported. Click through to see specific endpoints and parameters.

?module=account

Block

?module=block

getblockreward

Returns the block reward and 'uncle' block rewards when applicable.

Example:

Parameter
Description
API URL: https://fonscan.io/api

An example query includes a module and action(s)/parameters. For example: https://fonscan.io/api?module=account&action=listaccounts&page=2&offset=5

?module=logs

?module=token

?module=stats

?module=block

?module=contract

?module=transaction

https://fonscan.io
Account

blockno

integer block number to check block rewards for eg. 2165403

{
  "message": "OK",
  "result": {
    "blockMiner": "0x13a06d3dfe21e0db5c016c03ea7d2509f7f8d1e3",
    "blockNumber": "2165403",
    "blockReward": "5314181600000000000",
    "timeStamp": "1472533979",
    "uncleInclusionReward": null,
    "uncles": null
  },
  "status": "1"

getblocknobytime

Returns the block number created closest to a provided timestamp.

Example:

Parameter
Description

timestamp

integer representing the Unix timestamp in seconds.

closest

closest block to the provided timestamp, either before or after.

Note: .

eth_block_number

Mimics Ethereum JSON RPC's eth_blockNumber.

Example:

Parameter
Description

id

optional nonnegative integer that represents the json rpc request id.

More on json rpc request id.

{
  "jsonrpc": "2.0",
  "result": "0x103538a",
  "id": 1
}
https://fonscan.io/api
   ?module=block
   &action=getblockreward
   &blockno={blockNumber}

https://fonscan.io/api?module=block

Get block reward by block number

https://fonscan.io/api
   ?module=block
   &action=getblocknobytime
   &timestamp={blockTimestamp}
   &closest={before/after}
https://fonscan.io/api
   ?module=block
   &action=eth_block_number

Get block number by time stamp

Get the latest block number

Logs
Token
Stats
Block
Contract
Transaction
}
How to convert date/time to a Unix timestamp
{
  "message": "OK",
  "result": {
    "blockNumber": "2165403"
  },
  "status": "1"
}

Logs

?module=logs

Get Event Logs by Address and/or Topic(s)

getLogs

Event logs for an address and topic. Use and/or with the topic operator to specify topic retrieval options when adding multiple topics. Up to a maximum of 1,000 event logs.

Example:

https://fonscan.io/api
   ?module=logs
   &action=getLogs
   &fromBlock=1379224
   &toBlock=13792288
   &address=0x33990122638b9132ca29c723bdf037f1a891a70c
   &topic0=0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545
   &topic1=0x72657075746174696f6e00000000000000000000000000000000000000000000
   &topic0_1_opr=or

*=required field

Parameter
Description

string for 2nd optional topic.

topic2

string for 3rd optional topic.

topic3

string for 4th optional topic.

topic0_1_opr

operator when topic 0 and 1 are used. Either and or or

topic0_2_opr

operator for topic 0 and topic 2. Either and or or

topic0_3_opr

operator for topic 0 and topic 3. Either and or or

topic1_2_opr

operator for topic 1 and topic 2. Either and or or

topic1_3_opr

the topic operator for topic 1 and topic 3. Either and or or

topic2_3_opr

the topic operator for topic 2 and topic 3. Either and or or

fromBlock*

integer block number to start searching for logs. latest is also supported

toBlock*

integer block number to stop searching for logs. latest is also supported. Note can be same as fromBlock if looking at logs for a single block

address*

string 160-bit code used for identifying contracts. An address and/or topic is required.

topic0*

string for first required topic.

{
  "message": "OK",
  "result": [
    {
      "address": "0x33990122638b9132ca29c723bdf037f1a891a70c",
      "blockNumber": "0x5c958",
      "data": "0x",
      "gasPrice": "0xba43b7400",
      "gasUsed": "0x10682",
      "logIndex": "0x",
      "timeStamp": "0x561d688c",
      "topics": [
        "0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545",
        "0x72657075746174696f6e00000000000000000000000000000000000000000000",
        "0x000000000000000000000000d9b2f59f3b5c7b3c67047d2f03c3e8052470be92"
      ],
      "transactionHash": "0x0b03498648ae2da924f961dda00dc6bb0a8df15519262b7e012b7d67f4bb7e83",
      "transactionIndex": "0x"
    }
  ],
  "status": "1"
}

https://fonscan.io/api?module=logs

topic1

Transaction

?module=transaction

Get transaction info

gettxinfo

Information related to a specified transaction. Includes:

  • blockNumber

  • confirmations

  • from

  • gasLimit (in wei)

  • gasPrice (in wei)

  • gasUsed

  • hash

  • input

  • logs (array)

  • revert reason

  • success

  • timeStamp

  • to

  • value (in wei)

Example

Parameter
Description

gettxreceiptstatus

Also available through a GraphQL 'transaction' query. Status field return:

  • 0 = failed transaction

  • 1 = successful transaction

Example

Parameter
Description

getstatus

Also available through a GraphQL 'transaction' query. Includes the following:

  • errDescription: string with error message

  • isError

    • 0 = pass, no error

Example

Parameter
Description
1 = error

txhash

string containing the transaction hash

index

txhash

string containing the transaction hash

txhash

string containing the transaction hash

Get transaction receipt status

Get error status and message

https://fonscan.io/api?module=transaction

optional nonnegative integer that represents the log index used for pagination.

{
  "result": {
    "revertReason": "No credit of that type",
    "blockNumber": "3",
    "confirmations": "0",
    "from": "0x000000000000000000000000000000000000000c",
    "gasLimit": "91966",
    "gasPrice": "100000",
    "gasUsed": "95123",
    "hash": "0x0000000000000000000000000000000000000000000000000000000000000004",
    "input": "0x04",
    "logs": [
      {
        "address": "0x000000000000000000000000000000000000000e",
        "data": "0x00",
        "topics": [
          "First Topic",
          "Second Topic",
          "Third Topic",
          "Fourth Topic"
        ]
      }
    ],
    "success": true,
    "timeStamp": "1541018182",
    "to": "0x000000000000000000000000000000000000000d",
    "value": "67612"
  },
  "status": "1"
}
https://fonscan.io/api
   ?module=transaction
   &action=gettxinfo
   &txhash={transactionHash}
https://fonscan.io/api
   ?module=transaction
   &action=gettxreceiptstatus
   &txhash={transactionHash}
{
  "message": "OK",
  "result": {
    "status": "1"
  },
  "status": "1"
}
https://fonscan.io/api
   ?module=transaction
   &action=getstatus
   &txhash={transactionHash}
{
  "message": "OK",
  "result": {
    "errDescription": "Out of gas",
    "isError": "1"
  },
  "status": "1"
}

Token

?module=token

Get ERC-20 or ERC-721 token by contract address

getToken

Info on name, symbol, supply and type for a token contract address.

Example

https://fonscan.io/api
   ?module=token
   &action=getToken
   &contractaddress={contractaddressHash}

Parameter
Description

getTokenHolders

Returns an array of token holder's accounts and amounts held for a specified token contract address.

Example

Parameter
Description

bridgedTokenList

Returns an array of bridged token information (uses native bridge application and only returns when applicable - depends on implementation).

Example

Parameter
Description

Contract

?module=contract

listcontracts

List sorted in ascending order based on the time a contact was first indexed by the explorer. With filters `not_decompiled`(`4`) or `not_verified(4)` the results will not be sorted for performance reasons.

Example:

Parameter

offset

optional nonnegative integer representing the max number of records to return when paginating. 'page' must also be provided.

offset

optional nonnegative integer representing the max number of records to return when paginating. 'page' must also be provided.

contractaddress

string containing the contract address hash - a 160-bit code used for identifying contracts.

contractaddress

string containing the contract address hash of the ERC-20/ERC-721 token

page

chainID

nonnegative integer that represents the chain id where the original token exists.

page

{
  "message": "OK",
  "result": {
    "cataloged": true,
    "contractAddress": "0x0000000000000000000000000000000000000000",
    "decimals": "18",
    "name": "Example Token",
    "symbol": "ET",
    "totalSupply": "1000000000",
    "type": "ERC-20"
  },
  "status": "1"
}

Get token holders by contract address

Get bridged tokens list

https://fonscan.io/api?module=token

optional nonnegative integer representing the page number used for pagination. 'offset' must also be provided.

optional nonnegative integer representing the page number used for pagination. 'offset' must also be provided.

{
  "message": "OK",
  "result": [
    {
      "address": "0x3887e82dbdbe8ec6db44e6298a2d48af572a3b78",
      "value": "153737849289497644937838"
    },
    {
      "address": "0xc894c5de34cb2a3615c737d1276876e44e9700a3",
      "value": "77247336418828547887499"
    }
  ],
  "status": "1"
}
{
  "message": "OK",
  "result": [
    {
      "foreignChainId": "1",
      "foreignTokenContractAddressHash": "0x0ae055097c6d159879521c384f1d2123d1f195e6",
      "homeContractAddressHash": "0xb7d311e2eb55f2f68a9440da38e7989210b9a05e",
      "homeDecimals": "18",
      "homeHolderCount": 393,
      "homeName": "STAKE on xDai",
      "homeSymbol": "STAKE",
      "homeTotalSupply": "1484374.775044204093387391",
      "homeUsdValue": "18807028.39981006586321824397"
    },
    {
      "foreignChainId": "1",
      "foreignTokenContractAddressHash": "0xf5581dfefd8fb0e4aec526be659cfab1f8c781da",
      "homeContractAddressHash": "0xd057604a14982fe8d88c5fc25aac3267ea142a08",
      "homeDecimals": "18",
      "homeHolderCount": 73,
      "homeName": "HOPR Token on xDai",
      "homeSymbol": "HOPR",
      "homeTotalSupply": "26600449.86076749062791602",
      "homeUsdValue": "6638727.472651464170990256943"
    }
  ],
  "status": "1"
https://fonscan.io/api
   ?module=token
   &action=getTokenHolders
   &contractaddress={contractaddressHash}
   &page={integer}
   &offset={integer}
https://fonscan.io/api
   ?module=token
   &action=bridgedTokenList
   &chainid={chainid}
   &page={integer}
   &offset={integer}
Description

page

optional nonnegative integer representing the page number used for pagination. 'offset' must also be provided.

offset

optional nonnegative integer representing the max number of records to return when paginating. 'page' must also be provided.

filter

optional string verified|decompiled|unverified|not_decompiled|empty, or 1|2|3|4|5 respectively. Returns contracts with the requested status.

not_decompiled_with_version

optional string ensures none of the returned contracts were decompiled with the provided version. Ignored unless filtering for decompiled contracts.

{
  "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",

getabi

Also available through a GraphQL addresses query.

Example:

Parameter
Description

address

string containing the address hash.

{
  "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\"}]",
  "status": "1"
}

getsourcecode

Also available through a GraphQL addresses query.

Example:

Parameter
Description

address

string containing the address hash.

{
  "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",
    "FileName": "{sourcify path or empty}",
    "ImplementationAddress": "0x000000000000000000000000000000000000000e",
    "IsProxy": "true",
    "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"
  },
  "status": "1"
}

verify

Example:

Curl Post Example

Parameter
Description

addressHash

string containing the address hash of the contract.

name

verify_via_sourcify

  1. if a smart contract is already verified on Sourcify, it will automatically fetch the data from the repo

  2. otherwise you need to upload source files and JSON metadata file(s).

Example:

Parameter
Description

addressHash

string containing the address hash.

files

array with sources and metadata files

verify_vyper_contract

Example

curl POST example

Parameter
Description

addressHash

string containing the address hash of the contract.

name

verifysourcecode

Example

Parameter
Description

codeformat

Format of sourceCode (currently only supports solidity-standard-json-input)

contractaddress

checkverifystatus

Example

Parameter
Description

guid

stringused for identifying verification attempt

{
  "message": "OK",
  "result": "Pending in queue",
  "status": "1"
}

Return Options: Pending in queue | Pass - Verified | Fail - Unable to verify | Unknown UID

https://fonscan.io/api
   ?module=contract
   &action=listcontracts

https://fonscan.io/api?module=contract

Get a list of contracts

https://fonscan.io/api
   ?module=contract
   &action=getabi
   &address={addressHash}
https://fonscan.io/api
   ?module=contract
   &action=getsourcecode
   &address={addressHash}
https://fonscan.io/api
   ?module=contract
   &action=verify
   &addressHash={addressHash}
   &name={name}
   &compilerVersion={compilerVersion}
   &optimization={false}
   &contractSourceCode={contractSourceCode}
curl -d '{"addressHash":"0xc63BB6555C90846afACaC08A0F0Aa5caFCB382a1","compilerVersion":"v0.5.4+commit.9549d8ff", "contractSourceCode":"pragma solidity ^0.5.4; contract Test { }","name":"Test","optimization":false}' -H "Content-Type: application/json" -X POST "https://blockscout.com/poa/sokol/api?module=contract&action=verify"
https://fonscan.io/api
 ?module=contract
 &action=verify_via_sourcify
 &addressHash={addressHash}
--6e1e4c11657c62dc1e4349d024de9e28
Content-Disposition: form-data; name="addressHash"

0xb77b7443e0F32F1FEBf0BE0fBd7124D135d0a525

--6e1e4c11657c62dc1e4349d024de9e28
Content-Disposition: form-data; name="files[0]"; filename="contract.sol"
Content-Type: application/json

...Source code...

--6e1e4c11657c62dc1e4349d024de9e28
Content-Disposition: form-data; name="files[1]"; filename="metadata.json"
Content-Type: application/json

...JSON metadata...

--6e1e4c11657c62dc1e4349d024de9e28--
https://fonscan.io/api
 ?module=contract
 &action=verify_vyper_contract
 &addressHash={addressHash}
 &name={name}
 &compilerVersion={compilerVersion}
 &contractSourceCode={contractSourceCode}
curl --location --request POST 'http://localhost:4000/api?module=contract&action=verify_vyper_contract' --form 'contractSourceCode="SOURCE_CODE"' --form 'name="Vyper_contract"' --form 'addressHash="0xE60B1B8bD493569a3E945be50A6c89d29a560Fa1"' --form 'compilerVersion="v0.2.12"'
https://fonscan.io/api
 ?module=contract
 &action=verifysourcecode
 &codeformat={solidity-standard-json-input}
 &contractaddress={contractaddress}
 &contractname={contractname}
 &compilerversion={compilerversion}
 &sourceCode={sourceCode}
https://fonscan.io/api
 ?module=contract
 &action=checkverifystatus
 &guid={identifierString}

Get ABI for a verified contract

Get contract source code for a verified contract

Verify a contract with its source code and contract creation information

On successful submission you will receive a guid as a receipt. Use this with to view verification status.

Verify a contract through

POST body example

Verify a vyper contract with its source code and contract creation information

Verify a contract with Standard input JSON file

Return status of a verification attempt

guid is received as a receipt from the verifysourcecode method.

Account

?module=account

eth_get_balance

Mimics Ethereum JSON RPC's eth_getBalance

Example:

Parameter
Description
"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"
}
],
"status": "1"
}

verified_at_start_timestamp

optional unix timestamp Represents the starting timestamp for verified contracts. Only used with verified filter.

verified_at_end_timestamp

optional unix timestamp Represents the ending timestamp for verified contracts. Only used with verified filter.

string containing the name of the contract.

compilerVersion

string containing the compiler version for the contract.

optimization

enum whether or not compiler optimizations were enabled 0=false, 1=true

contractSourceCode

string containing the source code of the contract.

constructorArguments

optional string constructor argument data provided.

autodetectConstructorArguments

optional boolean whether or not automatically detect constructor argument.

evmVersion

optional EVM version for the contract.

optimizationRuns

optional number of optimization runs used during compilation

library1Name

optional string name of the first library used.

library1Address

optional string address of the first library used.

library2Name

optional string name of the second library used.

library2Address

optional string address of the second library used.

library3Name

optional string name of the third library used.

library3Address

optional string address of the third library used.

library4Name

optional string name of the fourth library used.

library4Address

optional string address of the fourth library used.

library5Name

optional string name of the fifth library used.

library5Address

optional string address of the fifth library used.

string containing the name of the contract.

compilerVersion

string containing the compiler version for the contract.

contractSourceCode

string containing the source code of the contract.

constructorArguments

string constructor argument data provided.

string containing the address hash of the contract.

contractname

string name of the contract. It an be an empty string(""), just the contract name("ContractName"), or a filename and contract name("contracts/contract_1.sol:ContractName")

compilerversion

string containing the compiler version for the contract.

sourceCode

string standard input json

constructorArguments

optional string constructor argument data provided.

autodetectConstructorArguments

optional boolean whether or not automatically detect constructor argument.

checkverifystatus
Sourcify
{
  "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",
    "ImplementationAddress": "0x000000000000000000000000000000000000000e",
    "IsProxy": "true",
    "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"
  },
  "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",
    "ImplementationAddress": "0x000000000000000000000000000000000000000e",
    "IsProxy": "true",
    "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"
  },
  "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",
    "ImplementationAddress": "0x000000000000000000000000000000000000000e",
    "IsProxy": "true",
    "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"
  },
  "status": "1"
}
{
  "message": "OK",
  "result": "b080b96bd06ad1c9341c2afb7e3730311388544961acde94",
  "status": "1"
}

address

string containing the address hash.

block

optional. Block number as a string, or latest, earliest or pending Latest is the latest balance in a consensus block. Earliest is the first recorded balance for the address. Pending is the latest balance in a consensus or nonconsensus block.

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x0234c8a3397aab58"
}

balance

Many chains use their own native tokens. On Ethereum, this will return the result in "Ether", on Gnosis it will be "xDai", etc. Results are returned in wei.

Example:

Parameter
Description

address

string containing the address hash.

{
  "message": "OK",
  "result": "663046792267785498951364",
  "status": "1"
}

balancemulti

Example:

Parameter
Description

address

string containing the address hash, comma separated. Max 20 addresses.

{
  "message": "OK",
  "result": [
    {
      "account": "0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a",
      "balance": "40807168566070000000000",
      "stale": true
    },
    {
      "account": "0x63a9975ba31b0b9626b34300f7f627147df1f526",
      "balance": "332567136222827062478",
      "stale": false
    },
    {
      "account": "0x198ef1ec325a96cc354c7266a038be8b5c558f67",
      "balance": "185178830000000000",
      "stale": false
    }
  ],
  "status": "1"
}

pendingtxlist

Example:

Parameter
Description

address

string containing the address hash.

page

optional integer representing the page number used for pagination. 'offset' must also be provided.

txlist

Maximum of 10,000 transactions. Also available through a GraphQL 'address' query. For faster results, specify a smaller block range to search using the start_block and end_block parameters

Example:

Parameter
Description

address

string containing the address hash.

sort

optional sorting preference, asc for ascending and desc for descending. Descending is default.

txlistinternal

Up to a maximum of 10,000 internal transactions. Also available through a GraphQL 'transaction' query. For faster results, specify a smaller block range to search using the start_block and end_block parameters.

Example:

Parameter
Description

txhash

string representing the transaction hash to check for internal transactions

address

optional string containing the address hash.

tokentx

Up to a maximum of 10,000 token transfer events. Also available through the GraphQL token_transfers query.

Example:

Parameter
Description

address

string containing the address hash.

contract address

optional string with the token contract address to identify a contract.

tokenbalance

Example:

Parameter
Description

contract address

string containing the contract address hash.

address

string containing the account address hash to retrieve balance for.

tokenlist

Example:

Parameter
Description

address

string containing the account address hash.

{
  "message": "OK",
  "result": [
    {
      "balance": "135499",
      "contractAddress": "0x0000000000000000000000000000000000000000",
      "decimals": "18",
      "name": "Example Token",
      "symbol": "ET",
      "type": "ERC-20"
    },
    {
      "balance": "1",
      "contractAddress": "0x0000000000000000000000000000000000000001",
      "decimals": "18",
      "name": "Example ERC-721 Token",
      "symbol": "ET7",
      "type": "ERC-721"
    }
  ],
  "status": "1"
}

getminedblocks

Example:

Parameter
Description

contract address

string containing the contract address hash.

address

string containing the account address hash to retrieve balance for.

listaccounts

Lists accounts and native balances, sorted ascending by the time they were first seen by the explorer.

Example:

Parameter
Description

page

optional integer representing the page number used for pagination. 'offset' must also be provided.

offset

optional integer representing number of transactions returned per page. page must also be provided.

If the balance hasn't been updated in a long time, the node is double checked to fetch the absolute latest balance. This is not reflected in the current request, but once it is updated, subsequent requests will show the updated balance. The stale attribute will be set to true if a new balance is being fetched.

https://fonscan.io/api
   ?module=account
   &action=eth_get_balance
   &address={addressHash}

https://fonscan.io/api?module=account

Return balance from a provided block

https://fonscan.io/api
   ?module=account
   &action=balance
   &address={addressHash}
https://fonscan.io/api
   ?module=account
   &action=balancemulti
   &address={addressHash1,addressHash2,addressHash3}
https://fonscan.io/api
   ?module=account
   &action=pendingtxlist
   &address={addressHash}
   &page=1
   &offset=5
https://fonscan.io/api
   ?module=account
   &action=txlist
   &address={addressHash}
   &startblock=555555
   &endblock=666666
   &page=1
   &offset=5
   &sort=asc
https://fonscan.io/api
   ?module=account
   &action=txlistinternal
   &txhash={transactionHash}
   &startblock=555555
   &endblock=666666
   &page=1
   &offset=5
   &sort=asc
https://fonscan.io/api
   ?module=account
   &action=tokentx
   &address={addressHash}
   &page=1
   &offset=10
   &sort=asc
https://fonscan.io/api
   ?module=account
   &action=tokenbalance
   &contractaddress={contractAddressHash}
   &address={addressHash}
https://fonscan.io/api
   ?module=account
   &action=tokenlist
   &address={addressHash}
https://fonscan.io/api
   ?module=account
   &action=getminedblocks
   &address={addressHash}
https://fonscan.io/api
   ?module=account
   &action=listaccounts
   &address={addressHash}
   &page=1
   &offset=3

Get the native token balance for an address

Also available through a GraphQL address query.

If the balance hasn't been updated recently, the node is double-checked to fetch the absolute latest balance. This will not be reflected in the current request, but once it is updated, subsequent requests will show the updated balance. If you want to know if there is a check for another balance, use the balancemulti action. That contains a property called stale that will let you know to recheck that balance in the near future.

Get balance for multiple addresses

Also available through a GraphQL 'addresses' query

If the balance hasn't been updated in a long time, the node is double checked to fetch the absolute latest balance. This is not reflected in the current request, but once it is updated, subsequent requests will show the updated balance. The stale attribute will be set to true if a new balance is being fetched.

Get pending transactions by address

Get transactions by address

Get internal transactions by transaction or address hash

Get token transfer events by address

Get token account balance for token contract address

Get list of tokens owned by address

Get list of blocks mined by address

Get a list of accounts and their balances

offset

optional integer representing number of transactions returned per page. page must also be provided.

start_block

optional integer block number to start transaction search

end_block

optionalinteger block number to stop transaction search.

page

optional integer representing the page number used for pagination. offset must also be provided.

offset

optional integer representing number of transactions returned per page. page must also be provided.

filter_by

optional string representing the field to filter by. Values include to and from. If none provided returns transactions that match to, from, or contract address.

start_timestamp

optional starting block unix timestamp.

end_timestamp

optional ending block unix timestamp.

sort

optional sorting preference, asc for ascending and desc for descending. Descending is default. Only available if 'address' is provided.

start_block

optional integer block number to start transaction search. Only available if 'address' is provided.

end_block

optionalinteger block number to stop transaction search. Only available if 'address' is provided.

page

optional integer representing the page number used for pagination. offset must also be provided. Only available if 'address' is provided.

offset

optional integer representing number of transactions returned per page. page must also be provided. Only available if 'address' is provided.

sort

optional sorting preference, asc for ascending and desc for descending. Descending is default.

start_block

optional integer block number to start transaction search

end_block

optionalinteger block number to stop transaction search.

page

optional integer representing the page number used for pagination. offset must also be provided.

offset

optional integer representing number of transactions returned per page. page must also be provided.


  "message": "OK",
  "result": [
    {
      "contractAddress": "",
      "cumulativeGasUsed": "122207",
      "from": "0x3fb1cd2cd96c6d5c0b5eb3322d807b34482481d4",
      "gas": "122261",
      "gasPrice": "50000000000",
      "gasUsed": "122207",
      "hash": "0x98beb27135aa0a25650557005ad962919d6a278c4b3dde7f4f6a3a1e65aa746c",
      "input": "0xf00d4b5d000000000000000000000000036c8cecce8d8bbf0831d840d7f29c9e3ddefa63000000000000000000000000c5a96db085dda36ffbe390f455315d30d6d3dc52",
      "nonce": "0",
      "to": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
      "value": "0"
    }
  ],
  "status": "1"
}
{
  "message": "OK",
  "result": [
    {
      "blockHash": "0x373d339e45a701447367d7b9c7cef84aab79c2b2714271b908cda0ab3ad0849b",
      "blockNumber": "65204",
      "confirmations": "5994246",
      "contractAddress": "",
      "cumulativeGasUsed": "122207",
      "from": "0x3fb1cd2cd96c6d5c0b5eb3322d807b34482481d4",
      "gas": "122261",
      "gasPrice": "50000000000",
      "gasUsed": "122207",
      "hash": "0x98beb27135aa0a25650557005ad962919d6a278c4b3dde7f4f6a3a1e65aa746c",
      "input": "0xf00d4b5d000000000000000000000000036c8cecce8d8bbf0831d840d7f29c9e3ddefa63000000000000000000000000c5a96db085dda36ffbe390f455315d30d6d3dc52",
      "isError": "0",
      "nonce": "0",
      "timeStamp": "1439232889",
      "to": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
      "transactionIndex": "0",
      "txreceipt_status": "1",
      "value": "0"
    }
  ],
  "status": "1"
}
{
  "message": "OK",
  "result": [
    {
      "blockNumber": "6153702",
      "callType": "delegatecall",
      "contractAddress": "0x883103875d905c11f9ac7dacbfc16deb39655361",
      "errCode": "",
      "from": "0x2ca1e3f250f56f1761b9a52bc42db53986085eff",
      "gas": "814937",
      "gasUsed": "536262",
      "index": "0",
      "input": "",
      "isError": "0",
      "timeStamp": "1534362606",
      "to": "",
      "transactionHash": "0xd65b788c610949704a5f9aac2228c7c777434dfe11c863a12306f57fcbd8cdbb",
      "type": "call",
      "value": "5488334153118633"
    }
  ],
  "status": "1"
}
{
  "message": "OK",
  "result": [
    {
      "blockHash": "0x6169c5dc05d0051564ba3eae8ebfbdefda640c5f5ffc095846b8aed0b44f64ea",
      "blockNumber": "5997843",
      "confirmations": "199384",
      "contractAddress": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
      "cumulativeGasUsed": "1043649",
      "from": "0x4e83362442b8d1bec281594cea3050c8eb01311c",
      "gas": "44758",
      "gasPrice": "7000000000",
      "gasUsed": "37298",
      "hash": "0xd65b788c610949704a5f9aac2228c7c777434dfe11c863a12306f57fcbd8cdbb",
      "input": "0xa9059cbb00000000000000000000000021e21ba085289f81a86921de890eed30f1ad23750000000000000000000000000000000000000000000000008ac7230489e80000",
      "logIndex": "0",
      "nonce": "765",
      "timeStamp": "1532086946",
      "to": "0x21e21ba085289f81a86921de890eed30f1ad2375",
      "tokenDecimal": "18",
      "tokenName": "Maker",
      "tokenSymbol": "MKR",
      "transactionIndex": "27",
      "value": "10000000000000000000"
    }
  ],
  "status": "1"
}
{
  "message": "OK",
  "result": "135499",
  "status": "1"
}
{
  "message": "OK",
  "result": "135499",
  "status": "1"
}
{
  "message": "OK",
  "result": [
    {
      "address": "0x3870c57fbf1d7e49b154269331c7bc66c64d8857",
      "balance": "3790064387342000000",
      "stale": false
    },
    {
      "address": "0x497d69ae30d7cca0aa84d647c6d85a59a82c16ef",
      "balance": "2047176464264000000",
      "stale": false
    },
    {
      "address": "0x9233042b8e9e03d5dc6454bbbe5aee83818ff103",
      "balance": "444111960222208758647",
      "stale": false
    }
  ],
  "status": "1"
}