chainfrog WHAT ARE SMART CONTRACTS?

Similar documents
The Blockchain Trevor Hyde

Blockchain 2.0: Smart Contracts

EVERYTHING YOU NEED TO KNOW ABOUT DIGITAL LEDGER TECHNOLOGY, THE BLOCKCHAIN AND CRYPTOCURRENCIESÓ (Part I June 2018)

Blockchain: from electronic cash to redefining trust

THE SOFEROX PROJECT THE TWIN-CHAIN BLOCKCHAIN

Universal Payment Channels

What Blockchain Means For Your Organization s Insurance Program

Blockchain made Simple

L3. Blockchains and Cryptocurrencies

Surface Web/Deep Web/Dark Web

What Is BlockChain? X

Table of contents. 2

The Blockchain Technology

Blockchain Technology: Concepts. Whitepaper 1

In the future, many kinds of cryptocurrencies will be born, and service competition will increase.

Where traditions and innovations complete each other

FLASH TOKEN WHITE PAPER

LinkedIn /in/petkanic/

BLOCKCHAIN: AN OVERVIEW

10 Errors to Avoid When Refinancing

Computer Security. 13. Blockchain & Bitcoin. Paul Krzyzanowski. Rutgers University. Spring 2018

Bitcoin, Blockchain Technology, Block Chain Ecosystem : What You Need to Know?

THE MOST INNOVATIVE AND LUCRATIVE WAY TO EARN BITCOIN.

Bitcoin. CS 161: Computer Security Prof. Raluca Ada Poipa. April 24, 2018

3Three examples. of blockchain smart contracts Internet of Things, commercial paper and daos

White Paper. Bizanc Blockchain

Introduction to Blockchain Rick McMullin, bitheads, inc.

November 2018 Abstract

Blockchain: Programming And Technology Guide 2 In 1 By Charles Jensen READ ONLINE

Accounting for crypto assets mining and validation issues

Loyalty program on the Credits blockchain platform Building a program with blockchain and smart contracts. Issuing tokens as loyalty points.

Lyves Trustworthy payments despite anonymity. Version 2.4.1

Intermediate conversion for automated exchange between cryptocurrency and national currency. Inventor: Brandon Elliott, US

A.J. Bahou, LLM, MSECE Bahou Miller PLLC

The Time is now EPOS. Everything is Possible A new era has started. Don t pass it. It s your chance to make a change!

Building Blockchain Solutions

primechain building blockchains for a better world

Blockchains. How crypto-currencies work. Luke Anderson. 19th May University Of Sydney.

USER GUIDE. How To Get The Most Out Of Your Daily Cryptocurrency Trading Signals

BLOCKCHAIN/CRYPTOCURRENCIES AND CYBERSECURITY, THREATS AND OPPORTUNITIES

Version 1.0. The Blockchain An architectural view

Cisco Live /11/2016

T H E R I S E O F W W W. A I O N N E X T. C O M

Mr M didn t think MBNA had offered enough compensation. He said it hadn t worked out his compensation in the way we d expect it to.

SECRET COIN WHITE PAPER

Blockchain & Bitcoin. Länsstyrelserna David Bauman

Blockchain Developer TERM 1: FUNDAMENTALS. Blockchain Fundamentals. Project 1: Create Your Identity on Bitcoin Core. Become a blockchain developer

Bitcoin. CS 161: Computer Security Prof. Raluca Ada Popa. April 11, 2019

Bitcoin (BTC) C$4,943 (US$3,745) November 26, 3:15 pm

An Orientation to Investment Club Record Keeping

Cryptocurrency and Blockchain Technology

No se encuentran entradas de índice.

The DAO Chronology of a daring heist and its resolution

Name: Preview. Use the word bank to fill in the missing letters. Some words may be used more than once. Circle any words you already know.

MANO Coin Light Paper. The Masternode Foundation

Initial Coin Offering Token (ICOT) White Paper V 1.4

Distributed and automated exchange between cryptocurrency and traditional currency. Inventor: Brandon Elliott, US

Instructor: Daniele Venturi (Slides from a series of lectures by Stefan Dziembowski)

Blockchain Demystified

CMR White Paper THE ICO STARTER

Transferring Data through an Ethereum Blockchain using Transactions

WHITEPAPER. Copyright 2018 Fox Trading FX

Blockchain Bitcoin Ethereum Blockchain Beginners Guide To Understanding The Technology Behind Bitcoin Cryptocurrency The Future Of Money Box Set

Operated from European Union Helsinki Finland

Journal of Multistate Taxation and Incentives (Thomson Reuters/Tax & Accounting) Volume 28, Number 4, July 2018

DEx.top Technical White Paper (V1.0)

Blockchain Technology. State Legislative Update July 2018

you ll want to track how you re doing.

Blockchain & Smart Contracts. Project Management tools in the 21 st Century

Blockchain: An introduction and use-cases June 12 th, 2018

The Blockchain Game Changer

Democratic Cryptocurrency Unity

Investing in the Blockchain Ecosystem

APPLE BLOCKCHAIN COIN

arxiv: v1 [q-fin.gn] 6 Dec 2016

Blockchain and Trucking: The Promise and Potential

WHO NEEDS THE BLOCKCHAIN AND WHY? (OR WHY NOT) David V. Croft

Table of Contents. 1. What is Cryptocurrency? 2. What is ArthaCoin? 3. Introduction. 4. Technology Platform. 5. What is ERC20?

Bitcoins and Blockchains

HOW TO BUY A CAR WITH BAD CREDIT

Blockchains, Smart Contracts (DApps), and Regulation

11 Biggest Rollover Blunders (and How to Avoid Them)

IFRS Today. Introducing blockchain and cryptocurrencies. KPMG s podcast series on IFRS and financial reporting EPISODE 4 TRANSCRIPT. Host.

Banking YourMoneyCounts

LEVERAGE. Whitepaper v1.0.5 (April 2018)

$110100$010. Crypto Currencies. Good or Evil? 10$ $100010

Blockchain and the Maritime Industry

CHALLENGES AND RISKS OF BLOCKCHAIN TECHNOLOGY

Bitcoin (BTC) C$8, (US$6,308.36) October 29, 3:15 pm

SME Banking: Financing & Digital Banking

/// BLOCKCHAIN TECHNOLOGY THAT S READY TO ROLL

Will Blockchain Change the Audit? Zhiyong Li. Jianghan University, Wuhan, China. Introduction. The Blockchain Technology

A block chain based decentralized exchange

Pottery Research is an organization that uses knowledge of law and financial markets, where it interacts, to assist investment and business stability

WHITEPAPER V4.1. Copyright 2018 Fox Trading FX

CONTENTS DISCLAIMER... 3 EXECUTIVE SUMMARY... 4 INTRO... 4 ICECHAIN... 5 ICE CHAIN TECH... 5 ICE CHAIN POSITIONING... 6 SHARDING... 7 SCALABILITY...

Gunning For Stops By: Lan H. Turner

MASTERNET.IO WHITEPAPER WHITEPAPER

Primechain-CONTRACT. 16 th March A private blockchain for contract management - secure storage, authen8ca8on & verifica8on. Save?

How Blockchain Can Help Secure Connected Devices

Transcription:

chainfrog WHAT ARE SMART CONTRACTS?

WHAT ARE SMART CONTRACTS AND WHERE AND WHY WOULD YOU USE THEM A question I get asked again and again at lectures and conferences is, what exactly are smart contracts? Are they going to replace conventional contracts? Are lawyers going to be ousted by programmers in the future? Can smart contracts fully automate the running of a company? It s not the simplest concept to get your head around, but in this article I will describe what they are, what they can and can t do, and what some of the risks associated with them are. We ll start with the history of smart contracts and blockchains, get the technical part out of the way, and then look at the social side of smart contracts.

SMART CONTRACTS ON THE BLOCKCHAIN If you have a public, open accounts ledger that is tamper-proof, with a system that allows anyone to create their own unique bank account number, the simplest method for storing the balance of an account would be to treat the bank account number as a computer variable each account number has a value, or balance. Transferring coins from one account to another would then simply involve subtracting the amount to transfer from one account, and adding the same amount to the second account. As long as everything balances out, things are good. Before After ACCOUNT A ACCOUNT B ACCOUNT A ACCOUNT B Bitcoin scripts Satoshi Nakamoto the inventor of Bitcoin took a longer term view. He (or she, or they, as Nakamoto s true identity is unknown)

considered the fact that with a public ledger, there might be a need for more complicated transactions than just transfer X coins from A to B. For example, what if you wanted to have transfers that require multiple parties to sign off on the validity of the transaction, or if you want to have transfers that can be redeemed after a set waiting period, or perhaps even some other esoteric transaction that no-one has thought of yet? In 2009 when launching Bitcoin, Nakamoto implemented the value transfer system using a programming language that allows you to submit short programs to the peer-to-peer network, and which are run on each node within the network. In simpler terms: within the computer program running a Bitcoin node, there is a virtual machine : something similar to a tiny scientific calculator with a limited form of memory and some functions for handling the checking of digital signatures. When you transfer bitcoins from your address to someone else s address, what you are actually doing is submitting a short simple computer program, known as a script, to the Bitcoin network and hence to copies of this tiny calculator on every node. The script is checked by each one to make sure it is a valid program and that it returns a value of true when run, and if it does the script is added to the blockchain.

At a later point, when the person you sent the bitcoins to wants to send them on to another address, they submit another script that references your earlier script, and as long as running their new script returns a results of true, the bitcoins are transferred onwards. The diagram below shows this in a simplified form (there are a heap of technicalities involved in the actual system, but we don t need to discuss them here). Blocks and Scripts Effective Balances BLOCK 200 I mined this block I therefore get 50Ƀ Thanks, A A = 50 BLOCK 291 I have 50Ƀ from mining block 200 Send 10Ƀ to K Return the change (40Ƀ) to me Signed, A BLOCK 459 I received 10Ƀ from A in block 291 Send 5Ƀ to L Send 5Ƀ to M Signed, K A = 40 K = 10 A = 40 K=0 L=5 M=5

In a sense there really aren t actually any bitcoins being transferred from from one address to another. Instead, there is a chain of scripts scattered through the history of the blockchain, and each one when run returns the value true. Effectively, there are thousands upon thousands of tiny computer programs stored on the blockchain, and when someone submits a new financial transaction, the relevant ones are retrieved and run again to check that the transaction is allowed. These scripts are the first practical smart contracts on a blockchain. When you think about, a standing payment from your bank account to cover your electricity bill, or a subscription to a magazine, or a direct debit, are all smart contracts too!

Ethereum and Solidity Fast forward to 2013, and a young Canadian/Russian programmer called Vitalik Buterin proposes a blockchain with a Turing-complete virtual machine in each node. Although Bitcoin has a couple of dozen commands in its scripting engine, it doesn t support loops or functions, and the scripts it can run are basically concerned with moving bitcoins about under certain condition. In Buterin s system, called Ethereum, the virtual machine that runs within each node doesn t just support simple scripts, it allows complete computer programs with loops, functions, user definable variables, and everything else a programmer needs. There s even a compiler, called Solidity, that allows coders to write in a Javascript-like language and compile their programs into the machine code that Ethereum runs. But the problem with a Turing-complete machine is that there is no guarantee the programs submitted to it won t run forever. And a program that won t stop would tie up all the nodes on the peer-topeer network if they tried to execute it. It s called the halting problem, and Ethereum has an ingenious solution to it. For your program to run on the blockchain, you need to supply gas, which is paid for with Ether, the blockchain s associated cryptocurrency. Ether costs real money to buy, so programmers will only fuel up their programs with enough to achieve what they want, and if there s a bug, the program will burn through all the gas and just stop.

Apart from the added complexity, Ethereum programs, or smart contracts, are just like Bitcoin scripts. They sit on the blockchain, and when the right conditions are met, the nodes execute them. Because the underlying virtual machine is more complicated, smart contracts can implement ticketing/refund systems, or voting systems, or parallel cryptocurrencies with additional bells and whistles.

WHAT S THE CATCH? We already touched on one of the problems associated with smart contracts on Ethereum. If you make an error in your code, the program could potentially burn through a lot of your money. There are other difficulties to contend with though. Some are technical, and some are social. We ll deal primarily with some of the social ones. You can t always get what you want Imagine for a moment that you have an idea for a smart contract to manage the share ownership of your company. The contract will create a limited number of shares, and will allocate them to the current owners of the company. The idea is then that share owners can trade them on the blockchain with other people, without the need for board approval or the involvement of a broker. Smart contracts aren t like web apps, or smart phone apps, where if you find a bug you can simply push out a new version as and when you please. Therefore you need to define carefully what the smart contract can and can t do. Are you going to issue more shares later? Will there be future share split? If investors come on board, are you going to have to issue a different class of shares? What happens if a shareholder accidentally transfers their shares to the wrong person, or to a totally unclaimed address can this be fixed? Are you going to allow share-based voting on the blockchain too?

Presumably, you are not a hot-shot Solidity programmer yourself, so you will have to hire someone to write the smart contract for you. Are you capable enough to review what they produce, and ensure that what you described in English to the programmer is what was then coded up for you? Has the code been thoroughly tested, and can you be sure there isn t a subtle back-door in the contract that allows your distributed on-blockchain company to be taken over? Even if you know that your programmer is competent and trustworthy, experience has shown that when there is code, there are bugs, and they can be subtle and disastrous. The ghost in the machine If you are trying to move a legal contract into the realm of computer code, you re going to face a problem. The law doesn t just codify agreements, it carries with it a spirit of the law, and we rely on judges, juries and lawyers to interpret the meaning behind the laws we create. Even patent law, which is one of the most formal and codified sectors of the legal system, still contains non-formal concepts such as obviousness, and inventiveness. A smart contract might be able to track a work-flow through, for example, the application for a patent, but it won t be able to determine if other patents or scientific papers constitute prior art, or if the application is for an idea that is actually novel. Similarly, something that a person can immediately spot as a mistake (should that transaction to pay the entire company s bank balance to an unknown address really be executed?) is not going to be caught by a smart contract unless it s specifically coded for.

Your users will include hackers If you are running your smart contracts on a private version of a blockchain, then at least you know who your users are, and when someone misbehaves you can track them down and resort to the legal system for any major infraction, or just kick them off for minor misdemeanors. But on a public blockchain like Ethereum, anyone can see your code, and potentially interact with it. The world is full of people who seem to have nothing better to do than to sit at a terminal and probe for weaknesses, write malicious code to take advantage, or even just engage in simple vandalism. When dealing with blockchains that carry crypto-tokens with real cash value, there is an added strong incentive for hackers to look for ways to steal, rather than to just engage in mischief. The more value your smart contract backs, the more hackers are going to try to bend it to their own will. THE DAO HACK DAO STANDS FOR DISTRIBUTED AUTONOMOUS ORGANIZATION RAISED 150,000,000$ IN CROWD FUNDING WAS MEANT TO BE A DECENTRALIZED VENTURE CAPITAL FUND 50,000,000$ IN ETHER TOKENS WERE SIPHONED OFF DUE TO A BUG IN THE SMART CONTRACT CODE

Truth is an event Smart contracts can only act on data that is visible on the blockchain. They don t connect out to the real world. As a result, in order to get a smart contract to act on an outside event, you need to implement an oracle - a conventional piece of software running on an external server that, for example, might monitor the stock price of a company, or the temperature in a given location, and then writes this data back to the blockchain in a transaction. But just because some data is on a blockchain, that doesn t make it true. If your oracle is wrong, or is hacked, the smart contract will be operating on false premises, and could end up transferring a fortune in crypto-tokens in error. SMART CONTRACT STOCK MARKET ORACLE CHFG: 254$ CHFG: 258$ CHFG: 266$

SUMMARY So there you have it. Smart contracts are computer code that is submitted to a blockchain, where it sits until the right conditions are met, and then all the nodes on the blockchain network run it, and record the result. They can be used to provide an implementation of a workflow or payment instrument, moving virtual currency around as the situation dictates. They can even connect in to external events through outside systems called oracles, that forward real life data onto the blockchain. But they carry a lot of risks. Smart contracts are difficult, or sometimes even impossible to update. They may contain subtle but disastrous bugs that can result in the loss of substantial value. And finally, they don t use common sense in interpreting what the right action is they just do what their code tells them to. Bitcoin uses a few simple common transaction scripts that have been run millions of times and tested over nearly a decade, and still occasional flaws or exploits surface. With more powerful smart contract systems, the opportunities may increase, but so will the risks. In conclusion, feel free to enter the world of smart contracts, but proceed with caution!