The Case for Dumb Contracts
無效合約案例
來源:OpenBazaar
翻譯:Gavin
校對:Lochaiching
Disclaimer: This was written hours before the recent attack on TheDAO. The opinions in this article do not necessarily represent those held by other OpenBazaar developers.
Written by Dr Washington Sanchez
免責聲明:本文是在最近TheDAO被攻擊之前幾個小時寫的。 本文中的觀點不代表其他所有OpenBazaar開發(fā)人員持有的觀點。
由Washington Sanchez博士撰寫
譯者注:TheDAO:The DAO項目是區(qū)塊鏈物聯(lián)網(wǎng)公司Slock.it發(fā)起的一個眾籌項目翘狱。原本該公司只想采用DAO(去中心化自治)來運作自己的系統(tǒng)Universal Sharing Network (USN)肚逸。后來發(fā)現(xiàn)這個機制也適合其他項目承冰,因此決定創(chuàng)建The DAO屠橄,意為“DAO之母”骤视。
OpenBazaar receives a lot of feature requests and suggestions, which we welcome. One frequently asked question is whether we will migrate to a smart contract platform like Ethereum.
OpenBazaar收到很多功能改進相關(guān)請求和建議莱没,我們很歡迎和鼓勵這么做。 其中經(jīng)常被問到的一個問題是:我們是否會遷移到像以太坊那樣的智能合約平臺上呻惕。
There are a number of compelling reasons to move to Ethereum:
1.Ethereum has a more professional and friendly development community compared to Bitcoin Core
2.Ethereum has a larger transaction capacity, and their developers have a sensible attitude to scaling
3.Ethereum is a smart contract platform that can initiate the transfer of funds based on external triggers
這里有一些強有力的理由來讓我們遷移到以太坊上:
1.與比特幣核心相比荆责,以太坊擁有更專業(yè)和友好的開發(fā)社區(qū)
2.以太坊擁有更大的交易能力,他們的開發(fā)人員對擴展有一種明智的態(tài)度
3.以太坊是一個智能合約平臺亚脆,可以根據(jù)外部觸發(fā)器啟動資金轉(zhuǎn)移
Similarly, there are also reasons to move away from Bitcoin. The events of the ongoing block-size debate have signaled to us and other Bitcoin-related projects that the network may become prohibitively expensive in the near future.
同樣做院,也有理由讓我們從比特幣中遷移出來。 一直持續(xù)的關(guān)于區(qū)塊大小限制的爭論已向我們和其他與比特幣相關(guān)的項目發(fā)出信號濒持,表明該網(wǎng)絡(luò)在不久的將來可能會變得非常昂貴山憨。
Bitcoin Core appears to be committed to constraining the block size to drive up on-chain transaction fees and establish a ‘fee market’. Sadly, this will set Bitcoin on a course of pricing-out transactions, and ultimately people, from the blockchain (especially in the developing world).
比特幣核心似乎正在努力限制區(qū)塊大小以提高鏈上交易費用并建立“收費市場”。 可悲的是弥喉,這將使比特幣成為一種定價交易的過程郁竟,并最終吸引來區(qū)塊鏈(特別是發(fā)展中國家)的人們。
Even though we’re excited by the scaling capacity of the lightning network, the price of admission is fundamentally determined by on-chain transaction fees. Focusing on the lightning network at the expense of on-chain scaling is like upgrading to a 12-lane highway while ignoring the 1-lane onramp.
盡管我們對閃電網(wǎng)絡(luò)的擴展能力感到興奮由境,但入場價格基本上取決于鏈上的交易費用棚亩。 以犧牲鏈上擴展性為代價專注于閃電網(wǎng)絡(luò),就像升級到12車道的高速公路而忽略單車道的匝道虏杰。
Concerns such as these have prompted many of our colleagues to embrace Ethereum. But why haven’t we?
諸如此類的一些擔憂已經(jīng)促使我們的許多同行接受了以太坊讥蟆。 但為什么我們沒有呢?
1.Bitcoin. We believe that Bitcoin will become the dominant currency for global trade in the world. Short of a unfixable bug, or mass abandonment, we’re stubbornly devoted to Bitcoin.
1.比特幣纺阔。 我們相信比特幣將成為全球貿(mào)易的主要貨幣瘸彤。 只要沒有碰到不可修復(fù)的漏洞或者大規(guī)模的放棄,我們還是執(zhí)著地致力于比特幣笛钝。
2.Security. Bitcoin has existed for 7 years and survived multiple assassination attempts. The security of the network and incentives are firmly established and well-tested. Moving to a new blockchain with weaker security and brand new attack vectors is unwise and premature for OpenBazaar.
2.安全质况。 比特幣已經(jīng)存在了7年,并在多次黑客攻擊中幸存下來玻靡。 網(wǎng)絡(luò)的安全性和激勵措施已經(jīng)非常牢固结榄,并經(jīng)過充分測試。 遷移到具有較弱安全性囤捻,并且容易成為黑客們新的攻擊目標的新區(qū)塊鏈臼朗,對于OpenBazaar來說是不明智和不成熟的。
3.Network effects. The Bitcoin ecosystem is more mature and has maintained a defensible network effect.
3.網(wǎng)絡(luò)效應(yīng)。 比特幣生態(tài)系統(tǒng)更加成熟视哑,并保持了可防御的網(wǎng)絡(luò)效應(yīng)绣否。
These reasons are mostly focused on the currency and network aspects of Bitcoin. But what about smart contracts?
這些原因主要集中在比特幣的貨幣和網(wǎng)絡(luò)方面。 那智能合約呢挡毅?
Ricardian Contracts
李嘉圖合約
OpenBazaar uses Ian Grigg’s Ricardian contracts(http://iang.org/papers/ricardian_contract.html 蒜撮;中文版:李嘉圖合約究竟講了什么). In a Ricardian contract, the trading parties are represented as cryptographic identities using public key cryptography. Digital signatures are considered as a proof of agreement. The cryptographic identities of the parties, along with the semantic terms and conditions of the contract, are digitally signed and verified by both parties. Valid signatures associated with the public keys quoted in the contract validate the contract.
OpenBazaar使用Ian Grigg的李嘉圖合約http://iang.org/papers/ricardian_contract.html ;中文版:李嘉圖合約究竟講了什么)慷嗜。 在李嘉圖合約中,交易方使用公鑰加密表示加密身份丹壕。 數(shù)字簽名被視為協(xié)議證明庆械。 雙方的加密身份以及合約的語義條款和條件,都由雙方來進行數(shù)字簽名和驗證菌赖。 用與合約中引用的公鑰相關(guān)聯(lián)的有效簽名來驗證合約的有效性缭乘。
However, the contract itself is not self-enforcing. Nothing about the contract forces either party to abide by the terms and conditions they have agreed to. In many ways, Ricardian contracts are the cryptographic implementation of the title-transfer theory of contract, developed by Williamson Evers and Murray Rothbard.
但是,合約本身并不是自我執(zhí)行的琉用。 合約的任何內(nèi)容都不會強迫任何一方遵守他們同意的條款和條件堕绩。 在一定程度上,李嘉圖合約是由Williamson Evers和Murray Rothbard開發(fā)的合約所有權(quán)轉(zhuǎn)移理論的加密實現(xiàn)邑时。
Title Transfer Theory of Contract
合約所有權(quán)轉(zhuǎn)移理論
The theory states that all property has a title, or an assignment of ownership. Title can be transferred freely to another individual or exchanged for other property. In the exchange, the transfer of title is conditional upon the physical delivery of the good or service.
該理論指出奴紧,所有財產(chǎn)都有所有權(quán),和所有權(quán)轉(zhuǎn)讓權(quán)晶丘。 所有權(quán)可以自由地轉(zhuǎn)讓給另一個人黍氮,或者用來交換其他財產(chǎn)。 在交換中浅浮,所有權(quán)的轉(zhuǎn)讓取決于商品或服務(wù)的實際交付沫浆。
For example, Alice and Bob write a contract to exchange 10 chickens for 1 Bitcoin. Alice can give Bob 1 Bitcoin immediately, fulfilling her end of the contract, and retains the title to Bob’s 10 chickens. If Bob delivers the chickens, the contract is considered fulfilled with both the title and underlying property transferred to their new respective owners. If Bob fails to deliver the chickens, he has defrauded Alice of her property. The chickens rightfully belongs to Alice by virtue of the title that she holds after handing over 1 Bitcoin.
例如,Alice和Bob寫了一份合約滚秩,用1個比特幣交換10只雞专执。 Alice可以立即給Bob 1比特幣,履行完她的合約郁油,并持有了Bob的10只雞的所有權(quán)本股。 如果Bob交付了雞,則認為合約已經(jīng)履行桐腌,所有權(quán)和相關(guān)財產(chǎn)都轉(zhuǎn)移給了新的所有者痊末。 如果Bob未能送雞,他就欺騙了Alice的財產(chǎn)哩掺。 因為Alice在給與Bob 1比特幣后凿叠,擁有了所有權(quán),所以這只雞屬于Alice。
Although the title-transfer theory of contract is an excellent framework we can use to resolve disputes and understand who justly deserves property, it is unenforceable. Ricardian contracts is simply a digital format to immutably record these title-transfer agreements using cryptographic identities.
雖然合約所有權(quán)轉(zhuǎn)移理論是一個非常好的框架蹬碧,我們可以用它來解決爭議,還能弄清楚誰應(yīng)該得到財產(chǎn)炒刁,但它是無法執(zhí)行的恩沽。 李嘉圖合約只是一種數(shù)字化格式,可以用加密身份來不可變地記錄這些所有權(quán)轉(zhuǎn)讓協(xié)議翔始。
Smart Contracts
智能合約
Enter Nick Szabo with his proposal for “smart contracts”. Smart contracts simultaneously transfer both the title and good/service between transacting individuals. As a result, these contracts are said to be self-enforcing, in that valid contracts execute without human involvement. A simple example is a vending machine, which is programmatically designed to give you a candy bar after adding enough coins in the machine. A dumb contract, in comparison, would be equivalent to a customer handing over cash to a worker in a convenience store. The customer can try and steal the candy bar, or the worker can take the money and not hand-over the candy bar. Either case is a failure by one party to delivery property in exchange for title.
說起Nick Szabo提出的“智能合約”提案罗心。 智能合約在交易個人之間同步地轉(zhuǎn)移所有權(quán)和商品/服務(wù)。 因此城瞎,這些合同被認為是自我執(zhí)行的渤闷,因為有效合同在沒有人為參與的情況下執(zhí)行。 一個簡單的例子是自動售貨機脖镀,它以編程方式設(shè)計飒箭,向機器中投入足夠的硬幣后會為你提供一個糖果。 相比之下蜒灰,無效合約相當于顧客將現(xiàn)金交給便利店的工作人員弦蹂。 顧客可以試著偷走糖果,或者工作人員可以拿錢而不是交出糖果强窖。 兩種失敗的情況都是因為一方未能交付財產(chǎn)來換取所有權(quán)導致的凸椿。
Smart contracts irrevocably link the exchange of one party’s title and property with another. This is done so well that both title and property are essentially indistinguishable. Indeed, perhaps it is a matter of technological progress that title and property are considered separate entities.
智能合約不可撤銷地將一方的所有權(quán)和財產(chǎn)的交換與另一方的交換聯(lián)系起來。 這樣要是做得好的話翅溺,所有權(quán)和財產(chǎn)本質(zhì)上都是難以區(qū)分削饵。 實際上,所有權(quán)和財產(chǎn)被視為獨立的實體也許是技術(shù)進步的原因未巫。
However, smart contracts can only be made for goods or services that are digitally controlled. For example, I can create a smart contract to lease a car that conditionally gives my driver’s smartphone the capacity to start the engine, provided I am making regular payments on the lease. This won’t work for my ’71 Ford Pinto.
但是窿撬,智能合約只能用于數(shù)字化控制的商品或服務(wù)。 例如叙凡,我可以創(chuàng)建一個智能合約來租賃一輛汽車劈伴,有條件地給我司機的智能手機提供啟動汽車引擎的能力,前提是我要定期支付租賃費用握爷。 但這不適用于我71年的Ford Pinto跛璧。
Where a smart contract cannot be made directly for the item to be exchanged, the typical strategy employed is to find a proxy that mostly represents control of the underlying item. For example, I may have a refundable deposit that is tapped if a payment is missed.
如果不能直接為要交換的項目制定智能合約,則采用的典型策略是找到可以代替項目的代理新啼。 例如追城,如果錯過付款,我可能會收到退還的押金燥撞。
The more the smart contract is disconnected from controlling the item being exchanged, the weaker the integrity of contract.
智能合約與控制交換項目脫節(jié)越多座柱,合約的完整性就越弱迷帜。
Smart Contracts in OpenBazaar
OpenBazaar中智能合約
Aside from some types of digital goods, the exchange of physical goods and most services cannot be safely represented in a smart contract. Alice may want to sell an ordinary chair to Bob, but Alice can’t cryptographically prevent Bob from physically sitting in the chair until payment is made, nor can Bob teleport the chair to his house upon payment.
除了某些類型的數(shù)字商品之外,實物商品和大多數(shù)服務(wù)的交換都不能用智能合約來安全地表示色洞。 Alice可能想把一把普通的椅子賣給Bob戏锹,但Alice不可能用密碼學相關(guān)技術(shù)阻止Bob在付款之前坐在椅子上,Bob也不能在付款后將椅子傳送到他家火诸。
The analogue world is resistant to the true potential of smart contracts.
虛擬世界抑制了智能合約的真正潛力锦针。
As a result, people have turned to regulating other aspects of trade with smart contracts, such as shipping or dispute resolution.
因此,人們開始將智能合約致力于貿(mào)易的其他方面置蜀,例如運輸或解決糾紛奈搜。
Transactions in OpenBazaar require both the Buyer and Vendor’s digital signature to release funds from a Bitcoin address. In the case of multisignature escrow, a third party called a ‘Moderator’ is used if there is some dispute in the execution of the contracts that the Buyer and Vendor cannot resolve. The Moderator has the tie-breaking vote to release funds to either party.
OpenBazaar中的交易事務(wù)要求買方和賣方的數(shù)字簽名,來從比特幣地址上釋放資金盯荤。 在多重簽名托管的情況下馋吗,如果買方和賣方無法解決的合約執(zhí)行時存在的爭議,則使用稱為“Moderator”的第三方廷雅。 Moderator通過打破平局的投票向任何一方發(fā)放資金耗美。
These transactions are manually initiated, as in they require the user to be online and push a button. Without a doubt this is inefficient compared to smart contracts, which can trigger the release of funds based on data retrieved from an API call. The participants in the smart contract do not need a Moderator.
這些交易是手動啟動的京髓,因為它們要求用戶在線并按下按鈕航缀。 毫無疑問,與智能合約相比堰怨,這是低效的芥玉,智能合約可以根據(jù)從API調(diào)用中檢索到的數(shù)據(jù)觸發(fā)資金的釋放。 智能合約中的參與者不需要Moderator备图。
In the case of ecommerce, for example, one may be tempted to write a smart contract to release funds from an address based on the shipping agent’s delivery of an item to the address requested by the Buyer. The tracking API would simple report that the item (represented by a unique tracking number) has arrived at its destination. The smart contract would read this input and release the funds to the Vendor. If the item was lost or returned to the Vendor, the smart contract could automatically refund the Buyer. If the API never reports delivery of the item to the destination address, the Buyer can be refunded after 30 days for example. No Moderator is necessary to facilitate the release of funds in these situations.
例如灿巧,在電子商務(wù)的情況下,人們可能會試圖根據(jù)運輸代理商將物品交付到買方要求的地址來編寫智能合約以從地址釋放資金揽涮。 跟蹤API會簡單地報告項目(由唯一的跟蹤號碼表示)已到達目的地抠藕。 智能合約將讀取此輸入并將資金發(fā)放給賣方。 如果物品丟失或退回給賣方蒋困,智能合約可自動退還買方資金盾似。 如果API從未報告將物品交付到目的地地址,則可以在30天后退還買方資金雪标。 在這些情況下零院,不需要Moderator來監(jiān)督資金的發(fā)放。
However, a closer look reveals a number of obvious problems. The Vendor could ship a box of rocks to the Buyer. The API would still report that the item was successfully delivered to the requested address, triggering the release of funds. Even if the Buyer wants to initiate a dispute, the funds are unrecoverable. Does the shipping agent need to stay and witness the unboxing of the item to verify the content’s integrity? If so, then we have essentially returned to a dumb contract, requiring a human to manually trigger the release of funds.
然而村刨,仔細觀察會發(fā)現(xiàn)許多明顯的問題告抄。 賣方可以向買方運送一箱石塊。 API仍然會報告該項目已成功運輸?shù)秸埱蟮牡刂非段瑥亩|發(fā)資金的釋放打洼。 即使買方想要發(fā)起爭議龄糊,資金也是無法收回的。 運輸代理商是否需要留下并親眼目睹物品的拆箱以驗證完整性拟蜻? 如果是這樣绎签,那么我們基本上又回到了一個無效合同,要求人工手動觸發(fā)資金的釋放酝锅。
Alternatively, depending on the value of the item, the Buyer could purchase another smart contract to DDoS the API source for enough time to trigger a refund transaction to the Buyer… essentially tricking the smart contract into thinking that the item was never delivered.
或者诡必,根據(jù)物品的價值,買方可以向DDoS購買另一個智能合約API接口搔扁,以便有足夠的時間為買方觸發(fā)退款交易...實際上是在欺騙智能合約爸舒,使其認為該物品從未交付過。
This is by no means an authoritative or general-purpose critique of smart contracts, or even smart contracts for ecommerce. Rather, it is to say that smart contracts are fantastic at facilitating automated and human-independent interactions. Once human interaction is required and factored into consideration, smart contracts become significantly more difficult to design with enough checks and balances to incentivize good behavior.The DAOis a cautionary tale to projects that want to capture complex human interaction in a smart contract.
這絕不是對智能合約稿蹲,甚至算不上電子商務(wù)智能合約的權(quán)威性或通用性批評扭勉。 更確切地說,智能合約在促進自動化和人類獨立的交互方面非常出色苛聘。 一旦需要人工干預(yù)并將其考慮在內(nèi)涂炎,并有足夠的制衡來激勵良好的行為,那樣的話设哗,智能合約就會變得更加難以設(shè)計唱捣,對于那些想要在智能合約中捕捉復(fù)雜的人際互動的項目來說,The DAO就是一個警示网梢。
To be clear once more, we’re not anti-smart contracts or even projects like TheDAO. Many of us in OpenBazaar have been in the Bitcoin community since the beginning. We’ve seen the rise and fall of companies, projects and the next ‘killer app’. We’ve seen people repeatedly lose money chasing the shiny new thing. One of our highest values is protecting the integrity of user’s funds. If that means using dumber contracts that are less efficient because they requiring manual processing, so be it.
再次聲明震缭,我們不是反對智能合同,更不是像TheDAO這樣的項目战虏。 OpenBazaar的許多人從一開始就在比特幣社區(qū)中拣宰。 我們已經(jīng)看過了公司,項目和下一個“Killer app”的興衰烦感。 我們看到人們因為反復(fù)追逐閃亮的新事物而虧損金錢巡社。 我們的最高價值之一是保護用戶資金的完整性。 如果這意味著需要使用需要手動處理從而效率較低的無效合同手趣,那就這樣做吧晌该。
What About Scaling?
關(guān)于擴展
We prefer to see on-chain scaling to the point where the volume of transactions (at ultra-low fees) is sufficient to cover the marginal costs of mining, in the absence of the block reward. This will also create a low admission price to the lightning network, making a high volume transaction network affordable and accessible to anyone in the world.
在缺乏區(qū)塊獎勵的情況下,我們更傾向于將交易量擴展到(以超低費用)足以支付采礦的邊際成本的程度回懦。 這也將為閃電網(wǎng)絡(luò)創(chuàng)造一個低入場價格气笙,使世界上任何人都可以負擔得起并使用大量交易網(wǎng)絡(luò)。
Despite the technical challenges associated with increasing the block size, the swift development of segregated witness demonstrate that innovative and complex changes can be implemented when there is sufficient will within the Bitcoin development community.
盡管面對區(qū)塊大小限制相關(guān)的技術(shù)挑戰(zhàn)怯晕,但分離見證的迅速發(fā)展表明潜圃,當比特幣開發(fā)社區(qū)有足夠的意愿時,可以實施創(chuàng)新和復(fù)雜的變革舟茶。
Special thanks to Brian Hoffman, Sam Patterson and Michael Folkson for their comments and corrections.
特別感謝Brian Hoffman谭期,Sam Patterson和Michael Folkson的評論和更正堵第。
本文圖片來源于網(wǎng)絡(luò)
版權(quán)聲明:
以下內(nèi)容來自微信公共帳號“EOS技術(shù)愛好者”,搜索“EOSTechLover”即可訂閱隧出,翻譯Gavin踏志,校對Lochaiching。轉(zhuǎn)載必須保留以上聲明胀瞪。僅授權(quán)原文轉(zhuǎn)載针余。
本文原文鏈接為https://medium.com/@therealopenbazaar/the-case-for-dumb-contracts-6308aa5b757
"EOS技術(shù)愛好者"全程由EOShenzhen運營,
喜歡我們請為我們投票
(EOShenzhen的投票賬號:eoshenzhenio)凄诞!
了解更多關(guān)于EOShenzhen:
關(guān)于我們更多聯(lián)系:
Website:https://eoshenzhen.io
Steem:https://steemit.com/@eoshenzhen
Busy:https://busy.org/@eoshenzhen
Telegram:https://t.me/eoshenzhen
Twitter:https://twitter.com/eostechlover
簡書:EOS技術(shù)愛好者
新浪微博:EOSTechLover
EOShenzhen的投票賬號:eoshenzhenio