I am developing a Dapp that contains a notification between two Users. for example :

  • User 1 (Student): send a transaction that contains data to be confirmed.

  • User 2 (Professor): receive a notification to validate the student data.

  • User 1 (Student): receive a notification about the professor answer.

is't possible to implement this use case using smart contract events? I took a look to web3.shh but it seems like it miss documentation

1 Answer 1


You can doing that by create your event in your Smart Contract like :

event StudentData(address indexed _professorAddr, string indexed _studentData)

Then, using web3 api you can watch/listen for this events by filtering on the professor address by exemple, and trigger any action, like a notification, when the event realise

See documentation about events listening.

  • thnks for your quick answer. but how much time can an event live? let's say the professor will open the app after 3 week of the student submission ?
    – maroodb
    Commented May 3, 2018 at 8:43
  • According Solidity Documentation about events, it seems that events logs are stored in the blockchain, so the events are keep alive a long time that blockchain is alive I think. So in your case, when the professor open the Dapp the watch for event function start to listen from the first block to latest one and show you all of them.
    – Lbrth_BoC
    Commented May 3, 2018 at 8:57
  • Quoting the Solidity docs: "These logs are associated with the address of the contract, are incorporated into the blockchain, and stay there as long as a block is accessible (forever as of now, but this might change with Serenity)". Commented Jul 16, 2021 at 18:29

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.