⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

Centrifuge RPC API Documentation

Overview

Centrifuge is the leading Real-World Asset (RWA) protocol and Polkadot parachain, providing infrastructure for tokenizing, managing, and investing in real-world financial assets. Built on the Substrate framework, Centrifuge bridges traditional finance with DeFi, enabling businesses to access instant, bankless liquidity through tokenized credit, real estate, treasuries, and other real-world assets.

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

Network Information

Mainnet (Centrifuge)

  • Parachain ID: 2031
  • Native Token: CFG
  • Token Decimals: 18
  • SS58 Prefix: 36
  • Consensus: Nominated Proof-of-Stake (NPoS) via Polkadot
  • Framework: Substrate
  • Genesis Hash: 0xb3db41421702df9a7fcac62b53ffeac85f7853cc4e689e0b93aeb3db18c09d82

Connection Endpoints

HTTPS Endpoint

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

WebSocket Endpoint

wss://api-centrifuge.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.

API Categories

Centrifuge'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

const response = await fetch('https://api-centrifuge.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

import requests
import json

url = "https://api-centrifuge.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)

const WebSocket = require('ws');

const ws = new WebSocket('wss://api-centrifuge.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

Centrifuge RPC errors follow the JSON-RPC 2.0 error format:

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

Common Error Codes

CodeMessageDescription
-32700Parse errorInvalid JSON
-32600Invalid requestMissing required fields
-32601Method not foundUnknown RPC method
-32602Invalid paramsInvalid method parameters
-32603Internal errorNode processing error
-32000Server errorCustom 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

SDK Support

Official Libraries

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

Integration Example

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

async function connect() {
const provider = new WsProvider('wss://api-centrifuge.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;
}

Centrifuge Features

Real-World Asset Tokenization

Centrifuge is the leading protocol for tokenizing real-world assets, with $270 million in active loans and nearly $500 million in total financed assets. The platform enables:

  • Private Credit - Tokenization of private credit and lending markets
  • Real Estate - Property-backed tokenized assets
  • Treasuries - Government bond tokenization
  • Invoice Financing - SME invoice and receivables tokenization

DeFi Integration

Centrifuge bridges traditional finance with DeFi through:

  • Multichain Support - Integration across Polkadot, Ethereum, and other chains via Wormhole
  • Liquidity Pools - Tinlake protocol for asset-backed lending pools
  • Institutional Grade - Compliance-ready infrastructure for regulated assets

CFG Token

The CFG token serves multiple purposes:

  • Governance - Community-driven protocol upgrades and parameter changes
  • Staking - Network security through Polkadot's NPoS
  • Utility - Access to protocol features and services

Polkadot Integration

As a Polkadot parachain, Centrifuge benefits from:

  • Shared Security - Protected by Polkadot's validator network
  • Cross-Chain Interoperability - Seamless communication with other parachains
  • Scalability - Leveraging Polkadot's multi-chain architecture

Additional Resources

Support

For additional support or questions:


Method Categories

Select a category below to explore detailed method documentation: