Quickstart
Get your first blockchain API call running in under 5 minutes.
1
Sign Up and Get Your API Key
Create a free Bootnode account at dashboard.bootnode.dev. After signing up, navigate to Settings → API Keys and create a new key. Copy it -- you will need it for every request.
Your API key will look like this:
bn_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p62
Make Your First RPC Call
Use curl to call eth_blockNumber on Ethereum mainnet. This returns the latest block number in hexadecimal.
curl -X POST https://api.bootnode.dev/v1/rpc/ethereum/mainnet \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_blockNumber",
"params": []
}'Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x13a5e7f"
}3
Install the SDK
For TypeScript and JavaScript projects, install the official SDK:
npm install @bootnode/sdkOr with other package managers:
# yarn
yarn add @bootnode/sdk
# pnpm
pnpm add @bootnode/sdk
# bun
bun add @bootnode/sdk4
Use the SDK in TypeScript
Here is a complete TypeScript example that fetches the latest block number, gets an ETH balance, and retrieves ERC-20 token balances for a wallet.
import { Bootnode } from "@bootnode/sdk";
const client = new Bootnode({
apiKey: process.env.BOOTNODE_API_KEY!,
});
// 1. Get the latest block number via JSON-RPC
async function getBlockNumber(): Promise<string> {
const response = await client.rpc("ethereum", "mainnet", {
jsonrpc: "2.0",
id: 1,
method: "eth_blockNumber",
params: [],
});
return response.result; // e.g. "0x13a5e7f"
}
// 2. Get ETH balance using JSON-RPC
async function getBalance(address: string): Promise<string> {
const response = await client.rpc("ethereum", "mainnet", {
jsonrpc: "2.0",
id: 1,
method: "eth_getBalance",
params: [address, "latest"],
});
return response.result; // wei in hex, e.g. "0x6f05b59d3b20000"
}
// 3. Get ERC-20 token balances via Token API
async function getTokenBalances(address: string) {
const balances = await client.tokens.getBalances("ethereum", address);
return balances;
// Returns: [{ contract: "0xa0b8...", symbol: "USDC", balance: "1500.00", ... }]
}
async function main() {
const blockNumber = await getBlockNumber();
console.log("Latest block:", parseInt(blockNumber, 16));
const address = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
const balance = await getBalance(address);
console.log("ETH balance (wei):", BigInt(balance).toString());
const tokens = await getTokenBalances(address);
console.log("Token balances:", tokens);
}
main();5
Using Fetch Directly
You do not need the SDK. Every Bootnode API is a standard REST or JSON-RPC endpoint. Here is a plain fetch example:
const API_KEY = process.env.BOOTNODE_API_KEY;
const BASE_URL = "https://api.bootnode.dev/v1";
// JSON-RPC call
async function ethBlockNumber(): Promise<number> {
const res = await fetch(`${BASE_URL}/rpc/ethereum/mainnet`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": API_KEY!,
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "eth_blockNumber",
params: [],
}),
});
if (!res.ok) {
throw new Error(`HTTP ${res.status}: ${await res.text()}`);
}
const data = await res.json();
return parseInt(data.result, 16);
}
// REST API call - get token balances
async function getTokenBalances(address: string) {
const res = await fetch(
`${BASE_URL}/tokens/ethereum/balances/${address}`,
{
headers: { "X-API-Key": API_KEY! },
}
);
if (!res.ok) {
throw new Error(`HTTP ${res.status}: ${await res.text()}`);
}
return res.json();
}
// Usage
const blockNum = await ethBlockNumber();
console.log("Block:", blockNum);
const tokens = await getTokenBalances(
"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
);
console.log("Tokens:", tokens);