JSON-RPC Calls
When some platforms or frameworks don't have any quality web3 library or SDK, there's always the possibility to make the blockchain calls directly to the JSON-RPC methods supported by the chain.
Some of the JSON-RPC methods supported by SKALE chains are:
- eth_getBalance
- eth_blockNumber
- eth_getTransactionCount
- eth_sendTransaction
- eth_call
Implementation Example
Get Balance
import axios from 'axios';
const rpcEndpoint = 'YOUR SKALE RPC ENDPOINT';const senderAddress = '0x...';
const requestData_balance = { jsonrpc: '2.0', method: 'eth_getBalance', params: [senderAddress, 'latest'], id: 1, };
async function JSON_RPC_CALL() { try { const response = await axios.post(rpcEndpoint,requestData_balance); return console.log(response.data); } catch (error) { console.error(error); return [[],[]]; }}
JSON_RPC_CALL();
Additional JSON-RPC Calls Documentation
Click here for the official documentation.