Supported Chains: S-T (1/4)
Supported chains S-T on the Web3 API platform. See the full chain list for every network.
Scroll
Scroll API is available on Web3 API platform.
Scroll is a zkEVM-based zkRollup on Ethereum that enables native compatibility for existing Ethereum applications and tools.
Official quick links: Website, Docs, GitHub
Networks
- Mainnet (
HTTPSandWSS) - Sepolia Testnet (
HTTPSandWSS)
The Alpha Testnet consists of Ethereum's Goerli Testnet and the Scroll Alpha test network. Goerli is an Ethereum test network with PoS-based consensus, while Scroll Alpha is a zero-knowledge rollup testnet deployed on top of the former.
API methods
For Scroll, we support blockchain interaction via all the applicable methods except for those listed as unsupported.
Unsupported
This section contains a list of methods we don't support for Premium service plan.
If you require any of the methods from the list, contact our Sales (sales@ankr.com) about moving to the Enterprise service plan that can provide the services tailored to your specific needs.
HTTPS:
eth_newFilter, eth_getFilterChanges, eth_coinbase, eth_hashrate, eth_mining, eth_getWork,eth_submitWork, eth_submitHashrate, net_peerCount, eth_newBlockFilter, eth_newPendingTransactionFilter, eth_uninstallFilter, eth_getFilterLogs,
debug_* (exception: debug_traceBlockByHash, debug_traceBlockByNumber, debug_traceTransaction, debug_traceCall, debug_traceBlock),
personal_*, admin_*, clique_*, les_*, miner_*, engine_*, parity_*
WSS:
txpool_content, txpool_inspect, txpool_status, txpool_contentFrom
API querying
Request example
- cURL
- Golang
- Web3.JS
- Python
curl -X POST https://rpc.ankr.com/scroll \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
package main
import (
"context"
"fmt"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
const url = "https://rpc.ankr.com/scroll" // url string
rpcClient,err := ethclient.Dial(url)
if err != nil {
panic(err)
}
blockNumber, err := rpcClient.BlockNumber(context.Background())
if err != nil {
panic(err)
}
fmt.Println(blockNumber)
}
const Web3 = require('web3');
const url = 'https://rpc.ankr.com/scroll' // url string
const web3 = new Web3(new Web3.providers.HttpProvider(url));
web3.eth.getBlockNumber((error, blockNumber) => {
if(!error) {
console.log(blockNumber);
} else {
console.log(error);
}
});
from web3 import Web3
def test_block_number(self):
url = 'https://rpc.ankr.com/scroll' # url string
web3 = Web3(HTTPProvider(url))
print(web3.eth.block_number)
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1965e"
}
Secret Network
Secret Network API is available on Web3 API platform.
Secret Network is the first blockchain with customizable privacy. You get to choose what you share, who you share with, and how long you share it for. This protects users and empowers developers to build a better Web3.
Official quick links: Website, Docs, GitHub
Networks
- Mainnet:
- Tendermint RPC API (
HTTPSandWSS) - Tendermint REST API (
HTTPS) - Cosmos REST API (
HTTPS)
- Tendermint RPC API (
API methods
For Secret Network, we support blockchain interaction via all the applicable methods except for those listed as unsupported.
Unsupported
This section contains a list of methods we don't support for Premium service plan.
If you require any of the methods from the list, contact our Sales (sales@ankr.com) about moving to the Enterprise service plan that can provide the services tailored to your specific needs.
Tendermint (both for REST and JSON-RPC):
/health,
/genesis,
/broadcast_evidence,
/dial_seeds,
/dial_peers,
Cosmos:
/cosmos/auth/v1beta1/address_by_id/{id},
/cosmos/auth/v1beta1/module_accounts,
/cosmos/auth/v1beta1/bech32,
/cosmos/auth/v1beta1/bech32/{address_bytes},
/cosmos/auth/v1beta1/bech32/{address_string},
/cosmos/bank/v1beta1/supply/{denom},
/cosmos/bank/v1beta1/denom_owners/{denom},
/cosmos/bank/v1beta1/send_enabled,
/cosmos/base/reflection/v1beta1/interfaces,
/cosmos/base/reflection/v1beta1/interfaces/:interface_name/implementations,
/cosmos/base/reflection/v1beta1/app_descriptor/authn,
/cosmos/base/reflection/v1beta1/app_descriptor/chain,
/cosmos/base/reflection/v1beta1/app_descriptor/codec,
/cosmos/base/reflection/v1beta1/app_descriptor/configuration,
/cosmos/base/reflection/v1beta1/app_descriptor/query_services,
/cosmos/base/reflection/v1beta1/app_descriptor/tx_descriptor,
/cosmos/base/tendermint/v1beta1/abci_query,
/cosmos/feegrant/v1beta1/issued/{granter},
/cosmos/gov/v1/proposals/{proposal_id},
/cosmos/gov/v1/proposals,
/cosmos/gov/v1/proposals/{proposal_id}/votes/{voter},
/cosmos/gov/v1/proposals/{proposal_id}/votes,
/cosmos/gov/v1/params/{params_type},
/cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor},
/cosmos/gov/v1/proposals/{proposal_id}/deposits,
/cosmos/gov/v1/proposals/{proposal_id}/tally,
/cosmos/group/v1/group_info/{group_id},
/cosmos/group/v1/group_policy_info/{address},
/cosmos/group/v1/group_members/{group_id},
/cosmos/group/v1/groups_by_admin/{admin},
/cosmos/group/v1/group_policies_by_group/{group_id},
/cosmos/group/v1/group_policies_by_admin/{admin},
/cosmos/group/v1/proposal/{proposal_id},
/cosmos/group/v1/proposals_by_group_policy/{address},
/cosmos/group/v1/vote_by_proposal_voter/{proposal_id}/{voter},
/cosmos/group/v1/votes_by_proposal/{proposal_id},
/cosmos/group/v1/votes_by_voter/{voter},
/cosmos/group/v1/groups_by_member/{address},
/cosmos/group/v1/proposals/{proposal_id}/tally,
/cosmos/nft/v1beta1/balance/{owner}/{class_id},
/cosmos/nft/v1beta1/owner/{class_id}/{id},
/cosmos/nft/v1beta1/supply/{class_id},
/cosmos/nft/v1beta1/nfts,
/cosmos/nft/v1beta1/nfts/{class_id}/{id},
/cosmos/nft/v1beta1/classes/{class_id},
/cosmos/nft/v1beta1/classes,
/cosmos/params/v1beta1/subspaces,
/cosmos/upgrade/v1beta1/module_versions,
/cosmos/upgrade/v1beta1/authority,
/cosmos/base/tendermint/v1beta1/node_info,
/cosmos/base/tendermint/v1beta1/syncing,
/cosmos/params/v1beta1/params,
/syncing,
/blocks/latest,
/blocks/{height},
/validatorsets/latest,
/validatorsets/{height},
/wasm/code,
/wasm/code/{codeID},
/wasm/code/{codeID}/contracts,
/wasm/contract/{contractAddress},
/wasm/contract/{contractAddress}/code-hash,
/wasm/contract/{contractAddress}/query/{query},
/wasm/code/{codeID}/hash,
/reg/consensus-io-exch-pubkey
API querying
Request example
- Tendermint JSON-RPC
- Tendermint REST
- Cosmos REST
curl -X POST https://rpc.ankr.com/scrt \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "block",
"params": ["1"],
"id": 1
}'
curl https://rpc.ankr.com/http/scrt/block?height=1
curl https://rpc.ankr.com/http/scrt_cosmos/cosmos/base/tendermint/v1beta1/blocks/{height}
Response example
{
"id": 0,
"jsonrpc": "2.0",
"result": {
"block_id": {
"hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
"parts": {
"total": 1,
"hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
}
},
"block": {
"header": {
"version": {
"block": "10",
"app": "0"
},
"chain_id": "cosmoshub-2",
"height": "12",
"time": "2019-04-22T17:01:51.701356223Z",
"last_block_id": {
"hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
"parts": {
"total": 1,
"hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
}
},
"last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812",
"data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73",
"validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
"next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
"consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8",
"app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C",
"last_results_hash": "",
"evidence_hash": "",
"proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E"
},
"data": [
"yQHwYl3uCkKoo2GaChRnd+THLQ2RM87nEZrE19910Z28ABIUWW/t8AtIMwcyU0sT32RcMDI9GF0aEAoFdWF0b20SBzEwMDAwMDASEwoNCgV1YXRvbRIEMzEwMRCd8gEaagom61rphyEDoJPxlcjRoNDtZ9xMdvs+lRzFaHe2dl2P5R2yVCWrsHISQKkqX5H1zXAIJuC57yw0Yb03Fwy75VRip0ZBtLiYsUqkOsPUoQZAhDNP+6LY+RUwz/nVzedkF0S29NZ32QXdGv0="
],
"evidence": [
{
"type": "string",
"height": 0,
"time": 0,
"total_voting_power": 0,
"validator": {
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "A6DoBUypNtUAyEHWtQ9bFjfNg8Bo9CrnkUGl6k6OHN4="
},
"voting_power": 0,
"address": "string"
}
}
],
"last_commit": {
"height": 0,
"round": 0,
"block_id": {
"hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
"parts": {
"total": 1,
"hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
}
},
"signatures": [
{
"type": 2,
"height": "1262085",
"round": 0,
"block_id": {
"hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
"parts": {
"total": 1,
"hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
}
},
"timestamp": "2019-08-01T11:39:38.867269833Z",
"validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F",
"validator_index": 0,
"signature": "DBchvucTzAUEJnGYpNvMdqLhBAHG4Px8BsOBB3J3mAFCLGeuG7uJqy+nVngKzZdPhPi8RhmE/xcw/M9DOJjEDg=="
}
]
}
}
}
}
Sei
Available for Freemium and Premium users.
Sei API is available on Web3 API platform.
Sei is a general purpose, open-source Layer 1 blockchain specialized for the exchange of digital assets. Sei has only one value prop: exchange apps — whether it’s an NFT marketplace or gaming economy — Sei offers the best user experience to build upon.
Official quick links: Website, Docs, GitHub
Networks
- Mainnet:
- EVM JSON-RPC (
HTTPSandWSS) - Tendermint JSON-RPC (
HTTPSandWSS) - Tendermint REST (
HTTPS) - Cosmos REST (
HTTPS) - Cosmos gRPC (
HTTPS)
- EVM JSON-RPC (
API methods
For Sei, we support blockchain interaction via all the applicable methods except for those listed as unsupported.
Unsupported
This section contains a list of methods we don't support for Premium service plan.
If you require any of the methods from the list, contact our Sales (sales@ankr.com) about moving to the Enterprise service plan that can provide the services tailored to your specific needs.
EVM JSON-RPC:
HTTPS:
eth_newFilter, eth_getFilterChanges, eth_coinbase, eth_hashrate, eth_mining, eth_getWork,eth_submitWork, eth_submitHashrate, net_peerCount, eth_newBlockFilter, eth_newPendingTransactionFilter, eth_uninstallFilter, eth_getFilterLogs,
debug_* (exception: debug_traceBlockByHash, debug_traceBlockByNumber, debug_traceTransaction, debug_traceCall, debug_traceBlock),
personal_*, admin_*, clique_*, les_*, miner_*, engine_*, parity_*
WSS:
txpool_content, txpool_inspect, txpool_status, txpool_contentFrom
Tendermint (both for REST and JSON-RPC):
/health,
/genesis,
/broadcast_evidence,
/dial_seeds,
/dial_peers,
/remove_tx
API querying
Request example (EVM)
curl -X POST https://rpc.ankr.com/sei_evm/{your_token} \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}'
Response example (EVM)
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x4190ab00"
}
Request example (Tendermint/Cosmos)
- Tendermint JSON-RPC
- Tendermint REST
- Cosmos REST
curl -X POST https://rpc.ankr.com/sei/{your_token} \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "block",
"params": ["1"],
"id": 1
}'
curl https://rpc.ankr.com/premium-http/sei/{your_token}/block?height=1
curl https://rpc.ankr.com/premium-http/sei_cosmos/{your_token}/cosmos/base/tendermint/v1beta1/blocks/{height}
Response example (Tendermint/Cosmos)
{
"id": 0,
"jsonrpc": "2.0",
"result": {
"block_id": {
"hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
"parts": {
"total": 1,
"hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
}
},
"block": {
"header": {
"version": {
"block": "10",
"app": "0"
},
"chain_id": "cosmoshub-2",
"height": "12",
"time": "2019-04-22T17:01:51.701356223Z",
"last_block_id": {
"hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
"parts": {
"total": 1,
"hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
}
},
"last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812",
"data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73",
"validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
"next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
"consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8",
"app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C",
"last_results_hash": "",
"evidence_hash": "",
"proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E"
},
"data": [
"yQHwYl3uCkKoo2GaChRnd+THLQ2RM87nEZrE19910Z28ABIUWW/t8AtIMwcyU0sT32RcMDI9GF0aEAoFdWF0b20SBzEwMDAwMDASEwoNCgV1YXRvbRIEMzEwMRCd8gEaagom61rphyEDoJPxlcjRoNDtZ9xMdvs+lRzFaHe2dl2P5R2yVCWrsHISQKkqX5H1zXAIJuC57yw0Yb03Fwy75VRip0ZBtLiYsUqkOsPUoQZAhDNP+6LY+RUwz/nVzedkF0S29NZ32QXdGv0="
],
"evidence": [
{
"type": "string",
"height": 0,
"time": 0,
"total_voting_power": 0,
"validator": {
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "A6DoBUypNtUAyEHWtQ9bFjfNg8Bo9CrnkUGl6k6OHN4="
},
"voting_power": 0,
"address": "string"
}
}
],
"last_commit": {
"height": 0,
"round": 0,
"block_id": {
"hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
"parts": {
"total": 1,
"hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
}
},
"signatures": [
{
"type": 2,
"height": "1262085",
"round": 0,
"block_id": {
"hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
"parts": {
"total": 1,
"hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
}
},
"timestamp": "2019-08-01T11:39:38.867269833Z",
"validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F",
"validator_index": 0,
"signature": "DBchvucTzAUEJnGYpNvMdqLhBAHG4Px8BsOBB3J3mAFCLGeuG7uJqy+nVngKzZdPhPi8RhmE/xcw/M9DOJjEDg=="
}
]
}
}
}
}
Solana
Available for Freemium and Premium users.
Solana API is available on Web3 API platform.
Solana is a decentralized blockchain built to enable scalable, user-friendly apps for the world.
Official quick links: Website, Docs, GitHub
Networks
- Mainnet (
HTTPSandWSS) - Devnet (
HTTPSandWSS)
API methods
For Solana, we support blockchain interaction via all the applicable methods except for those listed as unsupported.
Unsupported
This section contains a list of methods we don't support for Premium service plan.
If you require any of the methods from the list, contact our Sales (sales@ankr.com) about moving to the Enterprise service plan that can provide the services tailored to your specific needs.
getLargestAccounts
API querying
Request example
curl -X POST https://rpc.ankr.com/solana_devnet/{your_token} \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "getAccountInfo",
"params": [
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
{
"encoding": "base58"
}
],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"context": {
"apiVersion": "2.2.3",
"slot": 374628996
},
"value": {
"data": [
"",
"base58"
],
"executable": false,
"lamports": 88860054690252,
"owner": "11111111111111111111111111111111",
"rentEpoch": 18446744073709551615,
"space": 0
}
}
}
Somnia
Somnia API is available on Web3 API platform.
Somnia is a high-performance, cost-efficient EVM-compatible Layer 1 blockchain capable of processing over 1,000,000 transactions per second (TPS) with sub-second finality. It is suitable for serving millions of users and building real-time mass-consumer applications like games, social applications, metaverses, and more, all fully on-chain.
Key Features:
- Accelerated Sequential Execution: through compiled EVM bytecode.
- IceDB: a faster, more predictable database for storing blockchain state.
- MultiStream consensus: a Proof-of-Stake, partially synchronous BFT protocol inspired by Autobahn BFT.
- Advanced compression techniques: to deal with increased node-to-node data traffic due to the throughput.
Official quick links: Website, Docs
Networks
- Testnet (
HTTPSandWSS)
API methods
For Somnia, we support blockchain interaction via all the applicable methods except for those listed as unsupported.
Unsupported
This section contains a list of methods we don't support for Premium service plan.
If you require any of the methods from the list, contact our Sales (sales@ankr.com) about moving to the Enterprise service plan that can provide the services tailored to your specific needs.
HTTPS:
eth_newFilter, eth_getFilterChanges, eth_coinbase, eth_hashrate, eth_mining, eth_getWork,eth_submitWork, eth_submitHashrate, net_peerCount, eth_newBlockFilter, eth_newPendingTransactionFilter, eth_uninstallFilter, eth_getFilterLogs,
debug_* (exception: debug_traceBlockByHash, debug_traceBlockByNumber, debug_traceTransaction, debug_traceCall, debug_traceBlock),
personal_*, admin_*, clique_*, les_*, miner_*, engine_*, parity_*
WSS:
txpool_content, txpool_inspect, txpool_status, txpool_contentFrom
API querying
Request example
- cURL
- Golang
- Web3.JS
- Python
curl -X POST https://rpc.ankr.com/somnia_testnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
package main
import (
"context"
"fmt"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
const url = "https://rpc.ankr.com/somnia_testnet" // url string
rpcClient,err := ethclient.Dial(url)
if err != nil {
panic(err)
}
blockNumber, err := rpcClient.BlockNumber(context.Background())
if err != nil {
panic(err)
}
fmt.Println(blockNumber)
}
const Web3 = require('web3');
const url = 'https://rpc.ankr.com/somnia_testnet' // url string
const web3 = new Web3(new Web3.providers.HttpProvider(url));
web3.eth.getBlockNumber((error, blockNumber) => {
if(!error) {
console.log(blockNumber);
} else {
console.log(error);
}
});
from web3 import Web3
def test_block_number(self):
url = 'https://rpc.ankr.com/somnia_testnet' # url string
web3 = Web3(HTTPProvider(url))
print(web3.eth.block_number)
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x6d1d8b"
}
Sonic
Sonic API is available on Web3 API platform.
Sonic is an EVM-compatible Layer 1 blockchain designed to deliver high-speed, low-latency transactions, aiming to process over 10,000 transactions per second with sub-second finality.
Key Features of Sonic:
- High Throughput and Speed: Sonic achieves transaction finality in approximately 720 milliseconds, positioning it among the fastest EVM-compatible blockchains.
- Developer Incentives: The platform offers attractive incentives, including a fee monetization program that allows developers to earn up to 90% of the fees generated by their applications.
- EVM Compatibility: Sonic's compatibility with the Ethereum Virtual Machine enables seamless deployment of existing Ethereum-based decentralized applications (dApps) without significant modifications.
- Secure Ethereum Gateway: Sonic provides a secure bridge to Ethereum, facilitating easy access to Ethereum's liquidity and assets while maintaining high transaction speeds and low costs.
Official quick links: Website, Docs, GitHub
Networks
- Mainnet (
HTTPSandWSS) - Testnet (
HTTPSandWSS)
API methods
For Sonic, we support blockchain interaction via all the applicable methods except for those listed as unsupported.
Unsupported
This section contains a list of methods we don't support for Premium service plan.
If you require any of the methods from the list, contact our Sales (sales@ankr.com) about moving to the Enterprise service plan that can provide the services tailored to your specific needs.
HTTPS:
eth_newFilter, eth_getFilterChanges, eth_coinbase, eth_hashrate, eth_mining, eth_getWork,eth_submitWork, eth_submitHashrate, net_peerCount, eth_newBlockFilter, eth_newPendingTransactionFilter, eth_uninstallFilter, eth_getFilterLogs,
debug_* (exception: debug_traceBlockByHash, debug_traceBlockByNumber, debug_traceTransaction, debug_traceCall, debug_traceBlock),
personal_*, admin_*, clique_*, les_*, miner_*, engine_*, parity_*
WSS:
txpool_content, txpool_inspect, txpool_status, txpool_contentFrom
API querying
Request example
- cURL
- Golang
- Web3.JS
- Python
curl -X POST https://rpc.ankr.com/sonic_mainnet \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
package main
import (
"context"
"fmt"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
const url = "https://rpc.ankr.com/sonic_mainnet" // url string
rpcClient,err := ethclient.Dial(url)
if err != nil {
panic(err)
}
blockNumber, err := rpcClient.BlockNumber(context.Background())
if err != nil {
panic(err)
}
fmt.Println(blockNumber)
}
const Web3 = require('web3');
const url = 'https://rpc.ankr.com/sonic_mainnet' // url string
const web3 = new Web3(new Web3.providers.HttpProvider(url));
web3.eth.getBlockNumber((error, blockNumber) => {
if(!error) {
console.log(blockNumber);
} else {
console.log(error);
}
});
from web3 import Web3
def test_block_number(self):
url = 'https://rpc.ankr.com/sonic_mainnet' # url string
web3 = Web3(HTTPProvider(url))
print(web3.eth.block_number)
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x51008"
}