Making API Requests

How to send requests to a node.

Nirvana Labs Nodes support various open-source libraries for sending and receiving Ethereum data. We believe in supporting and contributing towards these open-source libraries to build transparency within web3 and eliminate a single point of reliance on one library.

Nirvana Labs operates RPC endpoints that can be accessed using cURL, JavaScript, Python, Ruby, and any relevant Web3 SDKs. Nirvana Labs supports a wide range of Ethereum APIs, including:

EthersJS

The ethers.js library aims to be a complete and compact library for interacting with the Ethereum Blockchain and its ecosystem. It was initially designed for use with ethers.io and has since expanded into a more general-purpose library.

To use it, you can install it by running:

npm install --save ethers

EthersJS Documentation

Web3.Py

Web3.py is a Python library for interacting with Ethereum. It's commonly found in decentralized apps (dapps) to help with sending transactions, interacting with smart contracts, reading block data, and various other use cases. The original API was derived from the Web3.js Javascript API, but has since evolved toward the needs and creature comforts of Python developers.

You can install the Python library for interacting with Ethereum by running:

pip install web3

Web3.Py Documentation

Eth.Rb

A straightforward library to build, sign, and broadcast Ethereum transactions. It allows the separation of key and node management. Sign transactions and handle keys anywhere you can run Ruby and broadcast transactions through any local or remote node. Sign messages and recover signatures for authentication.

Install it by running:

gem install eth

Eth.Rb Documentation

cURL

Most *nix based systems support cURL - a command line tool and library for transferring data with URLs. Check if you have it by running the following command:

curl -h

cURL Documentation

WebSocket cat (wscat)

WebSocket cat (wscat) is a convenient tool for connecting to WebSocket APIs in your terminal. Install it using the following command:

npm install -g wscat

You can connect to the Ethereum node with wscat using two options. Run:

wscat -c 'wss://eth.getblock.io/mainnet/' --header 'x-api-key: <Api key>'

or

wscat -c 'wss://eth.getblock.io/mainnet/?api_key=<Api key>'

When the command is performed, you will get a response that the connection is successfully enabled inside the terminal.

Wscat Documentation