I want the address of the wallet interacting with the smart contract (the 'from' address in the tx receipt). I can get the smart contract event and parse the event log in the below code but ideally I don't want to have to make another call after getting the smart contract event log. Is it possible to get the address interacting with the smart contract straight from the event log itself?

// use a http provider
async function parseLog(log){
    const tx = await web3.eth.getTransactionReceipt(log.transactionHash)
    console.log(`from: ${tx.from}`)
// use a ws provider
var subscription = web3.eth.subscribe('logs', {
    address: address
}, function(error, result){
    if (error){
        console.log('error: ' + error)
.on("connected", function(subscriptionId){
    console.log("connected " + subscriptionId);
.on("data", function(log){
    // publish something to the subscriber
.on("changed", function(log){
    console.log("changed " + log);

1 Answer 1


No, this data isn't saved in logs, unless a contract explicitly emits it as one of its parameters.

Here's an example of a log event -

"logs": [
            "transactionIndex": 54,
            "blockNumber": 28164257,
            "transactionHash": "0x7ffc8534b6aa57decfc21c9325eff0c6d8e94e220abb6394cfe0a481ae0fa794",
            "address": "0xf28164A485B0B2C90639E47b0f377b4a438a16B1",
            "topics": [
            "data": "0x000000000000000000000000000000000000000000000000001546c9a6ed714e",
            "logIndex": 356,
            "blockHash": "0xf7f71edf1dc9b4b1128a6de74c289f2b54f630e5725f617fcab2f84a7ba275ca"
  • address is the emitting contract
  • topics are event signature and indexed parameters
  • data contains the non-indexed parameters

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.