Smart contracts
Let's now move on to the primary user of the ledger—a smart contract.
A central role in the network
A ledger is important because it immutably stores multi-party transactions. Our attention now turns to how a smart contract helps generate these transactions in the first place.
As we begin, we issue a gentle caution to the reader! When compared to a program that reads and writes to a database over which it has complete control, a smart contract may not exhibit the behaviors we expect. Specifically, we'll see how a smart contract can sometimes:
- Read and write to the ledger, as we would intuitively expect
- Read from the ledger, but cannot write to it
- Write to the ledger, but cannot read from it
We realize that these statements may seem counterintuitive at the moment, but they stem from the fact that a blockchain is owned by multiple organizations, and every organization must agree to ledger changes in a mechanism...