Skip to main content
In this quickstart you read the latest BOT Chain block number with @uzolabs/sdk and viem. It takes about two minutes and needs no wallet.
Early release. This is published in @uzolabs/sdk 0.2.0 on npm and you can use it today. The API may change before 1.0, so pin the version.
Everything on this page uses testnet (chain 968). Get free test tokens from the faucet.

What you’ll build

A script that connects to BOT Chain testnet and prints the latest block number. You’ll also see the same script written without the SDK, which shows exactly what the SDK saves you.

Prerequisites

  • Node.js 18 or later.

Steps

1

Create a project

2

Write the script

read-block.ts
botChainTestnet includes the chain ID, RPC URL, explorer and Multicall3 address, so you don’t need to pass a URL to http().
3

Run it

Verify it worked

Output from a run on 2026-10-02:
Output
You’ll see a higher block number. If you run the script again, the number goes up. To read mainnet instead, import botChain.

The same script without the SDK

If you can’t add a dependency, you can define the chain yourself with viem’s defineChain. These are the same values the SDK exports:
read-block-viem.ts
It prints the same line. The downside is that you now maintain these values yourself. If an address or URL changes, you have to update it by hand in every project.

Troubleshooting

The public testnet RPC is sometimes slow or briefly unavailable. Wait a few seconds and try again. See Known limitations.
Run npm pkg set type=module, or rename the file to read-block.mts.

Next steps

Contract addresses

Read a BDEX quote with typed addresses.

Explorer client

Look up contracts on BOTScan.
Last modified on October 2, 2026