Make requests
The Ethereum network supports requests with HTTP or WebSockets. HTTP requires continual requests to the URL endpoint, whereas WebSockets maintains the connection. You can also make batch requests to the Ethereum network.
curl or wscat
Use curl to make the HTTPS requests and wscat for WebSocket requests.
Ensure that you replaceYOUR-API-KEY with a API key from your chainRPC dashboard.
curl -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' \
"https://eth.chainrpc.io/v3/YOUR-API-KEY"wscat -c wss://eth.chainrpc.io/v3/YOUR-API-KEY
> {"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}Postman
Call the JSON-RPC methods using Postman.
Click the Run in Postman button below to fork the collection and make requests.

Web3.js
Save the following script to a file, e.g. index.js
In a terminal window, run the script with node index.js
Ethers
Save the following script to a file, e.g. index.js
In a terminal window, run the script with node index.js
NodeJS
Save the following script to a file, e.g. index.js
In a terminal window, run the script with node index.js
Go
Initialize a new go module:
go mod init infura.Install the
go-ethereumdependency:go get github.com/ethereum/go-ethereum/rpc.Save the following script to a file, e.g.
infura.go.
In a terminal window, run the script with go run infura.go.
Output:
Python
Run the following code with Python.
Output looks like:
Last updated