Skip to main content

Quickstart

This quickstart guide will help you set up and make calls on the Helios network using the rpc and grpc endpoints.

Prerequisites

Ensure you have a private node or a dedicated node running on Helios network.

Make calls

[Option 1] With curl

Run the following command in your terminal, replacing https://dataseed-testnet.helioschain.network with your node rpc url:

curl https://dataseed-testnet.helioschain.network \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id": 1}'

Note - In Windows Powershell, quotations in curl commands can behave differently than expected. We recommend using Postman on Windows systems.

[Option 2] With Node (JavaScript) Using fetch:

In these examples, you'll use npm as your package manager.

  1. In your project folder, install the node-fetch package using npm:
npm i node-fetch
  1. Create your JavaScript file and copy the following code:

Replace https://dataseed-testnet.helioschain.network with your node rpc url:

const fetch = require("node-fetch");

fetch("https://dataseed-testnet.helioschain.network", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
method: "eth_chainId",
params: [],
id: 1,
}),
})
.then((response) => response.json())
.then((data) => {
console.log(data)
})
.catch((error) => {
console.error(error)
})
  1. Run the code using the following command:
node index.js

[Option 3] With Node (JavaScript) Using Ethers:

  1. In your project folder, install the ethers package using npm:
npm install ethers
  1. Create your JavaScript file and copy the following code:

Replace https://dataseed-testnet.helioschain.network with your node rpc url:

const ethers = require("ethers")

const provider = new ethers.providers.JsonRpcProvider(
"https://dataseed-testnet.helioschain.network"
)

provider
.getBlockNumber()
.then((blockNumber) => {
console.log(blockNumber)
})
.catch((error) => {
console.error(error)
})
  1. Run the code using the following command:
node index.js

[Option 4] With Web3.js (Front-end):

  1. In your project folder, install the latest version of the web3.js library

  2. Create your JavaScript file and copy the following code:

Replace https://dataseed-testnet.helioschain.network with your node rpc url:

var { Web3 } = require("web3")
var provider = "https://dataseed-testnet.helioschain.network"
var web3Provider = new Web3.providers.HttpProvider(provider)
var web3 = new Web3(web3Provider)

web3.eth.getBlockNumber().then((result) => {
console.log("Latest Helios Block is ", result)
})
  1. Run the code using the following command:
node index.js

[Option 5] Python:

  1. In your project folder, install the requests library:
pip install requests
  1. Create your Python file and copy the following code:

Replace https://dataseed-testnet.helioschain.network with your node rpc url:

import requests
import json

url = "https://dataseed-testnet.helioschain.network"

payload = {
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}

headers = {'content-type': 'application/json'}

response = requests.post(url, data=json.dumps(payload), headers=headers).json()

print(response)
  1. Run the code using the following command:
python index.py

Next steps

Now that you have successfully made a call to the Helios network, you can explore more functionalities and APIs provided. Here are some suggestions:

Remember, the Helios community is here to help. If you have any questions or run into any issues, check out the Helios community for help and answers to common questions.