EVM icon

EVM

Interact with an EVM chain

Overview

This node interacts with Ethereum Virtual Machine (EVM) compatible blockchains to perform various operations, including checking token balances. The Check Balance operation allows users to query the balance of different token types for a specified address on an EVM chain. It supports native tokens (like ETH, BNB, MATIC), ERC20 tokens, and NFTs compliant with ERC721 standards, including two methods for NFT balance retrieval: direct contract queries and event log analysis.

Common scenarios where this node is beneficial include:

  • Monitoring wallet balances in decentralized finance (DeFi) applications.
  • Tracking ownership of specific ERC20 tokens or NFTs.
  • Building dashboards that display user asset holdings.
  • Auditing NFT ownership by analyzing blockchain event logs.

Practical example:

  • A user wants to check how many ERC20 tokens they hold in their wallet or verify which NFTs they own from a particular collection by fetching token IDs.

Properties

Name Meaning
Balance Type The type of token balance to check. Options: Native Token, ERC20 Token, ERC721 NFT, ERC721 NFT (Event Logs).
Address The blockchain address to check the balance for. If left empty, the wallet address from the connected credential will be used.
Token Contract Address (Required for ERC20) The contract address of the ERC20 token to check balance for.
NFT Contract Address (Required for ERC721) The contract address of the NFT collection to check balance for.
Fetch Token IDs (For ERC721) Whether to fetch up to 100 token IDs owned by the address.
NFT Contract Address (Event Logs) (Required for ERC721 Event Logs) The NFT contract address to analyze Transfer event logs for balance calculation.
From Block (For ERC721 Event Logs) The starting block number to begin searching Transfer events from (0 for genesis).
To Block (For ERC721 Event Logs) The ending block number to search to ("latest" for current block).
Return Token IDs (For ERC721 Event Logs) Whether to return the list of token IDs currently owned based on event log analysis.

Output

The output JSON structure depends on the selected balance type:

  • Native Token: Returns the native token balance of the address as a string representing the amount in the smallest unit (e.g., wei).
  • ERC20 Token: Returns the balance of the specified ERC20 token for the address as a string in the token's smallest unit.
  • ERC721 NFT: Returns the count of NFTs owned by the address. If Fetch Token IDs is enabled, it also returns an array of token IDs owned (up to 100).
  • ERC721 NFT (Event Logs): Returns the count of NFTs owned by analyzing Transfer event logs between specified blocks. If Return Token IDs is true, it includes an array of currently owned token IDs derived from event history.

If binary data were involved (not applicable here), it would typically represent raw transaction data or signed messages, but this operation focuses on JSON outputs.

Dependencies

  • Requires connection to an EVM-compatible blockchain node via RPC URL provided in credentials.
  • Needs an API key credential that includes access to the RPC endpoint and optionally a private key for wallet operations.
  • Uses the ethers library for blockchain interactions.
  • No additional external services are required beyond the configured blockchain node access.

Troubleshooting

  • Invalid Address: If the provided address is malformed or invalid, the node may throw errors. Ensure addresses are valid hexadecimal strings starting with "0x".
  • Missing Required Fields: For ERC20 and ERC721 balance checks, the respective contract address must be provided; otherwise, the node will error.
  • RPC Connection Issues: Failure to connect to the blockchain node (due to incorrect RPC URL or network issues) will cause errors. Verify RPC endpoint accessibility.
  • Private Key Errors: When using custom private keys for wallet-related operations, ensure the key is correctly formatted and valid.
  • Large Block Range for Event Logs: Querying very large block ranges for ERC721 event logs can be slow or time out. Use reasonable block ranges to improve performance.
  • Token ID Fetch Limits: Fetching token IDs for ERC721 NFTs is limited to 100 tokens to avoid excessive load.

Links and References

Discussion