Smart Contracts
A smart contract is a computer code running on top of a blockchain containing a set of rules under which the parties to that smart contract agree to interact with each other. If and when the pre-defined rules are met, the agreement is automatically enforced. The smart contract code facilitates, verifies, and enforces the negotiation or performance of an agreement or transaction. It is the simplest form of decentralized automation.
It is a mechanism involving digital assets and two or more parties, where some or all of the parties deposit assets into the smart contract and the assets automatically get redistributed among those parties according to a formula based on certain data, which is not known at the time of contract initiation.
The term smart contract is a bit unfortunate since a smart contract is neither smart nor are they to be confused with a legal contract.
- A smart contract can only be as smart as the people coding taking into account all available information at the time of coding.
- While smart contracts have the potential to become legal contracts if certain conditions are met, they should not be confused with legal contracts accepted by courts and or law enforcement. However, we will probably see a fusion of legal contracts and smart contracts emerge over the next few years as the technology becomes more mature and widespread and legal standards are adopted.
Slashing Transactions Costs of Coordination & Enforcement
Would you enter into a contract with someone whom you’ve never met? Would you agree to lend money to some farmer in Ethiopia? Would you become an investor in a minority-run newspaper in a war zone? Would you go to the hassle of writing up a legal binding contract for a $5 purchase over the internet? For most people the answer would be no, as the transaction costs for these examples exceed the value transferred.
Smart contracts radically reduce transaction costs. Auto enforceable code – whether on the protocol level or on the application level – standardizes transaction rules, thus reducing the transaction costs of:
- reaching an agreement,
- formalization, and
- enforcement.
A smart contract can formalize the relationships between people, institutions and the assets they own. The transaction rulesets (agreement) of the smart contract define the conditions – rights and obligations – to which the parties of a protocol or smart contract consent. It is often predefined, and agreement is reached by simple opt-in actions. This transaction rule set is formalized in digital form, in machine-readable code (formalization). These rights and obligations established in the smart contract can now be automatically executed by a computer or a network of computers as soon as the parties have come to an agreement and met the conditions of the agreement (enforcement) (Glatz).
The concept of a smart contract is not new. However, Blockchain seems to be the catalyst for smart contract implementation. The most primitive form of a smart contract is a vending machine. The rules of a transaction are programmed into a machine. You select a product by pressing a number related to that product, insert the coins, the machine acts as a smart contract checking wether you inserted enough money, If yes, the machine is programmed to eject the product, and if you inserted too much money, it will also eject the change. If you didn’t insert enough money, or if the machine ran out of the money, you will get your change back. Automatic vending machines not only slashed transaction costs by making human vendors obsolete, but they also expanded service, offering 24/7 availability instead of limited opening hours of a kiosk.
Characteristics of a Smart Contract
Smart contracts are capable of tracking performance in real time and can bring tremendous cost savings. Compliance and controlling happen on the fly. In order to get external information, a smart contract needsinformation oracles, which feed the smart contract with external information.
Smart Contracts are
- Self-verifying
- Self-executing
- Tamper resistant
Smart Contracts can
- Turn legal obligations into automated processes.
- Guarantee a greater degree of security.
- Reduce reliance on trusted intermediaries.
- Lower transaction costs.
Source: sharetheledger.com
Smart Contract Example
If A and B don’t know and don’t trust each other, they usually need a trusted third party to serve as an intermediary to verify transactions and enforce them. With smart contracts & blockchains, you don’t need those trusted intermediaries anymore for clearing or settlement of your transactions. Take the example of buying and selling a car:
If Alice wants to purchase a car from Bob, a series of trusted third parties are required to verify and authenticate the deal. The process differs from country to country but always involves at least one, but usually more, trusted third parties: motor vehicle registration authority, in combination with a notary and/or insurance company. It is a complicated and lengthy process, and considerable fees for these middlemen apply.
On the Blockchain, once all involved authorities and companies are on a blockchain, a smart contract could be used to define all the rules of a valid care sale. If Alice wanted to buy the car from Bob using a smart contract on the blockchain, the transaction would be verified by each node in the Blockchain Network to see if Bob is the owner of the car and if Alice has enough money to pay Bob.
If the network agrees that both conditions are true, Alice automatically gets the access code to the smart lock for the garage. The blockchain registers Alice as the new owner of the car. Bob has € 20,000 more on his account, and Alice € 20,000 less. No middlemen required.
On the Blockchain, who owns what is transparent and at the same time anonymous or pseudonymous. This means that every computer running the blockchain protocol could check whether a certain person is the rightful owner of the car or not.
Stealing cars won’t be as easy as today, especially once we have smart keys granting access control verified on the blockchain, to unlock our future vehicles. As the owner of the car, you could authorize other people to drive it (stating the public key of the respective individual). In such cases opening the car would only be possible with a smart key on the Blockchain.
Types of Smart Contracts
Blockchain and smart contracts have the potential to disrupt many industries. Use cases can be found in banking, insurance, energy, e-government, telecommunication, music & film industry, art world, mobility, education and many more. Smart contract use cases range from simple to complex.
Time-stamping services like ascribe (art registry) or governmental and semi-governmental registries (land titles, birth certificates, birth certificates, school and university degrees) are examples for simpler technological use cases (the regulatory aspects might be more complex). Decentralized autonomous organizations, on the other hand, are the most complex form of a smart contract. TheDAO in 2016 was an example for such a complex smart contract.
Source: PricewaterhouseCoopers
Given the fact that Blockchain is still a new technology, some industries might adopt smart contracts later than others, especially if they are subject to heavy government regulation or if the uses cases require high network effects – like widespread technology adoption along the supply chain, standardization, etc. In general, it’s advisable to start out with a small pilot project of a less complex use case to build expertize and understand the technology better and move on to more complex use case at a later stage.
Further Reading
- Check out our Smart Contract Infographic
- Internet of Agreements: Building the Hyperconnected Future on Blockchains – why smart contracts could change the way people do business: by Hexayurt.Capital in collaboration with ConsenSys
- Smart legal Contracts, Florian Glatz
- OpenLaw, Consensys
Smart Contract Coding
Solidity is a smart contract programming language. The syntax is similar to that of JavaScript, and it is designed to compile to code for the Ethereum Virtual Machine, to create contracts for voting, crowdfunding, blind auctions, multi-signature wallets and more.
- Official Solidity Documentation,by Ethereum Foundation
- Solidity Tutorial, using Visual Studio
- Solidity Code Snippets, useful for Ðapp development
- Accessing Contracts & Transactions: Interacting with smart contracts
- Integrated development platform (IDE) browser-based with integrated compiler and solidity runtime environment without server-side components
- Ethereum Solidity Gitter chat channel
- Remix: IDE that allows developers to build and deploy contracts and decentralized applications on top of the Ethereum blockchain
- The Hitchhiker’s Guide to Smart Contracts in Ethereum, Manuel Aráoz, Medium
- Truffle: The most popular Ethereum development framework, Github
https://blockchainhub.net/smart-contracts/
Smart Contracts的更多相关文章
- Solidity 中文文档 —— 第一章:Introduction to Smart Contracts
第一章:智能合约简介 粗略地翻译了 Ethereum 的智能合约开发语言的文档:Solidity.欢迎转载,注明出处. 有任何问题请联系我,本人微信:wx1076869692,更多详情见文末. 我是 ...
- 【翻译】A Next-Generation Smart Contract and Decentralized Application Platform
原文链接:https://github.com/ethereum/wiki/wiki/White-Paper 当中本聪在2009年1月启动比特币区块链时,他同时向世界引入了两种未经测试的革命性的新概念 ...
- the security of smart contract- 1
https://blog.zeppelin.solutions/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05 这个 ...
- ethereum/EIPs-1271 smart contract
https://github.com/PhABC/EIPs/blob/is-valid-signature/EIPS/eip-1271.md Standard Signature Validation ...
- openzeppelin-solidity/contracts的代码学习——payment
payment - A collection of smart contracts that can be used to manage payments through escrow arrange ...
- openzeppelin-solidity/contracts的代码学习——access
https://github.com/OpenZeppelin/openzeppelin-solidity/tree/master/contracts/access access - Smart co ...
- Using APIs in Your Ethereum Smart Contract with Oraclize
Homepage Coinmonks HOMEFILTER ▼BLOCKCHAIN TUTORIALSCRYPTO ECONOMYTOP READSCONTRIBUTEFORUM & JOBS ...
- 区块链Readme.md
#Welcome to Azure Blockchain Projects This Repo host Azure related blockchain and distributed ledger ...
- 50行Python代码构建小型区块链
本文介绍了如何使用python构建一个小型的区块链技术,使用Python2实现,代码不到50行. Although some think blockchain is a solution waitin ...
随机推荐
- AJAX路径问题
如果发AJAX请求,看发送请求消息的路径,如果看到报404的错,而这个 时候看下发送头部的路径,如果看到%20,这个时候有可能就是写路劲的时候,不小心按了一个空格
- Java中Semaphore(信号量) 数据库连接池
计数信号量用来控制同时访问某个特定资源的操作数或同时执行某个指定操作的数量 A counting semaphore.Conceptually, a semaphore maintains a set ...
- 关于tensorflow中维度的问题
一直对TF中tensor的reduce操作涉及的axis(reduction_indices)计算一知半解,这里系统总结一下,避免继续走弯路: 1.本质上来说,reduce_xxx都是降维操作,沿某个 ...
- 【旧文章搬运】Windows句柄表格式
原文发表于百度空间,2009-02-28========================================================================== 句柄是Wi ...
- 学习Mahout(一)
Mahout 官方下载地址:http://apache.fayea.com/apache-mirror/mahout/ 环境ubuntu 12.04, hadoop1.2.1 ,mahout 0.9 ...
- (二)SpringBoot整合常用框架Druid连接池
一,在Pom.xml文件加入依赖 找到<dependencies></dependencies>标签,在标签中添加Druid依赖 <dependency> < ...
- try/except/finally
Python也不例外,跟其他高级语言一样,内置了一套try...except...finally...的错误处理机制 当认为某些代码可能会出错时,就可以用try来运行这段代码 使用try时,要么exc ...
- [SDOI2016]模式字符串
Description 给出n个结点的树结构T,其中每一个结点上有一个字符,这里我们所说的字符只考虑大写字母A到Z,再给出长度为m的模式串s,其中每一位仍然是A到z的大写字母.Alice希望知道,有多 ...
- Hdu 5439 Aggregated Counting (2015长春网络赛 ACM/ICPC Asia Regional Changchun Online 找规律)
题目链接: Hdu 5439 Aggregated Counting 题目描述: 刚开始给一个1,序列a是由a[i]个i组成,最后1就变成了1,2,2,3,3,4,4,4,5,5,5.......,最 ...
- 转--oracle查看允许的最大连接数和当前连接数等信息
两个参数间的关系:sessions=1.1*processes+5 目前总结的语句,在查看数据的连接情况很有用,写完程序一边测试代码一边查看数据库连接的释放情况有助于分析优化出一个健壮的系统程序来. ...