Blockchain Explorer icon

Blockchain Explorer

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

Overview

The node "Blockchain Explorer" allows users to interact with multiple blockchain networks through their explorer APIs, which are compatible with Etherscan-like services. Specifically, the "Stat" resource with the "Get Chain Stats" operation fetches blockchain statistics such as chain size and other relevant metrics for a selected network.

This node is beneficial when you want to programmatically retrieve up-to-date blockchain statistics without manually visiting blockchain explorer websites. For example, you can use it to monitor the growth of a blockchain's data size or to integrate chain stats into dashboards or automated reports.

Properties

Name Meaning
Network The blockchain network to query. Options include: Arbitrum, Avalanche, Binance Smart Chain, Celo, Cronos, Ethereum, Fantom, Moonbeam, Optimism, Polygon.

Output

The output JSON contains the following fields:

  • network: The blockchain network queried (e.g., "ethereum").
  • resource: The resource type, here always "stats".
  • operation: The operation performed, here "getChainStats".
  • Other fields returned by the blockchain explorer API related to chain statistics, such as chain size and possibly additional metadata depending on the specific API response.

The output structure directly reflects the raw API response merged with the context of the network, resource, and operation used.

No binary data output is produced by this operation.

Dependencies

  • Requires an API key credential for the blockchain explorer service.
  • Uses the Axios HTTP client to make requests to the blockchain explorer API.
  • The node supports multiple blockchain networks via their respective explorer APIs, which must be accessible from the environment where n8n runs.

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 usually indicates invalid parameters, rate limiting, or issues with the API key.
  • Invalid Network: Selecting a network not supported or misconfigured in credentials may cause request failures.
  • Credential Issues: Missing or incorrect API key credentials will prevent successful API calls.
  • Rate Limits: Exceeding the allowed number of API calls per time period may result in errors; consider adding delays or upgrading API plans.

To resolve these:

  • Verify the API key and its permissions.
  • Check that the selected network is supported and correctly configured.
  • Review the parameters passed to ensure they meet API requirements.
  • Handle errors gracefully using the node's "Continue On Fail" option if needed.

Links and References

  • Etherscan API Documentation
  • Documentation for respective blockchain explorers (e.g., BscScan, PolygonScan) which follow similar API structures.

Discussion