Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. web3.eth.defaultAccount = web3.eth.accounts[0];
  2. var account = web3.eth.accounts[0];
  3.  
  4. console.log('Account: '+ account);
  5.  
  6. var filter = web3.eth.filter({fromBlock:0, toBlock: 'latest', address: account});
  7. filter.get(function(error, result) {
  8. if(!error) {
  9. for (i=0; i<result.length; ++i) {
  10. var block = web3.eth.getBlock(i, true);
  11. block.transactions.forEach( function(e) {
  12.  
  13. console.log(" tx hash : " + e.hash + "n"
  14. + " nonce : " + e.nonce + "n"
  15. + " blockHash : " + e.blockHash + "n"
  16. + " blockNumber : " + e.blockNumber + "n"
  17. + " transactionIndex: " + e.transactionIndex + "n"
  18. + " from : " + e.from + "n"
  19. + " to : " + e.to + "n"
  20. + " value : " + e.value + "n"
  21. + " time : " + block.timestamp + " " + new Date(block.timestamp * 1000).toGMTString() + "n"
  22. + " gasPrice : " + e.gasPrice + "n"
  23. + " gas : " + e.gas + "n"
  24. + " input : " + web3.toAscii(e.input))+"n";
  25.  
  26. })
  27. }
  28. }
  29. else {
  30. console.log('Error: '+error);
  31. }
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement