# Acala RPC with Dwellir

## Acala 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 Acala 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 Acala?

Acala is a DeFi-focused parachain on the Polkadot relay chain that provides a stablecoin (aUSD), liquid staking (LDOT), and EVM+Substrate interoperability. Built on Substrate, Acala exposes the standard JSON‑RPC namespaces developers rely on for production‑grade integrations.

### DeFi Primitives Out of the Box

- aUSD stablecoin, LDOT liquid staking, DEX and more, available through standard pallets and EVM.
- Seamless cross‑chain asset routing via XCM to and from Polkadot ecosystems.

### Familiar Tooling

- Works with polkadot.js, Subxt (Rust), and py‑substrate‑interface (Python).
- Dwellir provides globally anycasted endpoints with low‑latency routing and high availability.

### Security Inherited from Polkadot

- As parachain `2000` on Polkadot, Acala benefits from shared security and fast finality.

## Quick Start

Connect to Acala’s production endpoints.

### Installation & Setup

JavaScript (polkadot.js)
curl (HTTP JSON-RPC)
Rust (subxt)
Python (py-substrate-interface)

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

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

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

  console.log(`Connected to ${chain.toString()} v${version.toString()}`);

  // Subscribe to new blocks
  const unsub = await api.rpc.chain.subscribeNewHeads((header) => {
    console.log(`New block #${header.number} ${header.hash.toHex()}`);
  });

  // Stop after 3 blocks
  setTimeout(async () => { await unsub(); await api.disconnect(); }, 18000);
}

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

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

```rust
use subxt::{OnlineClient, PolkadotConfig};

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

    let header = api.rpc().block_header(None).await?.expect("latest header");
    println!("Latest block: #{:?} (hash {:?})", header.number, header.hash());
    Ok(())
}
```

```python
from substrateinterface import SubstrateInterface

substrate = SubstrateInterface(
    url="wss://api-acala.n.dwellir.com/YOUR_API_KEY",
    type_registry_preset="substrate-node-template"  # use custom types if needed
)

chain = substrate.rpc_request("system_chain", [])
print(f"Connected to {chain['result']}")

head = substrate.rpc_request("chain_getFinalizedHead", [])
print(f"Finalized head: {head['result']}")
```

## Network Information

| Parameter            | Value            | Details                                |
| -------------------- | ---------------- | -------------------------------------- |
| Genesis Hash         | 0xfc41b9bd…ba64c | Verified via chain\_getBlockHash(0)    |
| Native Token         | ACA              | 12 decimals                            |
| SS58 Prefix          | 10               | Address format                         |
| Runtime Spec Version | 2300             | state\_getRuntimeVersion (Oct 9, 2025) |
| Transaction Version  | 3                | state\_getRuntimeVersion               |
| Acala EVM explorer   | Acala Blockscout | blockscout.acala.network               |

Acala runs as Polkadot parachain `2000`. Token properties and address prefix were verified using `system_properties`; genesis hash via `chain_getBlockHash(0)`; runtime versions via `state_getRuntimeVersion` on October 9, 2025.

## API Reference

Acala exposes the core Substrate RPC namespaces for node telemetry, block production, storage access, and transaction submission.

## Common Integration Patterns

### Subscribe to Finality and New Heads

```ts
const unsubFinal = await api.rpc.chain.subscribeFinalizedHeads((h) =>
  console.log(`Finalized #${h.number} ${h.hash.toHex()}`)
);
const unsubNew = await api.rpc.chain.subscribeNewHeads((h) =>
  console.log(`New #${h.number}`)
);
```

### Paginate Large Storage Scans

```ts
const keys = await api.rpc.state.getKeysPaged(
  // System.Account prefix
  '0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9',
  100,
  '0x',
  null
);
console.log('Fetched', keys.length, 'keys');
```

### Estimate Fees Before Broadcasting

```ts
const ext = api.tx.balances.transferAllowDeath('ADDRESS', 1_000_000_000_000);
const info = await api.rpc.payment.queryInfo(ext.toHex());
console.log(`PartialFee: ${info.partialFee.toHuman()}`);
```

## Performance Best Practices

- Prefer WebSocket connections for subscriptions and multi‑round queries.
- Cache runtime metadata and type bundles; reuse ApiPromise across requests.
- Use `state_getKeysPaged` for large map scans; avoid full‑chain scans.
- Implement reconnection/backoff and share a connection pool across services.

## Troubleshooting

- Connection refused: ensure your API key is appended and outbound TCP/443 is allowed.
- Invalid SS58: addresses must use prefix `10` for Acala.
- Type errors: refresh metadata after runtime upgrades (`api.runtimeVersion`).
- Extrinsic failed: decode dispatch error via `api.registry.findMetaError`.

## Smoke Tests

Run these minimal checks against production endpoints (captured Oct 9, 2025):

```bash
# Node health (peers ≈ 15, isSyncing false)
curl -s https://api-acala.n.dwellir.com/YOUR_API_KEY \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"system_health","params":[]}'

# Latest block header (e.g. number ~ 9617916)
curl -s https://api-acala.n.dwellir.com/YOUR_API_KEY \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"chain_getHeader","params":[]}'

# Finalized head hash (e.g. 0xdcdcc29c…f13e7)
curl -s https://api-acala.n.dwellir.com/YOUR_API_KEY \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"chain_getFinalizedHead","params":[]}'

# Runtime versions (specVersion 2300, transactionVersion 3)
curl -s https://api-acala.n.dwellir.com/YOUR_API_KEY \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"state_getRuntimeVersion","params":[]}'
```

## Migration Guide (from Polkadot/Kusama)

- Endpoints: replace with `https://api-acala.n.dwellir.com/YOUR_API_KEY` or `wss://api-acala.n.dwellir.com/YOUR_API_KEY`.
- Addresses: re‑encode SS58 addresses with prefix `10`.
- Types: include Acala custom types where applicable; refresh metadata after upgrades.
- Fees: re‑calibrate using `payment_queryInfo`; fee multipliers differ across chains.

## Resources & Tools

- [Acala Portal](https://acala.network)
- [Acala EVM explorer](https://blockscout.acala.network/)
- [Substrate Developer Hub](https://docs.substrate.io/)
- [Dwellir Dashboard](https://dashboard.dwellir.com/register)
