Core Endpoints

Complete reference for Tokra's main API endpoints including balance queries, transactions, and blocks.

Get Account Balance

POST /v1/{chain}/{network}

Parameters: address (string), block (string, default: "latest")

Response:

{
  "jsonrpc": "2.0",
  "result": "0x1bc16d674ec80000",
  "id": 1
}
```

**Get Transaction**
```
POST /v1/{chain}/{network}

Parameters: hash (string)

Response:

{
  "result": {
    "hash": "0xab12...",
    "from": "0x742d...",
    "to": "0x8f3c...",
    "value": "0x16345785d8a0000",
    "blockNumber": "0x12a4f2c"
  }
}
```

**Get Block**
```
POST /v1/{chain}/{network}
```
Parameters: `blockNumber` (string/number), `fullTransactions` (boolean)

**Get Transaction Receipt**
```
POST /v1/{chain}/{network}
```
Parameters: `hash` (string)

**Send Raw Transaction**
```
POST /v1/{chain}/{network}
```
Parameters: `signedTransaction` (string)

---

## WebSockets

Real-time blockchain data via WebSocket connections. Subscribe to new blocks, pending transactions, or smart contract events.

**Connect to WebSocket:**
```
wss://ws.tokra.io/v1/{chain}/{network}?apikey=YOUR_API_KEY

Subscription Types:

  1. New Blocks - Receive each new block as it's mined

  2. Pending Transactions - Stream pending txs from mempool

  3. Logs - Subscribe to smart contract events

Example:

const ws = new WebSocket('wss://ws.tokra.io/v1/eth/mainnet?apikey=tk_live_abc123');

ws.onopen = () => {
  ws.send(JSON.stringify({
    method: 'eth_subscribe',
    params: ['newHeads']
  }));
};

ws.onmessage = (event) => {
  const block = JSON.parse(event.data);
  console.log('New block:', block.params.result.number);
};

Create a free website with Framer, the website builder loved by startups, designers and agencies.