Lecture 2 Smart Contracts and Solidity Basics1
Lecture 2 Smart Contracts and Solidity Basics1
Tilburg University
Masters Program in Business Law
May 3, 2017
1
Outline
A. BLOCKCHAIN
B. ETHEREUM VIRTUAL MACHINE
C. SMART CONTRACTS
D. EXAMPLES OF SMART CONTRACTS IN LAW
I. DAO
II. HEALTH DATA
III. SMART PROPERTY
IV. BOND TRADING
E. SOLIDITY
F. SOLIDITY CODING EXERCISES:
I. BASIC CONTRACT IN SOLIDITY
II. STOCK ISSUANCE AND TRANSFER 2
Blockchain Technology for Smart Contracting
What is Blockchain?
• A data structure
• Wait a minute, what is data structure?
• Arrangement of data in computer memory
• Any real life example?
– PDF Docs
– Excel sheets
– MySQL Table
• Imagine it as a book where each page reference to the previous page through a page
number one less than a current page number.
• Easy to detect if a page has been removed
• Easy to arrange the pages & identify suspicious activity. That’s why page numbers
are important in agreements.
• Wait! What if the content of the page has been altered?
• Then in that case, lets produce the page number by crunching the content of the
previous page.
• Ah! Now it makes sense. If anyone changes the content of the page then the next
page number will not match if we try to generate it using altered page content.
Ref: bitsonblocks.net
• So in real Blockchain case, each block is built on top of the recent block and use its
previous block’s content as a signature.
• Building a block & adding it in the Blockchain is the task of the miner nodes.
• In public Blockchain it is made computationally difficult to add a block to prevent
attacks.
• Miners try to guess a number in such a way that if it gets crunched with the most
recent block’s fingerprint than it will create a new fingerprint which will be less that the
last/most recent block in the Blockchain.
• It takes time & computational power to add a Block in the Blockchain. Hence there is
some reward (25 BTC in case of Bitcoin Blockchain)
• Private Blockchain can chose other methods to add a block as they can trust the
miners using a contract etc.
Peek inside a Sample Block
Blockchain Inherently Solves:
• Paper waste. Payers alone $375B in 2015
• Information is stored in mixed formats, in different places
• Data in transit and at rest is unencrypted; 35-40% of all healthcare
data per HIMSS survey
• Consumers do not own their information assets
• BMC report “Billing and insurance-related administrative costs in United States” goo.gl/sAVOco
“Digital identity systems must be designed so
the disclosure of identifying information is
limited to parties having a necessary and
justifiable place in a given identity
relationship.”
Ethereum is a platform that makes it possible for any developer to build and publish
next-generation distributed applications.
CONTRACT-BASED
Sending a transaction to a contract causes its code to execute. Contracts can store
data, send transactions and interact with other contracts.
NOT ALL CONTRACTS ARE ALIKE
Ethereum can be used to codify, decentralize, secure and trade almost anything.
Ethereum Mission Statement
NODE - PEER(B)
if wallet.balance >
100
then
wallet.send(tom,10)
= # of shares
= name/category of shares