Infura icon

Infura

Interact with blockchain APIs via Infura

Get Balance

AI-generated

Overview

This node interacts with the Infura blockchain API to retrieve the ETH balance of a specified Ethereum address. It is useful for scenarios where you need to check the current balance of an address on the Ethereum network, such as monitoring wallet balances or verifying funds before transactions.

Use Case Examples

  1. Checking the ETH balance of a user's wallet address before processing a payment.
  2. Monitoring the balance of a smart contract address to ensure it has sufficient funds.

Properties

Name Meaning
Address The Ethereum address for which to retrieve the ETH balance.

Output

JSON

  • address - The Ethereum address queried for balance.
  • balanceWei - The balance in Wei (smallest ETH unit) as a hexadecimal string.
  • balanceEth - The balance converted to Ether (ETH) as a decimal number.
  • metadata
    • network - The Ethereum network used (e.g., mainnet, rinkeby).
    • operation - The operation performed, here 'getBalance'.
    • timestamp - Timestamp of when the operation was performed.
    • infura_endpoint - The Infura API endpoint used for the request.
    • raw_response - The raw response data from the Infura API.

Dependencies

  • Infura API credentials including network, projectId, and optionally projectSecret for authentication.

Troubleshooting

  • Common issues include invalid or missing Ethereum address input, which will cause the API call to fail.
  • Errors related to Infura API credentials such as incorrect project ID or network configuration can cause authentication failures.
  • If the node throws an error about invalid JSON or response, verify the network connectivity and Infura service status.

Links

Discussion