Ask HN: How Ethereum (smart contract) works?
I have been looking at smart contract and ethereum today. I have very good understanding of bitcoin and some knowledge about smart contract.
but there are some details I don't understand and I wan't able to find good explanation.
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'.
how does this work? how can you verify other people's execution of a program? does it only look at the output of a program? or the storage change of that program?
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?
also, since the contract code runs on everyone's computer, how to prevent race condition and control execution times?
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't want multiple $10 being transferred to that person?
Thanks.