Docs

beefy_getFinalizedHead - Enjin RPC Method

Get the BEEFY finalized block hash on Enjin. Bridge-optimized finality proofs for cross-chain communication and light client verification on the purpose-built NFT blockchain with protocol-level minting and $100M Metaverse Fund.

Returns the block hash of the latest BEEFY-finalized block on Enjin. BEEFY (Bridge Efficiency Enabling Finality Yielder) provides additional finality proofs that are optimized for light clients and cross-chain bridges, using compact aggregated signatures instead of full GRANDPA justifications.

Why Enjin? Build on the purpose-built NFT blockchain with protocol-level minting and $100M Metaverse Fund with NFT functions at protocol level, Fuel Tanks for subsidized fees, 700-1000 TPS, 6-second finality, and ERC-1155 standard pioneer.

When to Use This Method

beefy_getFinalizedHead is important for game developers, NFT creators, and enterprises building cross-chain digital assets:

  • Cross-Chain Bridges — Verify finality proofs efficiently for bridge operations on high-volume NFT minting (2,000+ per tx), gaming assets, and cross-chain NFT transfers via Paratoken standard
  • Light Clients — Verify finality without downloading full GRANDPA justifications
  • Trustless Bridges — Generate compact finality proofs that can be verified on external chains
  • Bridge Monitoring — Track BEEFY finality progress relative to GRANDPA finality

Code Examples

Common Use Cases

1. Bridge Finality Verification

Verify BEEFY finality before relaying messages on a cross-chain bridge:

JavaScript
async function verifyBridgeFinality(api, targetBlockHash) {
  const beefyHead = await api.rpc.beefy.getFinalizedHead();
  const beefyBlock = await api.rpc.chain.getBlock(beefyHead);
  const beefyNumber = beefyBlock.block.header.number.toNumber();

  const targetBlock = await api.rpc.chain.getBlock(targetBlockHash);
  const targetNumber = targetBlock.block.header.number.toNumber();

  if (beefyNumber >= targetNumber) {
    console.log(`Block #${targetNumber} has BEEFY finality — safe to relay`);
    return true;
  } else {
    console.log(`Waiting: BEEFY at #${beefyNumber}, target at #${targetNumber}`);
    return false;
  }
}

2. BEEFY vs GRANDPA Finality Monitor

Track the gap between the two finality gadgets:

JavaScript
async function monitorFinalityGadgets(api) {
  setInterval(async () => {
    try {
      const [beefyHead, grandpaHead] = await Promise.all([
        api.rpc.beefy.getFinalizedHead(),
        api.rpc.chain.getFinalizedHead()
      ]);

      const [beefyBlock, grandpaBlock] = await Promise.all([
        api.rpc.chain.getBlock(beefyHead),
        api.rpc.chain.getBlock(grandpaHead)
      ]);

      const beefyNum = beefyBlock.block.header.number.toNumber();
      const grandpaNum = grandpaBlock.block.header.number.toNumber();
      const lag = grandpaNum - beefyNum;

      console.log(`GRANDPA: #${grandpaNum} | BEEFY: #${beefyNum} | Lag: ${lag} blocks`);
    } catch (error) {
      console.error('Monitor error:', error.message);
    }
  }, 12000);
}

BEEFY vs GRANDPA Finality

AspectGRANDPABEEFY
PurposePrimary chain finalityBridge-optimized finality
Proof SizeLarger (full validator set signatures)Compact (aggregated BLS signatures)
LatencyImmediate after supermajoritySlightly delayed behind GRANDPA
Verification CostHigher on external chainsLower — designed for on-chain verification
Use CaseOn-chain consensus finalityCross-chain bridges and light clients

Availability

BEEFY is enabled on Polkadot and Kusama relay chains and some parachains. If BEEFY is not active on the chain you are querying, this method will return an error. Check chain documentation or try calling the method to confirm availability.

Error Handling

Error CodeDescriptionSolution
-32603Internal error / BEEFY not enabledVerify BEEFY is active on this chain
-32601Method not foundChain runtime may not include BEEFY pallet
-32005Rate limit exceededImplement client-side rate limiting