Skip to content

Instantly share code, notes, and snippets.

@larspensjo
Created July 25, 2016 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save larspensjo/24d1c76107a2fb05000ef5a8b91a1801 to your computer and use it in GitHub Desktop.
Save larspensjo/24d1c76107a2fb05000ef5a8b91a1801 to your computer and use it in GitHub Desktop.
Find all transactions for an account.
function FindAccountTransactions(start, end) {
find = "0x304a554a310c7e546dfe434669c62820b7d83490";
// find = "0x80a103beced8a6854a7a82ac2d48cdab0eb21cc0";
total = 0;
found = "";
for (bn = start; bn < end; bn++) {
block = eth.getBlock(bn);
transList = block.transactions;
total += transList.length;
for (i = 0; i < transList.length; i++) {
trans = eth.getTransaction(transList[i]);
if (trans.from == find) {
found += transList[i] + " ";
console.log(transList[i]);
}
}
if (bn % 100 == 0) {
console.log(bn, total);
total = 0;
}
}
console.log(found);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment