一、什么是智能合约
传统意义上的合约,就是双方或者多方共同协议做或者不做某事来换取某些东西。合同中的每一方必须信任彼此能够履行义务。而智能合约的特点是:同样是彼此之间同意做或者不做某事,但是无须再信任彼此。这是因为智能合约不但是由代码进行定义的,也是由代码强制执行的,完全自动且无法干预。智能合约一旦编写好就可以被用户信赖,合约条款不能被篡改,不需依赖第三方执行合约,消除了中间人,大大减少了花费在合约上的金钱和时间。
In the traditional sense, contracts are made either by mutual agreement or by mutual agreement. Each party in a contract must trust each other to fulfil its obligations. Smart contracts are also characterized by agreement to do or not to do something between them, but no longer need to trust one another. This is because smart contracts are defined not only by code, but also by code enforcement, and are completely automatic and non-intrusive.
下面以一个大家所熟知的房租租赁为例让你更了解智能合约。
Here's an example of a well-known rent lease to make you more aware of smart contracts.
1.房屋出租的智能合约应用场景
假设王昭君与貂蝉需要构建一个区块链智能合约,目的是王昭君将其房屋出租给貂蝉,租金为2000元一个月,押二付一,每月月初支付,租期为一年。假设王昭君的房屋门锁可通过互联网控制,其开锁密码为pwd(每月生成一次),王昭君的银行账户为A,貂蝉的银行账户为B。智能合约的执行包含以下步骤:
Assuming that Wang Xiaojun and Yu need to build a block chain smart contract, the purpose of which is that Wang Xiaojun rents his house for a month at a rent of 2,000 dollars, bet two to be paid for one month at the beginning of each month, the lease term is one year. Assuming that Wang Xiaojun's house locks are controlled through the Internet, their open password is pwd (generated once a month), Wang Xiaojun's bank account is A, and Wang Xiaojun's bank account is B. The implementation of the smart contract involves the following steps:
1.王昭君与貂蝉提交合约构建申请给智能合约服务器,生成合约并由服务器发布到区块链生效。
1. Wang Xiaojun and Yu submitted a contract construction application to an intelligent contract server, which generated the contract and was published by the server for entry into force of the block chain.
2.王昭君将密码pwd以及银行账户A提供给智能合约服务器。
2. Wang Zhaojun provided the password pwd as well as bank account A to an intelligent contract server.
3.貂蝉通过银行账户B向智能合约服务器支付2000*2=4000元的资金作为抵押,并支付第一个月的房租2000共计6000元。
3. Funds in the amount of US$2000*2 = US$4,000 are paid as collateral through bank account B to an intelligent contract server and in the amount of US$6,000 for the first month of rent.
4.合约开始执行,智能合约服务器将密码发送给貂蝉,并从貂蝉在该合约中的资金扣除2000元,发送到王昭君的账户,同时生成参与对象记录存入区块链。
4. The implementation of the contract began, with the smart contract server sending the password to Yu and deducting the amount of $2,000 from the funds in the contract and sending it to Wang Xiaojun's account, while generating the records of the participants to be deposited into the block chain.
5.每个月智能合约都会定期检查,如果合约未到期,则继续从合约资金中扣除2000元发送到王昭君的账户中,并发送密码给貂蝉;若合约资金不足4000,将停止发送密码。最后生成参与对象记录存入区块链。
If the contract is not due, the amount of $2,000 will continue to be deducted from the contract funds and sent to Wang Xiaojun's account and the password will be sent; if the contract is not fully funded by 4,000, the password will be stopped.
6.所有参与者都可以通过区块链查询合约执行情况。
6. All participants have access to the block chain for information on the implementation of the contract.
7.租约到期后,智能合约服务器将4000押金退还貂蝉,并生成一条合约记录,标示合约终止并发布到区块链,合约停止执行。
7. Upon expiration of the lease, the smart contract server refunds the deposit of 4,000 and generates a record of the contract, indicating the termination of the contract and its release to the block chain, and the contract is suspended.
2.智能合约与传统合约的异同
智能合约与传统合约有相似之处,比如均需要明确合约参与者的权利、义务,违约方均会受到惩罚等。但是智能合约与传统合约存在着显著的区别,如下表所示:
Smart contracts have similarities with traditional contracts , such as the need to clarify the rights, obligations, and penalties for defaulters. However, there are significant differences between smart contracts and traditional ones, as shown in the following table:
在上面的房屋租赁例子中,双方无需通过纸质合同进行约定,只要按照双方达成的共识构建智能合约即可,后续所有的事情都会由智能合约强制执行。房东不需要担心租客不付房租了,一旦租客违约,租客将无法得到房屋的密码。
In the above-mentioned case of rental of a dwelling, the parties do not have to agree on a paper contract, as long as they build a smart contract on the basis of a mutual agreement, and everything that follows will be enforced by a smart contract.
以太坊(Ethereum)是一个能够在区块链上实现智能合约、开源的底层开发平台,每个人都可以利用以太坊开发出自己的虚拟货币体系。它是在2013年年底由Vitalik Buterin 所提出的技术。以太坊和比特币相似,是一个开源的,基于区块链技术的分布式计算平台,它强调自己是一个智能合约系统。
Etheeum is a bottom-of-the-ground development platform that allows intelligent contracts to be made on the block chain, and everyone can use it to develop their own virtual monetary system. It was introduced by Vitalik Buterin at the end of 2013. It is an open-source, distributed platform based on block chain technology that emphasizes itself as a smart contract system.
为了支持这个系统,Vitalik Buterin和他的团队在2014年的7月至8月,针对公众销售了他们自己的以太坊系统上的货币 —— 以太币( Ether , 简称 ETH )
In support of the system, Vitalik Buterin and his team sold their own currency on the Ether system -- in (Ether, ETH) from July to August 2014 for the public.
1.初识代币
1. First-time coins
前文已经提到,以太坊可以创建任何智能合约,包括可以表示数字资产的智能合约,而这些数字资产被称为以太坊代币,比如今年夏天火爆的各种ICO,如Bigone,Qash等以太坊代币。这有点类似于 Apple商店是提供 iOS apps 的平台,其中部分 apps 会在它们的游戏或平台中发行数字货币。然而,和 Apple 不同的是,以太坊没有中心实体来控制哪些 apps 可以上 App Store,每个人都可以在以太坊上发行代币(去中心化)。
As already mentioned, digital assets are known as as /b> is a bit similar to the Apple store as a platform to provide iOS apps, some of which distributes digital currency in their games or platforms. However, unlike Apple in the form of
2.以太坊代币标准ERC20
2. Using the Taiyo Currency Standard ERC20
在以太坊上,代币遵循相同的标准,这样代币之间的兑换和Dapp(去中心化应用)支持就会变得容易。
In Etheria, tokens follow the same criteria so that exchange between tokens and Dapp support becomes easier.
目前以太坊主流的代币标准是ERC20。
The current standard of currency in the Taiku mainstream is ERC20.
ERC20 标准在2015年11月份提出,使用这种规则的代币,表现出一种通用的和可预测的方式。简言之,任何 ERC-20 代币都能立即兼容以太坊钱包(几乎所有支持以太币的钱包,包括Jaxx、MEW、imToken等,都支持 ERC-20的代币),由于交易所已经知道这些代币是如何操作的,它们可以很容易地整合这些代币。这就意味着,在很多情况下,这些代币都是可以立即进行交易的,为资金流动提供了极大的方便。
The ERC20 standard, introduced in November 2015, shows a generic and predictable approach to the use of such a rule. Simply put, any ERC-20 tokens can immediately be compatible with the tatai purse (almost of the wallets in favour of Tai currency, including Jax, MEW, imToken, etc., support ERC-20 tokens) , which can easily be integrated by the exchange because they already know how to operate. This means that in many cases they can be traded immediately, and provides a great facility for financial flows.
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论