etherbal-by-jyremi
v1.0.2
Published
EthereumBalance is a Java class for fetching real-time Ethereum wallet balances using the Web3j library and Infura API. Simply provide a wallet address, and getBalance() returns the balance in Ether (ETH), facilitating easy integration into Java applicati
Downloads
9
Readme
# EthereumBalance
EthereumBalance is a Java utility for retrieving real-time Ethereum wallet balances. It provides a simple way to integrate balance querying functionality into Java applications or services.
## Features
- Fetch Ethereum wallet balances in real-time.
- Utilizes the Web3j library for seamless integration.
- Supports retrieval of balances from the Ethereum mainnet via the Infura API.
## Installation
1. Clone the repository:
```bash
git clone https://github.com/your-username/ethereum-balance.git
Import the project into your preferred Java development environment.
Ensure that you have the necessary dependencies installed (Web3j library).
Usage
Import the
EthereumBalance
class into your Java project.Call the
getBalance()
method, providing the Ethereum wallet address as an argument.Receive the wallet balance in Ether (ETH) as a
BigDecimal
object.
import java.math.BigDecimal;
import java.util.concurrent.ExecutionException;
import EthereumBalance;
public class Main {
public static void main(String[] args) {
String address = "0xYourAddress";
try {
BigDecimal balance = EthereumBalance.getBalance(address);
System.out.println("Balance: " + balance + " ETH");
} catch (ExecutionException | InterruptedException e) {
e.printStackTrace();
}
}
}
Contributions
Contributions are welcome! Feel free to open issues or submit pull requests to improve this project.
License
This project is licensed under the MIT License - see the LICENSE file for details.
This README file provides a brief overview of the project, installation instructions, usage examples, information about contributions, and licensing details.