Docs
Docs
Home
Getting Started
Agent Tooling
CLI
Supported Chains
Acala
Aptos
Arbitrum
Arc
Asset Hub
Astar
Avalanche
Base
Berachain
Bifrost
Binance Smart Chain
Bittensor
Blast
Boba Network
Bridge Hub
Celo
Centrifuge
Chiliz
Cronos
Enjin
Ethereum
Etherlink
Flow EVM Gateway
Gnosis
Hydration
Hyperliquid
Immutable
Ink
IoTeX
Kusama
Linea
LISK
Manta Atlantic
Manta Pacific
Mantle
MegaETH
Monad
Movement
Neuroweb
opBNB
Optimism
Plasma
Polkadot
Polygon
Pulsechain
Robinhood
Ronin
Scroll
Sonic
Starknet
Taiko
Tempo
Sui
TRON
Unichain
Viction
World Chain
XDC Network
XX Network
Zetachain
zkSync Era
Zora
Supported ChainsPlasmaJSON-RPC APIBlock Methods

eth_getBlockByHash - Plasma RPC Method

Retrieve complete block data by block hash on Plasma. Essential for payment app developers, wallet teams, and teams shipping Solidity contracts for dollar transfers building on an EVM Layer 1 for stablecoin payments with PlasmaBFT consensus and Reth execution.

Plasma RPC endpoint: endpoint URLs, plans and pricing.

Returns information about a block by hash on Plasma.

Why Plasma? Build on an EVM Layer 1 for stablecoin payments with PlasmaBFT consensus and Reth execution with 1 second blocks, XPL gas, full EVM JSON-RPC, and debug plus txpool on Dwellir.

When to Use This Method

eth_getBlockByHash is essential for payment app developers, wallet teams, and teams shipping Solidity contracts for dollar transfers:

  • Block verification using deterministic hash lookup: Retrieve block data by its unique, immutable hash on Plasma
  • Chain reorganization handling: Track blocks reliably by hash during reorgs on an EVM Layer 1 for stablecoin payments with PlasmaBFT consensus and Reth execution
  • Cross-chain bridge finality verification: Confirm block existence by its canonical hash for stablecoin transfers, payment apps, and wallets that need 1 second confirmation
  • Deterministic queries when block number may change: Ensure consistent results for applications that need stable references regardless of chain state
JSON-RPC request
{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByHash",
  "params": [
    "0xf8e25a8aece71a7a87e8aaefd242832cb0ce838ebbad206c48ca9e9f6b1a7a07",
    false
  ],
  "id": 1
}

Common Use Cases

1. Verify a Specific Block from a Transaction's blockHash Field

When a transaction response includes blockHash, use eth_getBlockByHash to retrieve the full parent block. This cross-references the transaction's context and confirms which block it was included in on Plasma.

JavaScript
import { JsonRpcProvider } from 'ethers';

const provider = new JsonRpcProvider('https://api-plasma-mainnet.n.dwellir.com/YOUR_API_KEY');

async function verifyBlockFromTx(txHash) {
  const tx = await provider.getTransaction(txHash);
  if (!tx || !tx.blockHash) return null;

  const block = await provider.getBlock(tx.blockHash);
  console.log(`Transaction ${txHash} in block #${block.number}`);
  console.log(`Block hash: ${block.hash}`);
  console.log(`Block timestamp: ${new Date(block.timestamp * 1000).toISOString()}`);
  return block;
}

verifyBlockFromTx('0xb7db21f5fcc47ea4f33c75deebf128eb8aaecaece720d3503e8752ec29df3e0f');

2. Cross-Reference Blocks During Chain Reorganization

During a chain reorganization, block numbers can shift but block hashes remain unique identifiers. Use eth_getBlockByHash to verify the canonical chain state and detect whether a previously observed block has been orphaned on an EVM Layer 1 for stablecoin payments with PlasmaBFT consensus and Reth execution.

Python
from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://api-plasma-mainnet.n.dwellir.com/YOUR_API_KEY'))

def verify_block_still_canonical(block_hash):
    block = w3.eth.get_block(block_hash)
    if block is None:
        print(f'Block {block_hash} has been pruned or orphaned')
        return False
    print(f'Block {block_hash} still canonical at height #{block.number}')
    return True

# Check a known block hash
verify_block_still_canonical('0xf8e25a8aece71a7a87e8aaefd242832cb0ce838ebbad206c48ca9e9f6b1a7a07')

3. Audit Block Data by Known Hash Reference

For compliance and audit workflows, store block hashes as permanent references. Re-querying eth_getBlockByHash with a stored hash guarantees you retrieve the exact same block data, even months later on Plasma.

Go
package main

import (
    "context"
    "fmt"
    "log"

    "github.com/ethereum/go-ethereum/common"
    "github.com/ethereum/go-ethereum/ethclient"
)

func main() {
    client, _ := ethclient.Dial("https://api-plasma-mainnet.n.dwellir.com/YOUR_API_KEY")

    knownHash := common.HexToHash("0xf8e25a8aece71a7a87e8aaefd242832cb0ce838ebbad206c48ca9e9f6b1a7a07")
    block, err := client.BlockByHash(context.Background(), knownHash)
    if err != nil || block == nil {
        log.Fatal("Block not found: may be pruned from node")
    }

    fmt.Printf("Audited block #%d\n", block.Number().Uint64())
    fmt.Printf("Hash: %s\n", block.Hash().Hex())
    fmt.Printf("Transactions: %d\n", len(block.Transactions()))
}

Best Practices

  • Hash-based lookups are more reliable during chain reorgs than number-based: A block hash uniquely identifies one canonical block, while a block number may shift to a different block after a reorg
  • Store block hashes in your database for future verification: Persisting the hash alongside related records enables deterministic re-querying for audits and data integrity checks
  • Handle null results gracefully: Blocks can be pruned by the node, especially on non-archive endpoints; your application should treat a null response as a missing or unavailable block
  • For L2 optimistic rollups, verify the L1 anchor hash separately: The hash on the L2 chain references a different block space than the L1 anchor; validate both independently for full finality confidence

Code Examples

Error Handling

Error CodeMessageDescription
-32602Invalid paramsInvalid block hash format
-32000Block not foundBlock with this hash does not exist

Related Methods

  • eth_getBlockByNumber - Get block by number
  • eth_blockNumber - Get latest block number

eth_getBlockByNumber

Retrieve complete block data by block number on Plasma. Perfect for payment app developers, wallet teams, and teams shipping Solidity contracts for dollar transfers building on an EVM Layer 1 for stablecoin payments with PlasmaBFT consensus and Reth execution.

eth_getBlockReceipts

Return every transaction receipt in a block on Plasma. Useful for indexers, analytics pipelines, and event backfills across stablecoin transfers, payment apps, and wallets that need 1 second confirmation.

On this page

When to Use This MethodCommon Use Cases1. Verify a Specific Block from a Transaction's blockHash Field2. Cross-Reference Blocks During Chain Reorganization3. Audit Block Data by Known Hash ReferenceBest PracticesCode ExamplesError HandlingRelated Methods