1

Fairly basic question on smart contracts for the community.

So smart contracts "live" on the blockchain at a certain address as EVM bytecode.

When they are invoked they execute a function which may or may not change the state of the blockchain on which they "live".

My question is do the functions of a smart contract only ever alter the state of the underlying blockchain or can they also perform some kind of external function?

A simple example would be a smart contract which transfers ether to a different account (blockchain state update) and then sends an email informing the recipient of the transaction (external function not related to the blockchain)?

1 Answer 1

1

Smart contracts are isolated from the space outside the runtime environement(VM), they can not send email or interact directly with any external service. as an exception they could read external data using an oracle service.

2
  • So presumably, in our email example. Once the state of the blockchain is changed, this would have to be read by an external service which would send our email. So from a system design point of view, we would need some kind of timer to check for this blockchain state change.
    – user17571
    Aug 20, 2017 at 19:45
  • not a timer but instead an event, you will listen for a predefined event to be fired.
    – Badr Bellaj
    Aug 20, 2017 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.