I have some doubts regarding the Smart Contracts. First of all, I know that when I deploy a Smart Contract, this will have an address. We can suppose that I deployed the smart contract on blockchain. So my questions are:

  1. Is it true that a smart contract can be invoked only if a user make a transaction towards the smart contract address?

  2. If an user A make a transaction towards user B, or C, and so on, can the smart contract self-execute?(be careful, the transaction is not towards the smart contract itself).

  3. Can a smart contract work like a listener on all blockchain transactions and execute itself if there are all necessary conditions to activate it?

1 Answer 1

  1. Correct. There are 2 kinds of accounts on the blockchain. One is EOA (externally owned accounts) and the other is contracts. Contracts can be created by contracts or by EOAs, but all transactions must originate from EOAs. EOAs can, however, call contracts that call other contracts.

  2. A smart contract can not execute unless a user or smart contract makes a call directly at it. A way to do your original thing would be for the contract to be a proxy contract that, along with doing what the original user wanted to do, also did something else. The user would then call the function on the contract.

  3. Again, a smart contract can only be triggered by external transactions or by another smart contract (which must be, someone up the line, called by an external transaction). What you could do in this case is have a script watching the blockchain for these conditions to be satisfied after which your script would create a transaction to the smart contract.

  • Could be the transaction validated by the validators using a consensus protocol like PoS, PoW, PoA? Or the smart contract is itself a consensus mechanism?
    – CipherX
    Feb 15, 2018 at 20:00
  • Transactions are validated by the miners/validators. Contracts aren't the consensus mechanism.
    – natewelch_
    Feb 15, 2018 at 20:04
  • Ok so could I use the aforementioned consensus mechanisms right?
    – CipherX
    Feb 15, 2018 at 20:07
  • What do you mean? When you send a transaction to the Ethereum network, it is validated by nodes, and mined by a miner. You don't have to validate the transaction yourself, unless you need to validate data sent with a function cal.
    – natewelch_
    Feb 15, 2018 at 20:08
  • Yes I agree with you, but I mean that basically a transaction is mined by using a consensus mechanism like PoS, PoW or PoA, so it's important specify what is the consensus mechanism adopted
    – CipherX
    Feb 15, 2018 at 20:11

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.