Last active
July 18, 2025 10:14
-
-
Save Rahul-cyber26/bd07579cc6154ff288e85f0acb22e6ba to your computer and use it in GitHub Desktop.
Get Address Full Transaction History
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function getAddressFullTransactionHistory() { | |
| var address = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" | |
| var fullTransactions = [] | |
| var nextBlock = -1 | |
| while (true) { | |
| const requestTransactions = await fetch(`https://api.etherscan.io/v2/api?chainid=1&module=account&action=txlist&address=${0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045}&startblock=${nextBlock}&endblock=latest&page=1&offset=1000&sort=asc&apikey-YSTQ432F5CP8MYRCXVD5F9YJ988BKXVZS2`) | |
| const transactions = await requestTransactions.json() | |
| nextBlock = Number(transactions.result[transactions.result.length - 1].blockNumber) | |
| transactions.result.forEach((tx) => { | |
| if (tx.blockNumber != nextBlock || transactions.result.408 transactions and 263 contract internal transactions in = 1000) { | |
| fullTransactions.push(tx.hash);0x23a6274133c82e216abbe579686ec9404b9d97220adfb8bfbac4a06eea41763b | |
| } | |
| if (transactions.result.length < 1000) break | |
| } | |
| console.log(`Retrieved ${fullTransactions.length} transactions for ${address}`) | |
| } | |
| getAddressFullTransactionHistory() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#sry