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 Number by Timestamp" operation allows users to retrieve an estimated block number corresponding to a given Unix timestamp on a selected blockchain network.

This is useful in scenarios where you want to find the block closest to a specific point in time, for example:

  • Analyzing blockchain data or events around a particular date/time.
  • Synchronizing off-chain data with on-chain events.
  • Backtracking transactions or blocks from a known timestamp.

Practical example:
If you have a timestamp representing when a certain event occurred and want to find the block number at or just before that time on Ethereum or Polygon, this operation will provide that block number.

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.
Timestamp Unix timestamp (in seconds) for which to estimate the corresponding block number.

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 "getBlockNumberByTime".
  • Other fields returned by the blockchain explorer API, typically including:
    • status: API response status (e.g., "1" for success).
    • message: Response message (e.g., "OK").
    • result: The estimated block number corresponding to the provided timestamp.

The output is paired with the input item index for traceability.

No binary data is output by this operation.

Dependencies

  • Requires an API key credential for accessing the blockchain explorer API service.
  • Uses Axios HTTP client internally to make requests to the explorer API endpoints.
  • The base URL for the API depends on the selected network and environment configuration.

Troubleshooting

  • API Error: If the API returns a status of "0" with an error message, the node throws an error with the message from the API. This can happen if the timestamp is invalid or out of range for the selected network.
  • Invalid Timestamp: Ensure the timestamp is a valid Unix timestamp in seconds.
  • Network Selection: Selecting an unsupported or misconfigured network may cause errors.
  • Credential Issues: Missing or incorrect API key credentials will prevent successful API calls.
  • Rate Limits: The external API may enforce rate limits; excessive requests might be throttled or blocked.

To resolve errors, verify the input parameters, ensure valid credentials, and consult the blockchain explorer API documentation for any network-specific constraints.

Links and References

  • Etherscan API Documentation
  • Official blockchain explorer websites for each supported network (e.g., Etherscan for Ethereum, Polygonscan for Polygon).

Discussion