0
web3.eth.getPastLogs({
    fromBlock : 3150168,
    toBlock : 3153168,
    address: "0xAD08C190Ed643ec60afBbAEB2E284F616F3C3b43",
    topics: [topics]
})
.then(result=>{})
.catch(error=>{})

how to define topics parameter?

0

topics - Array: An array of values which must each appear in the log entries. The order is important, if you want to leave topics out use null, e.g. [null, '0x12...']. You can also pass an array for each topic with options for that topic e.g. [null, ['option1', 'option2']]

Source - https://web3js.readthedocs.io/en/1.0/web3-eth.html#getpastlogs

e.g. topics: ["0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234"]

In order to calculate topic you need to generate SHA3 from event signature, looks like:

const transfer = web3.utils.keccak256("Transfer(address,address,uint256)");
  • thanks for responding but i want to get ether transaction history not the token – rahul saini Oct 13 '18 at 12:05
  • 1
    @rahulsaini I think it is not possible with getPastLogs. In order to do this, you need to explore whole chain – Aquila Oct 13 '18 at 12:20
  • hi @Aquila i also found the same i tried getPastLogs and subscribe method but did not get anything for ether transaction – rahul saini Oct 13 '18 at 18:57
  • I mean you need to explore chain by your own – Aquila Oct 13 '18 at 19:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.