Docs

rpc_methods - Centrifuge RPC Method

List all available RPC methods on Centrifuge. Essential for API discovery, capability detection, and building dynamic tooling for Substrate-based chains.

Returns a list of all RPC methods exposed by the Centrifuge node. This is the definitive way to discover what methods are available on a given endpoint, including both standard Substrate methods and any custom chain-specific extensions.

Why Centrifuge? Build on the RWA tokenization platform bridging traditional finance with $1B+ Janus Henderson backing with ERC-7540 RWA standards, multichain via Wormhole, 97% securitization cost savings, and BlockTower $220M fund integration.

When to Use This Method

rpc_methods is essential for institutional RWA developers, asset managers, and teams tokenizing real-world assets:

  • API Discovery -- Enumerate all available RPC methods to understand the full capabilities of a Centrifuge node
  • Capability Detection -- Check whether a specific method (e.g., author_submitExtrinsic, state_call) is available before calling it
  • Compatibility Testing -- Verify that an endpoint supports the methods your application requires for tokenized treasury funds, SME invoice financing, and institutional-grade RWA infrastructure
  • Tooling and Documentation -- Auto-generate API references or client SDKs from the available method list

Code Examples

Common Use Cases

1. Endpoint Capability Validation

Check whether a Centrifuge endpoint supports all methods your application needs:

JavaScript
async function validateEndpoint(endpoint, requiredMethods) {
  const response = await fetch(endpoint, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      jsonrpc: '2.0',
      method: 'rpc_methods',
      params: [],
      id: 1
    })
  });

  const { result } = await response.json();
  const available = new Set(result.methods);

  const missing = requiredMethods.filter((m) => !available.has(m));

  if (missing.length > 0) {
    console.error('Missing required methods:', missing);
    return false;
  }

  console.log('Endpoint supports all required methods');
  return true;
}

// Usage
await validateEndpoint('https://api-centrifuge.n.dwellir.com/YOUR_API_KEY', [
  'state_getStorage',
  'state_call',
  'author_submitExtrinsic',
  'payment_queryInfo'
]);

2. Method Category Breakdown

Organize available methods by their RPC namespace:

JavaScript
async function getMethodsByCategory(api) {
  const methods = await api.rpc.rpc.methods();
  const categories = {};

  methods.methods.forEach((method) => {
    const name = method.toString();
    const category = name.split('_')[0];
    categories[category] = categories[category] || [];
    categories[category].push(name);
  });

  for (const [category, methodList] of Object.entries(categories)) {
    console.log(`\n${category} (${methodList.length} methods):`);
    methodList.forEach((m) => console.log(`  - ${m}`));
  }

  return categories;
}

3. Compare Endpoints

Detect differences between two Centrifuge endpoints:

JavaScript
async function compareEndpoints(endpoint1, endpoint2) {
  const fetchMethods = async (url) => {
    const res = await fetch(url, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ jsonrpc: '2.0', method: 'rpc_methods', params: [], id: 1 })
    });
    const { result } = await res.json();
    return new Set(result.methods);
  };

  const [methods1, methods2] = await Promise.all([
    fetchMethods(endpoint1),
    fetchMethods(endpoint2)
  ]);

  const onlyIn1 = [...methods1].filter((m) => !methods2.has(m));
  const onlyIn2 = [...methods2].filter((m) => !methods1.has(m));

  if (onlyIn1.length) console.log('Only in endpoint 1:', onlyIn1);
  if (onlyIn2.length) console.log('Only in endpoint 2:', onlyIn2);
  if (!onlyIn1.length && !onlyIn2.length) console.log('Endpoints have identical methods');
}

Error Handling

Common errors and solutions:

Error CodeDescriptionSolution
-32603Internal errorNode may be starting up -- retry after delay
HTTP 429 / -32029Rate limit exceededCache the method list since it rarely changes at runtime and back off before retrying
Connection refusedNode unreachableVerify the RPC endpoint URL and that the node is running