I read the following in Andreas Olofsson's answer:

Events can also be filtered by the hash of the transaction that generated the event

Would someone please post an example of how to do this with oo7-parity.js, web3.js or ethjs ...

I've not found any particularly helpful examples in the the docs


1 Answer 1


So this can be done by watching for contract events, optionally from a specified sender, and then filtering the result by the transaction hash. Here's an example using web3.js:

const Web3 = require('web3');
const web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider(''));

const multiSigWalletFactoryAddress = '0xF935...c5B9F1f';
const MultiSigWalletFactoryABI = [{"constant":true,"...","type":"event"}];
const MultiSigWalletFactory = web3.eth.contract(MultiSigWalletFactoryABI);
const multiSigWalletFactoryInstance = MultiSigWalletFactory.at(multiSigWalletFactoryAddress);

const event = multiSigWalletFactoryInstance.ContractInstantiation({sender: '0x72D0...ef412F'});

event.watch(function(error, result) {
  if (error) {
    console.log('error', error);
  } else {
    // here the transaction hash can be checked and filtered on
    console.log('result.transactionHash', result.transactionHash);
    // here the arguments from the Event can be read
    console.log('result.args', result.args);

Docs: web3.eth.filter, contract-events

To help others that might stumble over the same gotcha, one reason I was struggling with getting this to work was because I was testing https://kovan.infura.io/ and didn't realise that eth_newfilter is not one of their supported json rpc methods

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.