# FLOP RPC Documentation

## FLOP RPC plans and rate limits

- **Free plan:** 20 responses per second, up to 100,000 responses a day.
- **Plans:** $49/mo, $299/mo, $999/mo with 25M, 150M, and 500M included responses. Overages billed at $5/$3/$2 per million responses respectively.
- **Paid rate limits:** 100 to 5,000 responses per second (bursts from 500 to 10,000), no daily limit.
- **Billing:** 1 response = 1 API credit on every shared plan, over HTTPS or WebSocket (WSS) where FLOP supports it.

Details: [Pricing](https://www.dwellir.com/docs/getting-started/pricing) · [Rate limits](https://www.dwellir.com/docs/getting-started/rate-limits) · [Authentication](https://www.dwellir.com/docs/getting-started/authentication) · [Archive nodes](https://www.dwellir.com/docs/getting-started/archive-nodes)

## Overview

FLOP is a Substrate Layer 1 blockchain built for the agentic economy. Autonomous AI agents pay GPU miners in FLOP to execute inference sessions verified through Proof of Inference (PoI), TOPLOC activation commitments, and co-signed transcripts. The network uses BABE for 1-second block authoring and AlephBFT for finality, with no general-purpose smart contract VM.

Dwellir operates redundant FLOP Testnet archive nodes in Sweden over HTTPS and WebSocket. Both nodes keep full historical blocks and state from genesis with flat billing: 1 response equals 1 API credit, including archive state queries and subscriptions.

## Network Information

### Testnet (FLOP Testnet)

| Parameter    | Value                                                                | Details                                       |
| ------------ | -------------------------------------------------------------------- | --------------------------------------------- |
| Chain Name   | `FLOP Testnet`                                                       | Spec ID `flop_testnet`                        |
| Genesis Hash | `0x918abd58fb16306b30ef3886514cfaebffecb4de43e82b6f8ec4795c43cfd800` | Block 0                                       |
| Native Token | `FLOP`                                                               | 18 decimals, SS58 prefix `42`                 |
| Block Time   | 1 second                                                             | BABE authoring, 2 MB block limit              |
| Finality     | AlephBFT                                                             | Not GRANDPA or BEEFY                          |
| Node Mode    | Archive                                                              | Full historical blocks and state from genesis |
| Explorer     | [testnet.flopscan.io](https://testnet.flopscan.io/)                  | Official FLOP Testnet explorer                |
| Faucet       | [faucet.flop.network](https://faucet.flop.network)                   | Testnet FLOP faucet                           |

## Connection Endpoints

Use `https://api-flop-testnet.n.dwellir.com/YOUR_API_KEY` for HTTPS JSON-RPC requests and `wss://api-flop-testnet.n.dwellir.com/YOUR_API_KEY` for WebSocket subscriptions and JSON-RPC v2 streaming calls.

## Authentication

Pass your API key in the URL path. Replace `YOUR_API_KEY` with an API key from [dashboard.dwellir.com](https://dashboard.dwellir.com).

## API Reference

Every generated method page above is verified live against Dwellir's FLOP Testnet archive nodes. Because FLOP uses AlephBFT finality instead of GRANDPA or BEEFY, `grandpa_roundState` and `beefy_getFinalizedHead` do not exist on FLOP nodes. Node administration methods such as `author_rotateKeys`, `author_insertKey`, `system_peers`, and `state_traceBlock` are disabled externally under safe RPC mode.

## Additional Safe Methods Exposed by FLOP Nodes

Beyond the 23 core Substrate method pages in the sidebar, Dwellir's FLOP Testnet nodes expose all safe Substrate JSON-RPC v2 APIs and FLOP runtime RPCs. Call `rpc_methods` at any time to inspect the full list.

### Substrate JSON-RPC v2 Archive (`archive_v1_*`)

Query historical blocks, bodies, runtime calls, and storage from genesis using the modern Substrate archive specification.

- **HTTPS or WSS:** `archive_v1_genesisHash`, `archive_v1_finalizedHeight`, `archive_v1_hashByHeight`, `archive_v1_header`, `archive_v1_body`, `archive_v1_call`
- **WebSocket streaming:** `archive_v1_storage`, `archive_v1_stopStorage`, `archive_v1_storageDiff`, `archive_v1_storageDiff_stopStorageDiff`

### Substrate JSON-RPC v2 ChainSpec (`chainSpec_v1_*`)

- `chainSpec_v1_chainName` (returns `"FLOP Testnet"`)
- `chainSpec_v1_genesisHash` (returns `"0x918abd58fb16306b30ef3886514cfaebffecb4de43e82b6f8ec4795c43cfd800"`)
- `chainSpec_v1_properties` (returns `{"ss58Format": 42, "tokenDecimals": 18, "tokenSymbol": "FLOP"}`)

### Substrate JSON-RPC v2 ChainHead & Transactions (WebSocket)

- **ChainHead:** `chainHead_v1_follow`, `chainHead_v1_unfollow`, `chainHead_v1_header`, `chainHead_v1_body`, `chainHead_v1_storage`, `chainHead_v1_call`, `chainHead_v1_continue`, `chainHead_v1_stopOperation`, `chainHead_v1_unpin`
- **Transaction broadcast and watch:** `transaction_v1_broadcast`, `transaction_v1_stop`, `transactionWatch_v1_submitAndWatch`, `transactionWatch_v1_unwatch`

### FLOP Runtime & Verification RPCs

- **Atomic swaps (HTLC):** `hasStation_checkHTLCStatus`, `hasStation_getHtlcByHashLock`
- **Aggregation & data retrieval:** `aggregate_statementPath`, `bitswap_v1_get`
- **Verification key hashing:** `vk_hash_ezkl`, `vk_hash_fflonk`, `vk_hash_groth16`, `vk_hash_plonky2`, `vk_hash_risc0`, `vk_hash_sp1`, `vk_hash_ultrahonk`, `vk_hash_ultraplonk`

### Additional Safe Substrate Methods

- **Account nonces:** `account_nextIndex`, `system_accountNextIndex`
- **System & node metadata:** `system_chainType`, `system_syncState`, `system_nodeRoles`, `system_localPeerId`, `system_localListenAddresses`, `system_reservedPeers`
- **Chain aliases & subscriptions:** `chain_getHead`, `chain_getFinalisedHead`, `chain_getRuntimeVersion`, `chain_subscribeAllHeads`, `chain_subscribeNewHead`, `chain_subscribeFinalisedHeads`, `chain_subscribeRuntimeVersion`, `subscribe_newHead` (plus matching `unsubscribe_*` methods and `author_unwatchExtrinsic`)
- **State & storage proofs:** `state_getKeys`, `state_callAt`, `state_getKeysPagedAt`, `state_getReadProof`, `state_getStorageAt`, `state_getStorageHash`, `state_getStorageHashAt`, `state_getStorageSize`, `state_getStorageSizeAt`, `state_getChildReadProof`, `state_subscribeRuntimeVersion`, `state_subscribeStorage` (plus `state_unsubscribe*`)
- **Child storage:** `childstate_getKeys`, `childstate_getKeysPaged`, `childstate_getKeysPagedAt`, `childstate_getStorage`, `childstate_getStorageEntries`, `childstate_getStorageHash`, `childstate_getStorageSize`

## Quick Start Examples

### Check Chain Identity and Genesis Hash (cURL)

```bash
curl -s "https://api-flop-testnet.n.dwellir.com/YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"chainSpec_v1_properties","params":[]}'
```

Expected response:

```json
{"jsonrpc":"2.0","id":1,"result":{"ss58Format":42,"tokenDecimals":18,"tokenSymbol":"FLOP"}}
```

### Query Historical Archive State at Block 1 (cURL)

Verify historical state at block 1 (`0x33cb4ba72b743fe7d82e581aeac97dd7108b5dfbf87c84a624e943379a33a96e`) by reading `System.Number`:

```bash
curl -s "https://api-flop-testnet.n.dwellir.com/YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "state_getStorage",
    "params": [
      "0x26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac",
      "0x33cb4ba72b743fe7d82e581aeac97dd7108b5dfbf87c84a624e943379a33a96e"
    ]
  }'
```

Expected response (`0x01000000`, little-endian u32 `1`):

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

### Subscribe to Finalized Heads Over WebSocket (Node.js)

```javascript
const ws = new WebSocket('wss://api-flop-testnet.n.dwellir.com/YOUR_API_KEY');

ws.onopen = () => {
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'chain_subscribeFinalizedHeads',
    params: [],
  }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.method === 'chain_finalizedHead') {
    const height = parseInt(msg.params.result.number, 16);
    console.log('Finalized block:', height);
  }
};
```

### Connect with `@polkadot/api`

```javascript
import { ApiPromise, WsProvider } from '@polkadot/api';

const provider = new WsProvider('wss://api-flop-testnet.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });

const [chain, finalizedHash] = await Promise.all([
  api.rpc.system.chain(),
  api.rpc.chain.getFinalizedHead(),
]);

const header = await api.rpc.chain.getHeader(finalizedHash);
console.log(`${chain} finalized at #${header.number.toNumber()}`);
await api.disconnect();
```
