Permalink
Switch branches/tags
Nothing to show
Find file Copy path
01c6dde Feb 13, 2017
1 contributor

Users who have contributed to this file

141 lines (112 sloc) 7.41 KB
title language_tabs toc_footers search
API Reference
shell
false

Introduction

INFURA provides the world with secure, stable, and scalable Ethereum nodes. These docs will help you take advantage of the features INFURA provides.

Endpoints

INFURA uses TLS-protected endpoints for security and privacy.

If you're not sure which network to use, use Mainnet.

Network Description URL
Mainnet production network https://mainnet.infura.io/
Ropsten test network https://ropsten.infura.io/
ConsenSysNet ConsenSys test network https://consensysnet.infura.io/
Remember the "s" in "https".

Calling a JSON-RPC method

Submit an HTTP POST request in JSON-RPC 2.0 format.

Don't forget to include the "Content-Type" header.

Calling a JSON-RPC method

$ curl -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' \
  "https://mainnet.infura.io/"
{"jsonrpc":"2.0","result":"0x27a2d3","id":1}

Supported JSON-RPC methods

INFURA supports a subset of Ethereum's JSON-RPC methods. Most of the unsupported methods have to do with private keys (they're your keys so they should be on your computer; INFURA never sees them).

If you try to use a method that is not on this list, you will receive a 405 Method Not Allowed HTTP response.

Choosing a client to handle your request

In some situations, you may want your request to be handled by a specific client (e.g. Parity). To request a specific client, include the Infura-Ethereum-Preferred-Client HTTP header in your request. Next, provide the client name in lowercase.

Selecting a preferred Ethereum client

$ curl -i -X POST \
  -H "Content-Type: application/json" \
  -H "Infura-Ethereum-Preferred-Client: parity" \
  --data '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' \
  "https://mainnet.infura.io/"
HTTP/1.1 200 OK
Server: nginx/1.10.0
Date: Wed, 09 Nov 2016 21:44:34 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Allow: OPTIONS, POST
Access-Control-Allow-Headers: origin, content-type, accept
Infura-Ethereum-Client: parity 1.4.1

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

The response includes the Infura-Ethereum-Client header, which names the actual client and version that handled the request.

If you request a client or client that is not available, you will receive a 400 Bad Request response.

Available clients

Client Name
Parity parity
Geth geth