Pages

Monday, July 17, 2017

Intro 2.0 to Smart Contracts (Very High Level)

I read an old blog post this morning called Intro to Smart Contracts. After spending the last year learning about blockchain technology, I realized that this article brought no value to anyone that read it. I apologize to the 14 people that did.
The point of this article is to actually explain what smart contracts are at a very high level.
When you buy Ether or Bitcoin, the coins that you buy are sent to a unique address. With Bitcoin, no coins are actually held at this address. The address acts as a unique identifier, like a bank account number, that allows the total of the transactions to and from this address to be calculated. Bitcoin can be thought of as a ledger that records the deposits and withdrawals from accounts. When you send a transaction via the Bitcoin network, your old balance is reduced by some amount and another account’s balance is increased by this amount. But no physical value is ever moved.
Ethereum works a bit differently. Ethereum stores a number of coins you own at an address in something called a smart contract. The ability to store information at these addresses is called the Ethereum State. Whereas Bitcoin only stores transactions that have been sent in the Bitcoin blockchain, any type of data can be stored in the Ethereum state and thereby the Ethereum blockchain. The information that is stored could range from the amount of Ether you have to the type of life insurance you own.
A smart contract is an address that holds computer code. Transactions can be sent to this address that will trigger specific functions. For example, a user could program and deploy a smart contract that holds the name of a person. When a transaction is sent to this function with a name, the state of the smart contract will be changed so that it now stores the name that was sent to it. Another person could send a different transaction to this smart contract that will return the name that is stored in this smart contract. While this is a very boring example of what smart contracts can do, smart contracts enable Ethereum to operate as a universal computer. Due to the decentralized nature of Ethereum, there are smart contracts that anyone can send transactions to. (You can also create smart contracts that only execute functions when certain people send transactions to it).
Slock.it is using the functionality that smart contracts enable in some very cool use cases. They are developing a mini Ethereum computer that allows physical objects such as bike locks, door locks, or electric charging stations to be operated by a smart contract. You can send the bike lock a transaction with a specified amount of Ether that would allow you to use it for a duration of time. This is different than a Hubway station because the only infrastructure that would be required is a blockchain enabled bike lock.
In my previous article, I stated that smart contracts use conditional statements like a contract in a bet. While smart contracts execute certain functions if a transaction containing some data is sent, smart contracts aren’t only used to write conditional contracts. Many of the use cases regarding conditional contracts, such as the Patriots winning, are difficult to implement on Ethereum. The reason for this is that the Patriots winning is an off chain event, and the Ethereum blockchain needs to be notified of this event somehow. There must be a certified off chain authority that can inform the smart contract of this condition when it occurs. Every node in the blockchain needs to receive this same exact information so that consensus can be reached. Gnosis, a prediction market platform, has developed a solution to this hurdle, but it requires a certified off chain person informing the blockchain what the outcome of the result was.