Blockchain Queries

The ToroForge Node.js SDK provides access to on-chain data from the Toronet blockchain โ€” allowing developers to build block explorers, track transactions, and monitor network health in real time.


๐Ÿงพ What You Can Query

  • Latest blockchain status

  • Most recent block data

  • Recent on-chain transactions

  • Historical block information

  • Current exchange rates for supported tokens


๐Ÿ“Ÿ Get Blockchain Status

Returns general metadata about the current blockchain state.

import { getBlockchainStatus } from 'torosdk';

const status = await getBlockchainStatus();

console.log(status);
/*
{
  lastblock: '45021',
  peers: 4,
  pendingtx: 2,
  status: 'online'
}
*/

โ›“๏ธ Get Latest Block Data

Retrieve metadata about the most recent block.

import { getLatestBlockData } from 'torosdk';

const latestBlock = await getLatestBlockData();

๐Ÿ“ฆ Get Recent Transactions

Get a list of the most recent blockchain transactions.

import { getBlockchainTransactions } from 'torosdk';

const transactions = await getBlockchainTransactions(10); // Fetch last 10 txs

๐Ÿ“š Get Historical Block Data

Query any specific number of recent blocks.

import { getBlocksData } from 'torosdk';

const blocks = await getBlocksData(5); // Last 5 blocks

Each block includes details such as:

  • Timestamp

  • Block height

  • Transactions

  • Hashes

  • Block creator


๐Ÿ’ฑ Get Exchange Rates

Returns the latest known exchange rates between fiat and ToroG.

import { getSupportedAssetsExchangeRates } from 'torosdk';

const rates = await getSupportedAssetsExchangeRates();

Example response:

{
  NGN: 1,
  USD: 0.014,
  KSH: 1.85
}

Use this data to:

  • Display fiat โ†’ token conversion

  • Calculate deposits or rewards

  • Validate exchange values


๐Ÿง  Use Cases

  • Build a block explorer interface

  • Display live block activity on dashboards

  • Provide transaction history inside user apps

  • Integrate real-time token pricing


โš ๏ธ Tips

  • Always implement retry or fallback logic โ€” nodes may rate-limit requests.

  • You may cache block results to avoid unnecessary network calls in frontend apps.

  • Use getBlockchainTransactions only when you need general network activity (not tied to a specific address).


Last updated