如何显示智能合约中的所有事件日志?

如何显示智能合约中的所有事件日志?

问题描述:

web3.eth.sendTransaction({from : web3.eth.accounts[0], to : c.address, value : web3.toWei(50)}, console.log); 

我能够返回交易散列。如何显示智能合约中的所有事件日志?

但是,如何从智能合约返回的交易中捕获所有事件日志?

您需要观看活动。

const filter = { address: web3.eth.accounts[0] }; // filter for your address 
const events = c.allEvents(filter); // get all events 

events.watch(function(error, result) { 
    if (!error) 
    console.log(log); 
    }); 
}); 

您可以阅读更多关于它here