0

I have a smart contract that emits an event, and I've set-up a listener in my client-side app that can register this event. But I'm curious, who receives this event? If say 20 different people from around the world are currently using my app, will all of them receive all triggered events?

For example, let's say I have two people using my app, client A and client B, and a function in my contract called buildHouse(). client A calls buildHouse(), and this in turn emits a HouseBuilt() event. Client A then receives the HouseBuilt() event and takes the appropriate action - and all is good. But will client B also receive this same event? Or does the contract somehow know which particular client called buildHouse(), and only sends the event there?

Any help is much appreciated.

1

Any event emitted in the smart contract is stored in transaction receipt object, and hence in transactionRoot tree. So yes, B will also receive the same event, as they share the same blockchain. But if we are talking about practical applications you can always add some sort of filters, to only notify the users whose address was mentioned in event logs. Hope this helps.

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.