This page will help you get started with Node Service.
Supported Ecosystems
Ethereum
Network | Endpoint |
---|---|
Ethereum Mainnet | https://api.zan.top/node/v1/eth/mainnet/{apiKey} |
Ethereum Sepolia | https://api.zan.top/node/v1/eth/sepolia/{apiKey} |
Ethereum Holesky | https://api.zan.top/node/v1/eth/holesky/{apiKey} |
BNB Smart Chain
Network | Endpoint |
---|---|
BSC Mainnet | https://api.zan.top/node/v1/bsc/mainnet/{apiKey} |
BSC Testnet | https://api.zan.top/node/v1/bsc/testnet/{apiKey} |
Polygon
Network | Endpoint |
---|---|
Polygon Mainnet | https://api.zan.top/node/v1/polygon/mainnet/{apiKey} |
Polygon Amoy | https://api.zan.top/node/v1/polygon/amoy/{apiKey} |
Arbitrum
Network | Endpoint |
---|---|
Arbitrum One | https://api.zan.top/node/v1/arb/one/{apikey} |
Arbitrum Sepolia | https://api.zan.top/node/v1/arb/sepolia/{apikey} |
Optimism
Network | Endpoint |
---|---|
Optimism Mainnet | https://api.zan.top/node/v1/opt/mainnet/{apikey} |
Optimism Sepolia | https://api.zan.top/node/v1/opt/sepolia/{apikey} |
TRON
Network | Endpoint |
---|---|
TRON Mainnet | https://api.zan.top/node/v1/tron/mainnet/{apikey}/jsonrpc |
TRON Nile Testnet | https://api.zan.top/node/v1/tron/nile/{apikey}/jsonrpc> |
Sui
Network | Endpoint |
---|---|
Sui Mainnet | https://api.zan.top/node/v1/sui/mainnet/{apikey} |
Sui Testnet | https://api.zan.top/node/v1/sui/testnet/{apikey} |
Aptos
Network | Endpoint |
---|---|
Aptos Mainnet | https://api.zan.top/node/v1/aptos/mainnet/{apikey} |
Aptos Testnet | https://api.zan.top/node/v1/aptos/testnet/{apikey}> |
Bitcoin
Network | Endpoint |
---|---|
Bitcoin Mainnet | https://api.zan.top/node/v1/btc/mainnet/{apikey} |
Bitcoin Testnet | https://api.zan.top/node/v1/btc/testnet/{apikey}> |
Avalanche
Network | Endpoint |
---|---|
Avalanche Mainnet | https://api.zan.top/node/v1/avax/mainnet/{apiKey} |
Avalanche Fuji | https://api.zan.top/node/v1/avax/fuji/{apiKey}> |
Fantom
Network | Endpoint |
---|---|
Fantom Mainnet | https://api.zan.top/node/v1/ftm/mainnet/{apiKey} |
Base
Network | Endpoint |
---|---|
Base Mainnet | https://api.zan.top/node/v1/base/mainnet/{apiKey} |
X Layer
Network | Endpoint |
---|---|
X Layer Mainnet | https://api.zan.top/node/v1/xlayer/mainnet/{apiKey} |
X Layer Testnet | https://api.zan.top/node/v1/xlayer/testnet/{apiKey} |
Starknet
Network | Endpoint |
---|---|
Starknet Mainnet | https://api.zan.top/node/v1/starknet/mainnet/{apiKey} |
Core
Network | Endpoint |
---|---|
Core Mainnet | https://api.zan.top/node/v1/core/mainnet/{apiKey} |
Mantle
Network | Endpoint |
---|---|
Mantle Mainnet | https://api.zan.top/node/v1/mantle/mainnet/{apiKey} |
Artela
Network | Endpoint |
---|---|
Artela Testnet | https://api.zan.top/node/v1/artela/testnet/{apiKey} |
zkSync Era
Network | Endpoint |
---|---|
zkSync Mainnet | https://api.zan.top/node/v1/zksync/mainnet/{apiKey} |
Mint
Network | Endpoint |
---|---|
Mint Mainnet | https://api.zan.top/node/v1/mint/mainnet/{apiKey} |
Basic Usage Instructions
You'll need to have an API key before you start. Follow the instructions on Getting Started to create an API key.
ZAN Node Service provides a set of JSON-RPC APIs for you to interact with the blockchain, which are similar to the JSON-RPC APIs provided by the native node client. The easiest way to use the APIs is directly sending an HTTP POST request with the API key in the URL. Here's an example to use curl
to send an HTTP POST request to get the latest block number of Ethereum mainnet.
## JSON-RPC over HTTP POST
## Replace {apiKey} with the API key you obtained from the ZAN dashboard.
## You can also replace the "eth" and "mainnet" with any other supported networks.
curl https://api.zan.top/node/v1/eth/mainnet/{apiKey} \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
And here's an example to use wscat
to send a WebSocket request for the same purpose.
## JSON-RPC over WSS
## Replace {apiKey} with the API key you obtained from the ZAN dashboard.
## You can also replace the "eth" and "mainnet" with any other supported networks.
wscat -c wss://api.zan.top/node/ws/v1/eth/mainnet/{apiKey}
>{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}
- See Supported Ecosystems for the endpoint URLs of the currently supported ecosystems.
- See the API reference of each ecosystem for more information about the available APIs.
If you plan to use the APIs in a programming language, there are plenty of libraries to help with that, including:
web3.js (for JavaScript)
var Web3 = require('web3');
var provider = 'https://api.zan.top/node/v1/eth/mainnet/{apiKey}';
var web3Provider = new Web3.providers.HttpProvider(provider);
var web3 = new Web3(web3Provider);
web3.eth.getBlockNumber().then((result) => {
console.log("getBlockNumber(): ",result);
});
For more information, see: https://web3js.readthedocs.io.
Ethers (for JavaScript)
var ethers = require('ethers');
var url = 'https://api.zan.top/node/v1/eth/mainnet/{apiKey}';
var customHttpProvider = new ethers.providers.JsonRpcProvider(url);
customHttpProvider.getBlockNumber().then((result) => {
console.log("getBlockNumber(): " + result);
});
For more information, see: https://docs.ethers.org.
web3.py (for Python)
from web3 import Web3, HTTPProvider
connection = Web3(HTTPProvider('https://api.zan.top/node/v1/eth/mainnet/{apiKey}'))
print ("getBlockNumber():", connection.eth.blockNumber)
For more information, see: https://web3py.readthedocs.io.
web3j (for Java/Kotlin/Scala)
Web3j client = Web3j.build(new HttpService("https://api.zan.top/node/v1/eth/mainnet/{apiKey}"));
EthBlockNumber ethBlockNumber = client.ethBlockNumber().sendAsync().get();
System.out.println("getBlockNumber(): "+ethBlockNumber.getBlockNumber());
For more information, see: https://docs.web3j.io.
API key secret
Enforce additional security by requiring an API key secret for all requests, see Configuring secret-based two-factor authentication.
-
HTTPS
curl --user :{secretKey} \ https://api.zan.top/node/ws/v1/eth/mainnet/{apiKey} \ -X POST \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
-
WebSocket
wscat -c wss://api.zan.top/node/ws/v1/eth/mainnet/{apiKey} --auth ":{secretKey}" > {"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}