I have structure of event in my Solidity code like event test(address investor, uint256 priceinWei).

I make a request to etherscan to get all logs from contract on specific addres and get


Question: How can I get address and price from it. Should I decode "data"? Instead ... I of course got values, just don't want to show it.


You can create a reference testEvent to the event using

    var testEvent = Contract.test({}, {fromBlock: startBlockNo, toBlock: 'latest'});

and then use watch or get to on this reference to retrieve the events:

testEvent.watch(function(error, result){
    if(!error) {
        // do what you want to do with the event data


testEvent.get(function(error, result){
    if(!error) {
        // do what you want to do with the event data

Within the if(!error) {...}part you can access the data of the event from your question using result.args.investerand result.args.priceinWei.

The difference between watch and get is that getwill only give you past events, while watch will get you past events and watching for new ones.

| improve this answer | |
  • 1
    can't find it in web3 python. more accurately: yes, I can set listener but, don't get decoded info – Averin Maxim Nov 22 '17 at 12:16

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.