
Ask HN: How Ethereum (smart contract) works? - billconan
Hello,<p>I have been looking at smart contract and ethereum today. I have very good understanding of bitcoin and some knowledge about smart contract.<p>but there are some details I don&#x27;t understand and I wan&#x27;t able to find good explanation.<p>I know that as part of block verification, everyone on the ethereum network needs to run all the triggered contract codes and verify the execution with others&#x27;.<p>how does this work? how can you verify other people&#x27;s execution of a program? does it only look at the output of a program? or the storage change of that program?<p>for example, a contract transfers $10 to a person A. how do I check if this contract has been executed or not by another person B? if it only looks at the output of the program or storage change, he can easily fake the result, right?<p>also, since the contract code runs on everyone&#x27;s computer, how to prevent race condition and control execution times?<p>for example, I wrote a contract to transfer $10 to a person as a penalty, if I lost his book. How can I make sure this contract will only be executed once, as I don&#x27;t want multiple $10 being transferred to that person?<p>Thanks.
======
chrispeel
Many of your questions would equally apply to Bitcoin. For example, your
question about transferring $10 to person A applies to Bitcoin as well.
Ethereum uses a blockchain, as pioneered by Bitcoin to ensure that
transactions are not spent twice.

For your last example, you might put the $10 in escrow, with a key held by
you, one by the book owner, and one by a trusted third party. If you lose the
book, if the third party and book owner agree, your money is released from
escrow.

