Build on Tuven
Build with JSON-RPC
Read state, estimate gas, and follow transactions with familiar EVM interfaces.
Tuven exposes Ethereum-compatible JSON-RPC through its public endpoint. Common reads include eth_chainId, eth_blockNumber, eth_getBalance, eth_getCode, eth_call, eth_getTransactionReceipt, and eth_getLogs. Availability of optional namespaces depends on the RPC service.
Connect with viem
import { createPublicClient, defineChain, http, formatEther } from 'viem';
const tuven = defineChain({
id: 99359,
name: 'Tuven',
nativeCurrency: { name: 'USDX', symbol: 'USDX', decimals: 18 },
rpcUrls: { default: { http: ['https://rpc.tuven.io'] } }
});
const client = createPublicClient({ chain: tuven, transport: http() });
const height = await client.getBlockNumber();
const balance = await client.getBalance({ address: '0xYourAddress' });
console.log(height, formatEther(balance));Read contracts and batch calls
Use an ABI that matches the deployed contract. Multicall3 is predeployed for batched reads, but individual calls can still revert. Handle partial failures where possible, especially when loading user-imported tokens.
Simulate before signing
Estimate gas and simulate with the intended sender. Sponsored gas behavior depends on that sender’s plan, so a simulation from an unrelated account can produce a misleading result. Verify the account and chain again immediately before requesting a signature.
Observe transaction results
A transaction hash means submission, not completion. Poll the receipt, check its status, and inspect events from the expected contract. Handle replacement and cancellation explicitly. If receipt polling times out, preserve the hash and continue checking before offering another submission.
Index efficiently
Query logs in bounded block ranges and keep a cursor. Start from a known deployment block for contract-specific history. The explorer API is useful for account token lists and transaction search, while the RPC provides current on-chain state. Display loading and unavailable states separately from a verified zero balance.