# Connect ETH / ETC HTTP REST API

The interface is based on Ethereum's JSON-RPC.

The following example is using ETH mainnet. ETC is also supported under this framework. Please see the supported chains and networks for all Bloq Connect supported blockchains.

TIP

The Bloq Ethereum Connect service supports calls to the blockchain: eth_, network peers: net_, and Web3 interface: web_. Here is a list of Bloq supported Ethereum JSON-RPC calls.

# POST eth_blockNumber

This resource returns the number of the most recent block.

Responses

Status Meaning Description Schema
200 OK Successful operation number

# Example responses

200 Response

{
  "jsonrpc": "2.0",
  "result": "0x981fb8", //9969592
  "id": 1
}

# Code sample

curl -X POST https://eth.connect.bloq.cloud/v1/my-project-id \
  -H 'Content-Type: application/json' \
  -d '{ "jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1 }'

TIP

  • The hexidecimal (base-16) numerical system is default for Ethereum JSON-RPC input and output numerical values.
  • The followng Python can be piped into your calls to automatically convert numbers to decimal (base-10):

python3 -c "import sys, json; print(int(json.load(sys.stdin)['result'],0))"

  • For example, here's how to return the eth_blockNumber response as a decimal number:
curl -X POST https://eth.connect.bloq.cloud/v1/my-project-id \
  -H 'Content-Type: application/json' \
  -d '{ "jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1 }' | python3 -c "import sys, json; print(int(json.load(sys.stdin)['result'],0))"
Last updated: 5/18/2020, 9:49:19 PM