Getting Started for Users

This guide will walk you through using FlameWire to access decentralized JSON-RPC endpoints for Bittensor, Ethereum (coming soon), and Sui (coming soon).

Create an Account & API Key

  1. Sign in at FlameWire App via Google Auth
  2. After signing in, the API Key creation modal opens automatically
  3. Enter a name for your key (e.g., "My dApp")
  4. Copy and securely store your API key

Security

Keep your API key secure. Do not expose it in client-side code or public repositories.

Try the RPC Playground

Before writing any code, you can test some of the most common RPC methods using our interactive RPC Playground. Select a network, choose a method, configure parameters, and execute requests directly in your browser.

Make JSON-RPC Requests

Send requests to the FlameWire gateway. Requests are automatically routed to the fastest, nearest node for optimal performance.

HTTP Requests

Use standard HTTP POST requests for simple, stateless RPC calls.

Endpoint Format

For authenticated requests (with your API key):

https://gateway-dev.flamewire.io/public/rpc/{chain}/{api-key}

For non-authenticated requests (uses free-tier allowance):

https://gateway-dev.flamewire.io/public/rpc/{chain}

cURL Example

curl -X POST https://gateway-dev.flamewire.io/public/rpc/bittensor/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "system_health",
    "params": []
  }'

JavaScript Example

async function makeRpcCall() {
  const response = await fetch(
    'https://gateway-dev.flamewire.io/public/rpc/bittensor/YOUR_API_KEY',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'system_health',
        params: [],
      }),
    }
  );

  const data = await response.json();
  console.log(data);
}

makeRpcCall();

WebSocket Requests

Use WebSocket (WSS) for persistent connections, real-time subscriptions, or to reduce connection overhead for multiple requests.

Endpoint Format

For authenticated connections (with your API key):

wss://gateway-dev.flamewire.io/public/rpc/{chain}/{api-key}

For non-authenticated connections (uses free-tier allowance):

wss://gateway-dev.flamewire.io/public/rpc/{chain}

Node.js Example

In Node.js, install the ws package first:

npm install ws
const WebSocket = require('ws');

const ws = new WebSocket(
  'wss://gateway-dev.flamewire.io/public/rpc/bittensor/YOUR_API_KEY'
);

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

ws.on('message', (data) => {
  const response = JSON.parse(data.toString());
  console.log('Response:', response);
  ws.close();
});

ws.on('error', (error) => {
  console.error('WebSocket error:', error.message);
});

ws.on('unexpected-response', (_req, res) => {
  let body = '';
  res.on('data', (chunk) => {
    body += chunk;
  });
  res.on('end', () => {
    console.error('Server response:', res.statusCode);
    try {
      console.error('Body:', JSON.parse(body));
    } catch {
      console.error('Body:', body);
    }
    process.exit(1);
  });
});

Subscription Example

WebSocket connections are ideal for subscriptions that push real-time updates:

const WebSocket = require('ws');

const ws = new WebSocket(
  'wss://gateway-dev.flamewire.io/public/rpc/bittensor/YOUR_API_KEY'
);

ws.on('open', () => {
  // Subscribe to new block headers
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'chain_subscribeNewHeads',
    params: [],
  }));
});

ws.on('message', (data) => {
  const response = JSON.parse(data.toString());

  // First response contains the subscription ID
  if (response.result) {
    console.log('Subscription ID:', response.result);
  }

  // Subsequent messages contain new block headers
  if (response.params) {
    console.log('New block:', response.params.result);
  }
});

ws.on('error', (error) => {
  console.error('WebSocket error:', error.message);
});

ws.on('unexpected-response', (_req, res) => {
  let body = '';
  res.on('data', (chunk) => {
    body += chunk;
  });
  res.on('end', () => {
    console.error('Server response:', res.statusCode);
    try {
      console.error('Body:', JSON.parse(body));
    } catch {
      console.error('Body:', body);
    }
    process.exit(1);
  });
});

Connection Management

WebSocket connections may be closed after periods of inactivity. Implement reconnection logic in production applications.

Supported Chains

ChainStatusChain Parameter
BittensorLivebittensor
EthereumComing Soonethereum
SuiComing Soonsui

Monitor Your Usage

Track your credit balance and usage through the dashboard:

  • Billing — View your available and reserved credits
  • Usage — Track how credits are being spent per API key

Billing & Credits

JSON-RPC calls consume credits from your account. The credit cost varies based on the complexity of the RPC method called.

  • Free tier — New users receive free credits to get started
  • Pay-as-you-go — Purchase additional credits as needed