Blockchain Explorer
Actions22
- Account Actions
- Block Actions
- Contract Actions
- Gas Actions
- Stat Actions
- Token Actions
- Transaction Actions
Overview
This node interacts with multiple blockchain networks through their explorer APIs that are compatible with Etherscan. Specifically, for the Contract resource and the Get Source Code operation, it retrieves the verified source code of a smart contract deployed on a specified blockchain network.
Typical use cases include:
- Auditing or reviewing the source code of a deployed smart contract.
- Verifying contract details during development or security assessments.
- Integrating contract source code retrieval into automated workflows for blockchain analytics or compliance.
For example, a user can input a contract address on the Ethereum network to fetch its verified source code, which can then be used for further analysis or display in a dashboard.
Properties
| Name | Meaning |
|---|---|
| Network | The blockchain network to query. Options: Arbitrum, Avalanche, Binance Smart Chain, Celo, Cronos, Ethereum, Fantom, Moonbeam, Optimism, Polygon. Default is Ethereum. |
| Contract Address | The address of the smart contract to query. Must be a valid blockchain contract address (e.g., starting with "0x..."). |
Output
The output JSON contains the following fields:
network: The blockchain network queried.resource: The resource type, here always"contract".operation: The operation performed, here"getSourceCode".- Additional fields returned by the blockchain explorer API, typically including:
status: Status of the API response (e.g., "1" for success).message: Response message from the API.result: An array containing the verified source code details of the contract, such as:- Source code text.
- Compiler version.
- Contract name.
- ABI (Application Binary Interface).
- Other metadata related to the contract verification.
If the contract is not verified or an error occurs, the output will contain an error message describing the issue.
The node does not output binary data for this operation.
Dependencies
- Requires an API key credential for a blockchain explorer service compatible with Etherscan APIs.
- The node uses the Axios HTTP client to make requests to the blockchain explorer API.
- The base URL for the API depends on the selected network and environment configuration.
- Proper configuration of the API key credential within n8n is necessary for successful queries.
Troubleshooting
Common issues:
- Invalid or unverified contract address: The API may return an error if the contract is not verified or the address is incorrect.
- Incorrect network selection: Querying a contract address on the wrong network will result in no data or errors.
- Missing or invalid API key: The request will fail if the API key credential is not set or invalid.
- Rate limiting by the blockchain explorer API.
Error messages:
API Error: <message>: Indicates an error response from the blockchain explorer API. Check the contract address, network, and API key validity.- Network or connectivity errors: Ensure internet access and correct API endpoint configuration.
To resolve errors:
- Verify the contract address and ensure it is deployed and verified on the selected network.
- Confirm the API key credential is correctly configured and has sufficient permissions.
- Check the network selection matches the contract's deployment chain.
- Review API usage limits and consider upgrading the plan if rate limited.