Docs

author_pendingExtrinsics - Neuroweb RPC Method

Get pending extrinsics in the transaction pool on Neuroweb. Monitor mempool activity, verify transaction submission, and analyze network congestion.

Returns all pending extrinsics currently in the transaction pool on Neuroweb. These are signed extrinsics that have been submitted but not yet included in a finalized block.

Why Neuroweb? Build on the decentralized AI blockchain powering 125M+ Knowledge Assets with MIT-awarded technology with OriginTrail DKG V8 with 500-1000x scalability, 40% of US imports secured, EVM compatibility, and Best Decentralized AI Project (MIT).

When to Use This Method

author_pendingExtrinsics is essential for AI developers, knowledge graph builders, and teams requiring verifiable AI solutions:

  • Transaction Confirmation -- Verify whether a submitted extrinsic is still pending or has been included in a block on Neuroweb
  • Mempool Monitoring -- Monitor the transaction pool size and activity for decentralized knowledge graphs (DKG), verifiable AI, supply chain audits, and knowledge mining
  • Network Congestion Analysis -- Gauge current network load by inspecting the number and type of pending extrinsics
  • Validator Tooling -- Build block authoring tools that inspect the ready queue before producing blocks

Code Examples

Common Use Cases

1. Transaction Pool Monitor

Continuously monitor the Neuroweb transaction pool and alert on unusual activity:

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

async function monitorPool(api, interval = 6000) {
  let previousCount = 0;

  setInterval(async () => {
    const pending = await api.rpc.author.pendingExtrinsics();
    const count = pending.length;

    if (count !== previousCount) {
      console.log(`Pool size changed: ${previousCount} -> ${count}`);

      if (count > 100) {
        console.warn('High pool activity detected!');
      }
    }

    // Analyze pending extrinsic types
    const byPallet = {};
    pending.forEach((ext) => {
      const key = `${ext.method.section}.${ext.method.method}`;
      byPallet[key] = (byPallet[key] || 0) + 1;
    });

    if (Object.keys(byPallet).length > 0) {
      console.log('Pending by type:', byPallet);
    }

    previousCount = count;
  }, interval);
}

2. Verify Transaction Submission

Check that a submitted extrinsic appears in the pool:

JavaScript
async function verifyInPool(api, txHash) {
  const pending = await api.rpc.author.pendingExtrinsics();

  const found = pending.find((ext) => ext.hash.toHex() === txHash);

  if (found) {
    console.log(`Transaction ${txHash} is in the pool`);
    console.log(`  Call: ${found.method.section}.${found.method.method}`);
    return true;
  }

  console.log(`Transaction ${txHash} not found in pool (may already be included)`);
  return false;
}

3. Pool Congestion Analysis

Analyze network congestion to decide on tip amounts:

JavaScript
async function analyzeCongestion(api) {
  const pending = await api.rpc.author.pendingExtrinsics();

  const tips = pending.map((ext) => ext.tip.toBigInt());
  const totalTips = tips.reduce((sum, tip) => sum + tip, 0n);
  const avgTip = tips.length > 0 ? totalTips / BigInt(tips.length) : 0n;
  const maxTip = tips.length > 0 ? tips.reduce((a, b) => (a > b ? a : b), 0n) : 0n;

  return {
    poolSize: pending.length,
    averageTip: avgTip.toString(),
    maxTip: maxTip.toString(),
    congested: pending.length > 50
  };
}

Error Handling

Common errors and solutions:

Error CodeDescriptionSolution
-32603Internal errorNode may be starting up -- retry after delay
-32005Rate limit exceededReduce polling frequency; the pool changes only each block
Connection refusedNode unreachableVerify the RPC endpoint URL and that the node is running
Empty arrayNo pending extrinsicsNormal when the pool is idle -- not an error