I have a contract that returns event data including the sender's address:

event Result(
    address indexed _walletAddress,
    string _name,
    uint256 _amount

And in my Node.js app I try to capture the address:

const address = result[0].topics[1];

But for some reason the address contains extra "00000000000000000000000":


How can I extract the address in the correct form?


Any help is greatly appreciated

  • 1
    The reason for the extra zeroes is, that ethereum stores everything in 32bytes. An Ethereum Address is 20bytes in length, hence the extra zeroes in the output. Feb 19, 2020 at 6:48

1 Answer 1


You can achieve that by using web3.eth.abi.decodeLog(inputs, hexString, topics);. The first parameter inputs must include the properties of the event from your smart contract, second one hexString is the bytecode of the event and the third topics is array containing the topics. Read more here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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