# Chiliz RPC with Dwellir

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

Chiliz is the leading blockchain for sports and entertainment, designed to power the $50 billion sports fan engagement market. Built as an Ethereum-compatible network, Chiliz offers:

### **Sports-First Ecosystem**

- **Fan Tokens native support** - Industry-leading fan engagement infrastructure
- **2M+ active sports fans** - Direct access to the world's largest web3 sports community
- **100+ sports partnerships** - Major clubs and organizations already integrated

### **High Performance EVM**

- **Fast finality** - Optimized consensus for real-time fan interactions
- **Low transaction costs** - Affordable microtransactions for fan engagement
- **EVM compatibility** - Full Ethereum tooling and contract support

### **Proven Infrastructure**

- **Battle-tested platform** - Powering millions of fan interactions since 2019
- **Enterprise-grade security** - Institutional infrastructure for major sports brands
- **Scalable architecture** - Built to handle massive fan engagement events

## Quick Start with Chiliz

Connect to Chiliz in seconds with Dwellir's optimized endpoints:

### Installation & Setup

Ethers.js v6
Web3.js
Viem
web3.py

```javascript
import { JsonRpcProvider } from 'ethers';

// Connect to Chiliz mainnet
const provider = new JsonRpcProvider(
  'https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'
);

// Get the latest block
const block = await provider.getBlock('latest');
console.log('Latest block:', block.number);

// Query account balance
const balance = await provider.getBalance('0x...');
console.log('Balance:', balance.toString());
```

```javascript
const Web3 = require('web3');

// Connect to Chiliz mainnet
const web3 = new Web3(
  'https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'
);

// Get chain ID to verify connection
const chainId = await web3.eth.getChainId();
console.log('Connected to Chiliz:', chainId === 88888);

// Get gas price for optimal transaction pricing
const gasPrice = await web3.eth.getGasPrice();
console.log('Current gas price:', gasPrice);
```

```typescript
import { createPublicClient, http, defineChain } from 'viem';

const chiliz = defineChain({
  id: 88888,
  name: 'Chiliz',
  nativeCurrency: {
    decimals: 18,
    name: 'CHZ',
    symbol: 'CHZ',
  },
  rpcUrls: {
    default: {
      http: ['https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'],
    },
  },
  blockExplorers: {
    default: { name: 'ChilizScan', url: 'https://chiliscan.com' },
  },
});

// Create Chiliz client
const client = createPublicClient({
  chain: chiliz,
  transport: http('https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'),
});

// Read contract data
const data = await client.readContract({
  address: '0x...',
  abi: contractAbi,
  functionName: 'balanceOf',
  args: ['0x...'],
});
```

```python
from web3 import Web3

# Connect to Chiliz mainnet
w3 = Web3(Web3.HTTPProvider('https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'))

# Verify connection and get chain ID
assert w3.is_connected()
chain_id = w3.eth.chain_id
print(f'Connected to Chiliz: {chain_id == 88888}')

# Get latest block number
block_number = w3.eth.block_number
print(f'Latest block: {block_number}')
```

## Network Information

| Parameter        | Value    | Details       |
| ---------------- | -------- | ------------- |
| Chain ID         | 88888    | Mainnet       |
| Testnet Chain ID | 88882    | Spicy Testnet |
| Gas Token        | CHZ      | Native token  |
| RPC Standard     | Ethereum | JSON-RPC 2.0  |

## API Reference

Chiliz supports the full [Ethereum JSON-RPC API specification](https://ethereum.org/developers/docs/apis/json-rpc/). Access all standard methods for seamless EVM integration.

## Common Integration Patterns

### Transaction Monitoring

Monitor pending and confirmed transactions efficiently:

```javascript
// Watch for transaction confirmation
async function waitForTransaction(txHash) {
  const receipt = await provider.waitForTransaction(txHash, 1);

  // Log transaction success
  console.log('Transaction confirmed:', receipt.transactionHash);
  console.log('Gas used:', receipt.gasUsed.toString());

  return receipt;
}
```

### Gas Optimization

Optimize gas costs on Chiliz:

```javascript
// Estimate gas for optimal transaction pricing
const gasEstimate = await provider.estimateGas(tx);

// Get current gas price
const gasPrice = await provider.getGasPrice();

// Calculate total transaction cost
const totalCost = gasEstimate * gasPrice;
console.log('Estimated cost:', totalCost.toString(), 'CHZ');
```

### Event Filtering

Efficiently query contract events:

```javascript
// Query events with pagination for large datasets
async function getEvents(contract, eventName, fromBlock = 0) {
  const filter = contract.filters[eventName]();
  const events = [];
  const batchSize = 5000; // Chiliz recommended batch size

  for (let i = fromBlock; i <= currentBlock; i += batchSize) {
    const batch = await contract.queryFilter(
      filter,
      i,
      Math.min(i + batchSize - 1, currentBlock)
    );
    events.push(...batch);
  }

  return events;
}
```

## Performance Best Practices

### 1. **Batch Requests**

Combine multiple RPC calls for optimal performance:

```javascript
const batch = [
  { method: 'eth_blockNumber', params: [] },
  { method: 'eth_gasPrice', params: [] },
  { method: 'eth_getBalance', params: [address, 'latest'] }
];

const results = await provider.send(batch);
```

### 2. **Connection Pooling**

Reuse provider instances to minimize connection overhead:

```javascript
// Singleton pattern for provider
class ChilizProvider {
  static instance = null;

  static getInstance() {
    if (!this.instance) {
      this.instance = new JsonRpcProvider(
        'https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'
      );
    }
    return this.instance;
  }
}
```

### 3. **Smart Caching**

Cache immutable data to reduce API calls:

```javascript
const cache = new Map();

async function getCachedBlockData(blockNumber) {
  const key = `block_${blockNumber}`;

  if (!cache.has(key)) {
    const block = await provider.getBlock(blockNumber);
    cache.set(key, block);
  }

  return cache.get(key);
}
```

## Troubleshooting Common Issues

### Error: "Wrong Chain ID"

Ensure you're using the correct chain ID for Chiliz:

```javascript
// Verify chain connection
const network = await provider.getNetwork();
console.log('Connected to chain ID:', network.chainId);

// Mainnet should return 88888 (0x15b38 in hex)
// Testnet should return 88882 (0x15b32 in hex)
```

### Error: "Insufficient funds for gas"

CHZ is required for all transactions on Chiliz:

```javascript
// Check CHZ balance before transaction
const balance = await provider.getBalance(address);
const gasPrice = await provider.getGasPrice();
const gasEstimate = await provider.estimateGas(tx);
const requiredGas = gasPrice * gasEstimate;

if (balance < requiredGas + tx.value) {
  throw new Error(`Need ${(requiredGas + tx.value - balance).toString()} more CHZ`);
}
```

### Error: "Rate limit exceeded"

Implement exponential backoff for resilient applications:

```javascript
async function callWithRetry(fn, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn();
    } catch (error) {
      if (error.code === 429 && i < maxRetries - 1) {
        await new Promise(r => setTimeout(r, 2 ** i * 1000));
      } else {
        throw error;
      }
    }
  }
}
```

## FAQs

### What makes Chiliz different from other EVM chains?

Chiliz is purpose-built for sports and entertainment, offering native Fan Token infrastructure and direct access to millions of sports fans worldwide.

### Can I use existing Ethereum tools with Chiliz?

Yes! Chiliz is fully EVM-compatible, so all Ethereum tools, libraries, and smart contracts work seamlessly.

### What's the native token on Chiliz?

CHZ is the native gas token used for all transactions on Chiliz Chain.

### How do I get CHZ for testing?

Use the Spicy Testnet with testnet CHZ from official faucets, or contact Dwellir support for testing assistance.

## Smoke Tests

### Test Mainnet Connection

```bash
# Test mainnet connectivity
curl -X POST https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
```

### Test Testnet Connection

```bash
# Test Spicy testnet connectivity
curl -X POST https://api-chiliz-spicy.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
```

### Ethers.js Chain Verification

```javascript
import { JsonRpcProvider } from 'ethers';

const provider = new JsonRpcProvider(
  'https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'
);

// Verify connection and chain ID
const network = await provider.getNetwork();
console.log('Chain ID:', network.chainId); // Should be 88888
console.log('Block number:', await provider.getBlockNumber());
```

### web3.py Connection Test

```python
from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'))

# Verify connection
assert w3.is_connected(), "Failed to connect to Chiliz"
print(f"Chain ID: {w3.eth.chain_id}") # Should be 88888
print(f"Latest block: {w3.eth.block_number}")
```

## Migration Guide

### From Ethereum Mainnet

Moving from Ethereum to Chiliz requires minimal changes:

```javascript
// Before (Ethereum)
const provider = new JsonRpcProvider('https://eth-rpc.example.com');

// After (Chiliz)
const provider = new JsonRpcProvider(
  'https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'
);

// Smart contracts work identically
// Same tooling and libraries
// Standard EVM opcodes
// Note: Different chain ID (88888)
// Note: CHZ as gas token instead of ETH
// Note: Sports-focused ecosystem
```

## Resources & Tools

### Official Resources

- [Chiliz Documentation](https://docs.chiliz.com)
- [Chiliz Explorer](https://scan.chiliz.com)
- [Spicy Testnet Explorer](https://spicy-explorer.chiliz.com)

### Sports Ecosystem

- [Socios.com](https://socios.com) - Fan Token platform
- [Fan Token Directory](https://www.chiliz.com/fan-tokens) - Available fan tokens
- [Chiliz Ecosystem](https://greenhousehub.chiliz.com/) - Web3 projects on Chiliz Chain

### Need Help?

- **Email**: <support@dwellir.com>
- **Docs**: You're here!
- **Dashboard**: [dashboard.dwellir.com](https://dashboard.dwellir.com)

***

*Start building on Chiliz with Dwellir's enterprise-grade RPC infrastructure. [Get your API key](https://dashboard.dwellir.com/register)*
