I've read a few other questions/answers on smart contract consensus by nodes in the network, but I still don't understand the steps. Here's how I picture it:
- Two parties might agree upon a smart contract, sign with their private keys
- Nodes validate that those parties are who they say they are
- Smart contract is appended to the blockchain
Let's say that the contract was a simple payout from Adam to Bob depending on the day of the week (Monday = 1 bubblecoin, Tuesday = 2 bubblecoins, etc.)
Part of the code might look something like this:
If Monday, send 1 from Adam to Bob, else
If Tuesday, send 2 from Adam to Bob, else
If Wednesday, send 3 from Adam to Bob....
My question is, if we ran the code on Wednesday, what do those nodes do? Do they check to make sure the code within the contract is the same as what every other node sees? Or do they actually run the code, get the output (here it would be 3 from Adam to Bob), and compare that OUTPUT with others in the system? If they compare output, what if the output is different between nodes? I'm hoping that providing an example contract will help me visualize what is actually being agreed upon by the nodes.