# xx Network RPC Documentation

## xx Network 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 xx Network 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

xx Network is the world's first quantum-resistant, privacy-first Layer 1 blockchain, founded by cryptography pioneer David Chaum. Built on the Substrate framework, xx Network features revolutionary metadata shredding technology (cMixx) that obscures transaction patterns and protects against quantum computing attacks.

This documentation provides comprehensive coverage of xx Network's JSON-RPC API methods, enabling developers to interact with xx Network nodes for building applications, wallets, explorers, and other blockchain tools.

## Network Information

### Mainnet (xx Network)

| Parameter        | Value                                         | Details |
| ---------------- | --------------------------------------------- | ------- |
| Native Token     | XX                                            |         |
| Consensus        | Nominated Proof-of-Stake (NPoS)               |         |
| Block Time       | \~6 seconds                                   |         |
| Framework        | Substrate                                     |         |
| Special Features | Quantum-resistant, metadata shredding (cMixx) |         |

## Connection Endpoints

### HTTPS Endpoint

```
https://api-xxnetwork.n.dwellir.com/{YOUR_API_KEY}
```

### WebSocket Endpoint

```
wss://api-xxnetwork.n.dwellir.com/{YOUR_API_KEY}
```

## Authentication

Authentication is done via the URL path. Replace `{YOUR_API_KEY}` with your actual API key obtained from [dwellir.com](https://www.dwellir.com).

## API Categories

xx Network's RPC API is organized into the following method categories:

### Core APIs

#### Author Methods

Submit and manage extrinsics (transactions) on the network.

#### Chain Methods

Query blockchain data including blocks, headers, and finalized state.

#### State Methods

Access runtime storage, metadata, and proof generation.

#### System Methods

Node information, health checks, and network properties.

### Specialized APIs

#### BEEFY Methods

Bridge Efficiency Enabling Finality Yielder protocol operations.

#### Grandpa Methods

GRANDPA finality gadget operations and proofs.

#### Child State Methods

Manage child storage tries for contracts and parachains.

#### Sync State Methods

Monitor and manage node synchronization state.

## Quick Start Examples

### Get Latest Block

```javascript
const response = await fetch('https://api-xxnetwork.n.dwellir.com/YOUR_API_KEY', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'chain_getBlock',
    params: [],
    id: 1
  })
});

const data = await response.json();
console.log('Latest block:', data.result);
```

### Submit Transaction

```python
import requests
import json

url = "https://api-xxnetwork.n.dwellir.com/YOUR_API_KEY"
headers = {
    "Content-Type": "application/json"
}

# Properly formatted and signed extrinsic
extrinsic = "0x..."

payload = {
    "jsonrpc": "2.0",
    "method": "author_submitExtrinsic",
    "params": [extrinsic],
    "id": 1
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
tx_hash = response.json()["result"]
print(f"Transaction hash: {tx_hash}")
```

### Subscribe to New Blocks (WebSocket)

```javascript
const WebSocket = require('ws');

const ws = new WebSocket('wss://api-xxnetwork.n.dwellir.com/YOUR_API_KEY');

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

ws.on('message', (data) => {
  const response = JSON.parse(data);
  if (response.params?.result) {
    console.log('New block:', response.params.result);
  }
});
```

## Error Handling

xx Network RPC errors follow the JSON-RPC 2.0 error format:

```json
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid params",
    "data": "Expected hex-encoded hash"
  },
  "id": 1
}
```

### Common Error Codes

| Code   | Message          | Description               |
| ------ | ---------------- | ------------------------- |
| -32700 | Parse error      | Invalid JSON              |
| -32600 | Invalid request  | Missing required fields   |
| -32601 | Method not found | Unknown RPC method        |
| -32602 | Invalid params   | Invalid method parameters |
| -32603 | Internal error   | Node processing error     |
| -32000 | Server error     | Custom server errors      |

## Best Practices

### 1. Connection Management

- Use WebSocket connections for subscriptions and real-time updates
- Implement reconnection logic for WebSocket disconnections
- Use HTTPS for single queries and transactions

### 2. Error Handling

- Always check for error responses before processing results
- Implement retry logic with exponential backoff
- Log errors for debugging and monitoring

### 3. Performance Optimization

- Batch multiple queries when possible
- Cache frequently accessed data like metadata
- Use specific block hashes for deterministic queries

### 4. Security

- Never expose API keys in client-side code
- Validate all input data before submission
- Use secure storage for private keys

### 5. Privacy & Quantum Resistance

- All transactions benefit from automatic metadata shredding via cMixx
- Quantum-resistant cryptography is built into the protocol
- No special configuration required for privacy protection

## SDK Support

### Official Libraries

- **@polkadot/api** - JavaScript/TypeScript SDK (compatible with xx Network)
- **py-substrate-interface** - Python SDK
- **subxt** - Rust SDK
- **go-substrate-rpc-client** - Go SDK

### Integration Example

```javascript
// Using @polkadot/api
const { ApiPromise, WsProvider } = require('@polkadot/api');

async function connect() {
  const provider = new WsProvider('wss://api-xxnetwork.n.dwellir.com/YOUR_API_KEY');

  const api = await ApiPromise.create({ provider });

  // Query chain data
  const chain = await api.rpc.system.chain();
  console.log(`Connected to ${chain}`);

  // Get account balance
  const account = 'YOUR_ADDRESS';
  const { data: balance } = await api.query.system.account(account);
  console.log(`Balance: ${balance.free.toString()}`);

  return api;
}
```

## Privacy Features

### cMixx Metadata Shredding

xx Network's revolutionary cMixx protocol automatically obscures transaction metadata, preventing third parties from connecting senders to recipients. This happens transparently for all transactions:

```javascript
// Standard transfer - metadata is automatically shredded
const transfer = api.tx.balances.transfer(recipient, amount);
const hash = await transfer.signAndSend(senderKeyPair);

// Privacy protection is built-in, no special configuration needed
```

### Quantum-Resistant Cryptography

All transactions on xx Network are protected against quantum computing attacks using post-quantum cryptographic primitives. Your applications are future-proof by default.

## Additional Resources

- [xx Network Website](https://xx.network/)
- [xx Network 2025 Roadmap](https://xx.network/blog/xx-network-unveils-2025-roadmap/)
- [Substrate Documentation](https://docs.substrate.io/)
- [xx Network Explorer](https://explorer.xx.network/)

## Support

For additional support or questions:

- Email: <support@dwellir.com>
- Documentation: [dwellir.com/docs](https://www.dwellir.com/docs)

***

## Method Categories

Select a category below to explore detailed method documentation:
