# Bifrost Liquid Staking Parachain RPC Guide

## Bifrost 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 Bifrost 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)

## Why Build on Bifrost?

Bifrost is Polkadot's liquid staking hub, issuing omni-chain vTokens that unlock staking liquidity while keeping rewards flowing. Builders target Bifrost because it delivers:

### **Omni-Chain Liquidity Routing**

- Staking Liquidity Protocol (SLP) mints yield-bearing vTokens (vDOT, vKSM, vETH, vFIL) that stay composable across parachains and EVM networks.
- Slot Auction Liquidity Protocol (SALP) releases DOT/KSM crowdloan positions into tradable derivatives, letting users support auctions without sacrificing liquidity.
- Liquid staking primitives integrate with major DeFi venues (Pendle, Loop Stake, Talisman, etc.) to optimize leverage and hedging strategies.

### **Protocol-Neutral Architecture**

- Dedicated pallets for cross-chain execution (ISMP, CrossInOut, Hyperbridge) make it easy to bridge liquidity between Polkadot, Kusama, and external EVMs.
- Governance and fee-share pallets align collators, liquidity providers, and derivative users through on-chain revenue distribution.
- Runtime upgrades (v0.21.1 / specVersion 21001) focus on async backing, Hyperbridge routes, and tokenomics 2.0 for sustained reward flows.

### **Battle-Tested Operations**

- Active collator set with \~6 s block time keeps derivatives in sync with relay-chain finality.
- Proven SALP campaigns unlock DOT crowdloans while maintaining reward accrual.
- Continuous grant support and ecosystem partnerships accelerate tooling and collateral adoption.

## Quick Start with Bifrost

Connect to mainnet or the Kusama canary network in seconds using Dwellir-managed infrastructure.

The Kusama deployment (Para ID 2001) runs identical pallets ahead of Polkadot releases. Use it for SALP dry-runs, Hyperbridge testing, and upgrade rehearsals before promoting to mainnet Para ID 2030.

### Installation & Setup

cURL
JavaScript (polkadot.js)
Rust (subxt)
Python (py-substrate-interface)

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

**Expected output (captured 2025-10-03):**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "number": "0x9055f2",
    "hash": "0xd4b3a0e3b88b7c25215926bbf7c733f5c31e69c0c8c4b4a86d6ec3f3f086e95d",
    "parentHash": "0x65b246e9b69a61f842104a15307ae906013c56a8bb6c942555b1a71424b4bab3",
    "stateRoot": "0x220ea5bd35df99176268d8cbcee287a8a81a2e8addfa764661f71af591db0329",
    "extrinsicsRoot": "0x388e5e2bb951b1dfac3f6a3f0c1d5de1ace6e413008efe48f1a54228dcd049db"
  },
  "id": 1
}
```

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

async function main() {
  const provider = new WsProvider('wss://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY');
  const api = await ApiPromise.create({ provider });

  const [chain, nodeName, nodeVersion, runtime] = await Promise.all([
    api.rpc.system.chain(),
    api.rpc.system.name(),
    api.rpc.system.version(),
    api.rpc.state.getRuntimeVersion()
  ]);

  console.log(`Connected to ${chain.toString()} via ${nodeName.toString()} ${nodeVersion.toString()}`);
  console.log(`Runtime specVersion=${runtime.specVersion.toNumber()} transactionVersion=${runtime.transactionVersion.toNumber()}`);

  const header = await api.rpc.chain.getHeader();
  console.log(`Latest head #${header.number.toString()} (${header.hash.toHex()})`);

  await api.disconnect();
}

main().catch(console.error);
```

```rust
use subxt::{config::substrate::SubstrateConfig, OnlineClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api = OnlineClient::<SubstrateConfig>::from_url(
        "wss://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY"
    ).await?;

    let latest = api.rpc().header(None).await?.expect("header");
    println!("Finalized block #{}", latest.number);
    println!("State root {}", latest.state_root);

    Ok(())
}
```

```python
from substrateinterface import SubstrateInterface

substrate = SubstrateInterface(
    url="wss://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY",
    type_registry_preset="substrate-node-template"
)

latest_hash = substrate.get_chain_head()
print("Latest head:", latest_hash)

runtime = substrate.get_runtime_version()
print("specVersion:", runtime['specVersion'], "transactionVersion:", runtime['transactionVersion'])

account_info = substrate.query(
    module='System',
    storage_function='Account',
    params=['15mYsj6DpBno58jRoV5HCTiVPFBuWhDLdsWtq3LxwZrfaTEZ']
)
print("Collator free balance:", account_info.value['data']['free'])
```

## API Reference

Bifrost exposes the standard Substrate namespaces for node telemetry, finality, storage, extrinsic submission, and runtime metadata, alongside specialized pallets such as `Hyperbridge`, `FlexibleFee`, `Farming`, and `Ismp`.

## Network Information

| Parameter                | Bifrost (Polkadot Mainnet)                                           | Bifrost (Kusama Canary)                                              |
| ------------------------ | -------------------------------------------------------------------- | -------------------------------------------------------------------- |
| **Relay Chain**          | Polkadot                                                             | Kusama                                                               |
| **Parachain ID**         | 2030                                                                 | 2001                                                                 |
| **Genesis Hash**         | `0x262e1b2ad728475fd6fe88e62d34c200abe6fd693931ddad144059b1eb884e5b` | `0x9f28c6a68e0fc9646eff64935684f6eeeece527e37bbe1f213d22caa1d9d6bed` |
| **Runtime (2025-10-03)** | specVersion `21001`, transactionVersion `1`                          | specVersion `19000`, transactionVersion `1`                          |
| **Unit Symbol**          | BNC                                                                  | BNC                                                                  |
| **Decimals**             | 12                                                                   | 12                                                                   |
| **SS58 Prefix**          | 6                                                                    | 6                                                                    |
| **Explorer**             | bifrost.subscan.io                                                   | bifrost-kusama.subscan.io                                            |
| **Average Block Time**   | \~6 seconds                                                          | \~6 seconds                                                          |

### Additional Details

| Parameter         | Value                                               | Details                                        |
| ----------------- | --------------------------------------------------- | ---------------------------------------------- |
| Collator Rotation | >16 active authors                                  | RefTime utilization stays under 0.5% per block |
| Runtime Pallets   | `Hyperbridge`, `FlexibleFee`, `Farming`, and `Ismp` | Cross-ecosystem liquidity orchestration        |

## Common Integration Patterns

### Real-Time Block Streaming

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

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

api.rpc.chain.subscribeNewHeads((header) => {
  console.log(`New Bifrost block #${header.number.toString()} (${header.hash.toHex()})`);
});
```

### Query Staking Liquidity Positions

```bash
# Read total issuance for vDOT (AssetRegistry + Tokens pallet)
curl https://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "id":42,
    "method":"state_getStorage",
    "params":[
      "0x1bd4a27d04bdb9c3f135c3b09677626d26c37dd72647d0f2788a3341e9ac1371"
    ]
  }'
```

### Estimate Fees for SALP Transfers

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

const tx = api.tx.crossInOut.swapExactAssetsForAssets(
  /* asset_in */ { Xcm: { V3: { parents: 1, interior: 'Here' } } },
  /* asset_out */ { Token: 'BNC' },
  /* amount */ 1_000_000_000_000n,
  /* min_receive */ 990_000_000_000n
);

const info = await api.rpc.payment.queryInfo(tx.toHex());
console.log(`Partial fee: ${info.partialFee.toHuman()}`);
console.log(`Weight: ${info.weight.refTime.toString()} refTime`);
```

## Performance Best Practices

- Prefer WebSocket endpoints for subscriptions and long-lived queries; use HTTPS for bursty read-only workloads.
- Cache runtime metadata and type registries keyed by `specVersion` (Polkadot `21001`, Kusama `19000` as of 2025-10-03) to avoid repeated handshakes.
- Use `state_getKeysPaged` with sized pages (<1024 keys) when scanning liquidity pools or reward ledgers.
- Pin to finalized heads for settlement-critical reads; leverage `chain_getFinalizedHead` before fetching block data.
- Implement jittered reconnect backoff (250 ms → 8 s) to respect Dwellir rate limiting during failover events.

## Troubleshooting

| Symptom                                                       | Likely Cause                                                       | Resolution                                                                                     |
| ------------------------------------------------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
| `1010: Invalid Transaction` when submitting vToken extrinsics | Runtime upgrade bumped `specVersion`/`transactionVersion`          | Refresh metadata, rebuild the payload, and resubmit with the updated version info              |
| `Invalid SS58 address` errors                                 | Using Polkadot prefix (`0`) for Bifrost accounts                   | Re-derive addresses with SS58 prefix `6` before signing or decoding                            |
| `TypeError: Cannot decode storage`                            | Missing custom pallets (Hyperbridge, FlexibleFee) in type registry | Extend your type bundle with the latest Bifrost runtime metadata                               |
| Persistent WebSocket disconnects                              | Idle connection without keep-alives                                | Send periodic heartbeats (e.g., `rpc_methods`) or enable `WsProvider` autoConnect              |
| `Authoring not allowed for account` on collator nodes         | Rotate keys not submitted after upgrade                            | Call `author_rotateKeys` and `parachainStaking.setKeys` on the canary network, then on mainnet |

## Smoke Tests

Run these checks before pushing to production:

1. **Node health**
   ```bash
   curl https://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY \
     -H "Content-Type: application/json" \
     -d '{"jsonrpc":"2.0","id":1,"method":"system_health","params":[]}'
   ```
   Verify `isSyncing` is `false` and peer count stays above 8.

2. **Latest header increments**
   ```bash
   curl https://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY \
     -H "Content-Type: application/json" \
     -d '{"jsonrpc":"2.0","id":2,"method":"chain_getHeader","params":[]}'
   ```
   Confirm block numbers advance \~every 6 seconds (e.g., #9,053,714 at 2025-10-03 07:42:18 UTC).

3. **Account snapshot**
   ```bash
   curl https://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY \
     -H "Content-Type: application/json" \
     -d '{"jsonrpc":"2.0","id":3,"method":"state_getStorage","params":["0x26aa394eea5630e07c48ae0c9558cef7f0d3720dbb6f7b3bb82b41c16dbf8d0887f21b38c918a1962fa4273d0f3c2c23244cc25f029aba80a72f1ac277957bc4"]}'
   ```
   Decode the SCALE payload to check BNC balances (collator `15mYsj6…TEZ` shows active staking reserves).

## Migration Guide (Polkadot/Westend → Bifrost)

- **Endpoints:** Swap legacy Polkadot URLs for `https://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY`. Use the Kusama canary endpoint for staging.
- **Address encoding:** Update wallets and services to SS58 prefix `6` for Bifrost accounts.
- **Metadata:** Refresh runtime metadata whenever `specVersion` changes (currently `21001` on Polkadot, `19000` on Kusama). Update custom pallets (Hyperbridge, FlexibleFee, SALP) in your type registry.
- **Fee estimation:** Run `payment_queryInfo` for vToken transfers; Bifrost’s flexible-fee pallet introduces dynamic surcharge multipliers.
- **Pallet coverage:** Check `rpc_methods` after upgrades to discover new `bifrost_*` runtime APIs (e.g., omnipool analytics, Hyperbridge routing).

## Resources & Tools

- Bifrost network explorer: [bifrost.subscan.io](https://bifrost.subscan.io)
- Bifrost documentation and runtime notes: [docs.bifrost.io](https://docs.bifrost.io/)
- Dwellir Dashboard: [dashboard.dwellir.com/register](https://dashboard.dwellir.com/register)
- Community updates and integration stories: [parachains.info/details/bifrost\_finance\_polkadot](https://parachains.info/details/bifrost_finance_polkadot)

Plan your integration, mint liquidity-backed vTokens, and rely on Dwellir’s globally distributed RPC edge to keep your Bifrost workloads online.
