queryLedgerState/stakePools

Query stake pool information and registration details

Query information about registered stake pools including their parameters, pledge, margin, and metadata.

Request

All Stake Pools

{
  "jsonrpc": "2.0",
  "method": "queryLedgerState/stakePools"
}

Specific Pools

{
  "jsonrpc": "2.0",
  "method": "queryLedgerState/stakePools",
  "params": {
    "stakePools": [
      { "id": "pool1..." }
    ]
  }
}

Parameters

ParameterTypeRequiredDescription
stakePoolsobject[]NoArray of pool IDs to query (all pools if omitted)
stakePools[].idstringYesPool ID (Bech32 format starting with pool1)
Loading...

Response

{
  "jsonrpc": "2.0",
  "method": "queryLedgerState/stakePools",
  "result": {
    "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy": {
      "id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy",
      "vrfVerificationKeyHash": "abc123...",
      "pledge": { "ada": { "lovelace": 500000000000 } },
      "cost": { "ada": { "lovelace": 340000000 } },
      "margin": "1/100",
      "rewardAccount": "stake1u8...",
      "owners": ["stake1u8..."],
      "relays": [
        {
          "type": "hostname",
          "hostname": "relay1.example.com",
          "port": 6001
        }
      ],
      "metadata": {
        "url": "https://example.com/pool.json",
        "hash": "def456..."
      }
    }
  }
}

Response Fields

FieldTypeDescription
idstringPool ID in Bech32 format
vrfVerificationKeyHashstringVRF key hash for block production
pledgeobjectPool pledge in lovelace
costobjectFixed cost per epoch (min 340 ADA)
marginstringPool margin as fraction (e.g., "1/100" = 1%)
rewardAccountstringStake address for rewards
ownersstring[]Pool owner stake addresses
relaysobject[]Pool relay information
metadata.urlstringURL to pool metadata JSON
metadata.hashstringHash of metadata for verification

Code Examples

async function getStakePool(poolId) {
const response = await fetch('https://api.nacho.builders/v1/ogmios', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'apikey': process.env.NACHO_API_KEY
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'queryLedgerState/stakePools',
    params: {
      stakePools: [{ id: poolId }]
    }
  })
});

const { result } = await response.json();
return result[poolId];
}

// Get pool info and calculate effective margin
const pool = await getStakePool('pool1...');
const [num, den] = pool.margin.split('/').map(Number);
const marginPercent = (num / den) * 100;
console.log('Pool margin:', marginPercent, '%');
console.log('Fixed cost:', pool.cost.ada.lovelace / 1_000_000, 'ADA');

Pool Metadata

Pool metadata is stored off-chain at the URL specified in registration. To fetch and verify:

async function fetchPoolMetadata(pool) {
  if (!pool.metadata) return null;

  const response = await fetch(pool.metadata.url);
  const metadata = await response.json();

  // Verify hash matches
  const encoder = new TextEncoder();
  const data = encoder.encode(JSON.stringify(metadata));
  const hashBuffer = await crypto.subtle.digest('SHA-256', data);
  const hash = Array.from(new Uint8Array(hashBuffer))
    .map(b => b.toString(16).padStart(2, '0'))
    .join('');

  if (hash !== pool.metadata.hash) {
    throw new Error('Metadata hash mismatch');
  }

  return metadata;
}

Metadata includes pool name, description, ticker symbol, and homepage URL. The maximum metadata size is 512 bytes.

Use Cases

  • Pool selection - Compare pools by margin, pledge, and cost
  • Delegation tools - Build stake pool explorers
  • Pool monitoring - Track your pool's registration parameters
  • Governance - Identify pool operators for voting

Full Ogmios API Reference

Was this page helpful?