1

I am trying to get some logs from ropsten and here is my code:

web3.eth.getPastLogs(
  {
    address: '0x3b873a919aa0512d5a0f09e6dcceaa4a6727fafe',
    fromBlock: 3292448,
    toBlock: 3292448,
  },
).then(console.log).catch(e => console.log(e));

which results in error:

Error: Returned error: invalid argument 0: hex string without 0x prefix

what am I doing wrong?

1

Convert it to Hex:

fromBlock: web3.utils.toHex(3292448)
toBlock: web3.utils.toHex(3292448)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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