I want to listen to an event from inside another (deployed) smart contract.

I am a complete noob to Ethereum and Solidity. So please excuse me for stupid questions, I might have misunderstood everything.

I want to listen to an event inside a deployed contract C1. And when a certain event takes place a want to call a function on another contract C2.

For example, there is a token called Matryx Token, Solidity code can be found here at EtherScan.io

In the Solidity code there is a contract MintableToken is ReleasableToken, inside that contract there is an event event MintFinished();.

How can I listen to this event and then call a function on another contract C2?

I am an experienced Swift developer. So I was thinking of writing this as a macOS app or iOS app. I found Geth, Go Ethereum, mobile client but it is a bit unclear how I can listen to events.

So maybe the easiest way would be to develop my own Solidity "program" (dApp?) and deploy it as a smart contract?

Where I would make most functions private or onlyOwner?

Is it possible to call a non constant nor public function on a smart contract (C2)? 😬

I do not understand the answer given for this question (possible duplicate)
Can a contract listen to events of another contract?

  • 1
    As the first line of the selected answer says "A contract cannot listen to events". You have to implement a service outside the blockchain which forward events to your contract.
    – Ismael
    Sep 22 '17 at 15:28
  • Ismail i linked to that question myself, in the bottom of my question, but as I said I do not understand that answer.
    – Sajjon
    Sep 22 '17 at 15:28
  • 3
    The answer cannot be more clear "A contract cannot listen to events".
    – Ismael
    Sep 22 '17 at 15:31
  • Thanks for that Ismail but what about my other questions? 😀
    – Sajjon
    Sep 22 '17 at 18:44
  • 1
    Everything in the blockchain is public, there's no private storage. A dapp usually is a web app that 'talk' to a Ethereum node to query a smart contract state and can create transactions on behalf of a user to modify the contract state. A smart contract is a code on the blockchain state that only is executed when someone send a message to it. You cannot do heavy computation, the storage space is expensive, and the amount of computation in a single transaction is limited. I'd suggest to search for already answered question and create separate ones if you have more doubts.
    – Ismael
    Sep 23 '17 at 5:03

I got good answers in comments from @ismail, thank you. But I am posting an answer here for references regarding my question:

Q: Is it possible to call a non constant nor public function on a smart contract?

Everything that is inside a contract is visible to all external observers. Making something private only prevents other contracts from accessing and modifying the information, but it will still be visible to the whole world outside of the blockchain.

Taken from Solidity documentation here

  • Use the button "Ask Question" to create a new question, and if you wish you can put a link to this question in the body. You are writing an answer instead and will not have much visibility.
    – Ismael
    Sep 23 '17 at 13:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.