Blockchain Explorer icon

Blockchain Explorer

Interact with multiple blockchain networks via their explorer APIs (Etherscan-compatible)

Overview

This node interacts with multiple blockchain networks through their explorer APIs that are compatible with Etherscan. Specifically, the "Get Block by Number" operation under the "Block" resource allows users to retrieve detailed information about a specific block on a chosen blockchain network by specifying its block number.

Common scenarios where this node is beneficial include:

  • Blockchain analytics: Fetching block details such as timestamp, miner, transactions included, and other metadata for analysis.
  • Monitoring: Tracking specific blocks for events or changes.
  • Development and debugging: Verifying block data during smart contract development or transaction troubleshooting.

For example, a user can query the Ethereum mainnet for block number 12345678 to get all relevant block details like hash, parent hash, miner address, gas used, and more.

Properties

Name Meaning
Network The blockchain network to query. Options include Arbitrum, Avalanche, Binance Smart Chain, Celo, Cronos, Ethereum, Fantom, Moonbeam, Optimism, Polygon. Default is Ethereum.
Block Number The specific block number to query on the selected blockchain network. Required string input (e.g., "12345678").

Output

The output JSON contains the following fields:

  • network: The blockchain network queried.
  • resource: The resource type, here always "block".
  • operation: The operation performed, here "getBlockByNumber".
  • Additional fields returned by the blockchain explorer API for the block, which typically include:
    • Block hash
    • Parent hash
    • Miner address
    • Timestamp
    • Number of transactions
    • Gas used and gas limit
    • Size of the block
    • Difficulty and total difficulty
    • Extra data
    • Any other metadata provided by the underlying blockchain explorer API.

If the API returns an error, the node throws an error unless configured to continue on failure, in which case the output will contain an error field with the message.

The node does not output binary data.

Dependencies

  • Requires an API key credential for the blockchain explorer service compatible with Etherscan APIs.
  • The node uses Axios HTTP client internally to make requests to the blockchain explorer API.
  • No additional environment variables are required beyond the API key credential configuration.

Troubleshooting

  • API Errors: If the API returns a status of "0" with a message other than "OK", the node throws an error with the API's error message. This often indicates invalid parameters, rate limiting, or issues with the API key.
  • Invalid Block Number: Providing a block number that does not exist or is out of range for the selected network may cause errors or empty results.
  • Network Mismatch: Ensure the selected network matches the block number's actual blockchain; querying Ethereum with a block number from another chain will fail.
  • Credential Issues: Missing or incorrect API key credentials will result in authentication errors.
  • To resolve errors, verify the block number, network selection, and API key validity. Check the blockchain explorer service status if issues persist.

Links and References

Discussion