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, for the Gas resource and the Get Gas Price operation, it fetches the current gas price data from the selected blockchain network.

Use cases include:

  • Monitoring current transaction fees on various blockchains to optimize transaction timing.
  • Integrating real-time gas price data into automated workflows for cost estimation or alerting.
  • Supporting multi-chain applications by dynamically retrieving gas prices across different networks.

For example, a user can select the Ethereum network and retrieve the current gas price to decide whether to proceed with a transaction or wait for lower fees.

Properties

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

Output

The output is a JSON object containing the following fields:

  • network: The blockchain network queried (e.g., "ethereum").
  • resource: The resource type, here always "gas".
  • operation: The operation performed, here "getGasPrice".
  • Additional fields returned by the blockchain explorer API representing the current gas price data. These typically include details such as standard gas price, fast gas price, safe gas price, and possibly other related metrics depending on the specific blockchain's API response.

No binary data is output by this node.

Example output snippet (simplified):

{
  "network": "ethereum",
  "resource": "gas",
  "operation": "getGasPrice",
  "status": "1",
  "message": "OK",
  "result": {
    "LastBlock": "12345678",
    "SafeGasPrice": "20",
    "ProposeGasPrice": "25",
    "FastGasPrice": "30"
  }
}

Dependencies

  • Requires an API key credential for the blockchain explorer service compatible with Etherscan APIs.
  • The node uses the Axios HTTP client to make requests to the explorer API endpoints.
  • The base URL for the API depends on the selected network and environment configuration.
  • Proper configuration of the API key credential in n8n is necessary for successful requests.

Troubleshooting

  • API Error Responses: 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.

    • Resolution: Verify the API key validity, check parameter correctness, and ensure the API usage limits are not exceeded.
  • Network Selection Issues: Selecting an unsupported or incorrectly spelled network may cause request failures.

    • Resolution: Use only the provided network options.
  • Credential Errors: Missing or misconfigured API credentials will prevent the node from authenticating with the blockchain explorer API.

    • Resolution: Ensure the API key credential is set up correctly in n8n.
  • Rate Limits: Frequent requests might hit the API rate limits imposed by the blockchain explorer service.

    • Resolution: Implement delays between requests or upgrade the API plan if available.

Links and References

Discussion