专栏名称: 量子链平台Qtum
QuantumChain (Qtum) 量子链官方平台,推送量子链平台(Qtum)的开发进度和应用情况,分享区块链行业的真知灼见。
目录
相关文章推荐
51好读  ›  专栏  ›  量子链平台Qtum

《开发者视角:Qtum量子链到底解决了什么问题》

量子链平台Qtum  · 公众号  ·  · 2018-04-03 17:52

正文

请到「今天看啥」查看全文


点击上方蓝字关注QTUM公众号,了解最新行业资讯


Qtum量子链的主要以比特币核心代码为基础,并将PoW共识机制更改为PoS,再将以太坊虚拟机置于其顶层,使其与以太坊智能合约兼容。因此,你可以在Qtum量子链上部署以太坊的智能合约,而无需进行任何修改。也就是说,Qtum量子链支持在比特币底层架构之上运行以太坊虚拟机。Qtum量子链结合比特币和以太坊两大生态的最大优势,使自身成为为商业应用而生的区块链。接下来,我们将讨论Qtum量子链是如何做到这一点并弥合比特币和以太坊的鸿沟。


首先我们必须理解的是,比特币和以太坊的底层结构大有不同。在比特币中,有“未使用交易输出(UXTO)的概念”。我们将在下一节中讨论比特币交易如何基于UXTO模型运行,然而,以太坊使用的是“账户模型”。因此,Qtum量子链的挑战是将UTXO和账户模型结合起来,以成为比特币和Ethereum的有机结合体。


先了解一下UTXO和比特币交易是如何运作的。比特币交易有一组输入和一组输出。一个交易的完成需要消耗一些输入并会产生一些输出。这些输出可以再次被其他交易使用,而剩余的输出未被使用。当我们讨论UXTO时,我们讨论的是每笔交易有一个或多个输出,这些输出可以被用来建立新的交易。从这个意义上说,比特币不会记录你的账户余额。当你打开钱包时,你可能会发现你有1.2比特币。这些币并不是存储在区块链上,因为比特币的区块链根本不会存储它,而是跟踪交易和交易输出。当你的钱包显示余额时,它所做的是将你私钥所控制的UTXO的值进行叠加。这是钱包运行的一个抽象概念:用你的私钥检查区块链上交易,看看哪个UTXO受这些私钥控制,然后把它们加在一起,再显示你的余额。当你在做一个新的交易时,你的钱包将会用一些输入和输出来构造一个交易。一个输出可能会发送给接收者,另一个可能会作为找零返回给你。这是你看不到的,因为这是在后台发生的,你的钱包是用户友好的,大多数时候它只会询问你的收件人地址,以及你想发送的金额。Qtum之所以决定将项目建立在UXTO上是因为Qtum想让整个生态系统和比特币兼容,所以当比特币发布闪电网络或其他创新时,Qtum能够快速适配。另外,由于SPVs的关系, Qtum可以为移动设备提供轻量级客户端,方便更多人使用。因此,UTXO是比特币的核心,也是Qtum的核心。

那么,Qtum是如何将比特币连接到以太坊上的呢?以太坊所使用的模型更加简单,叫做账户模型,会跟踪帐户余额,帐户的合约代码和账户对应的存储。


对于Qtum来说最具的挑战性问题是如何结合这两种模型。Qtum通过“账户抽象层(AAL)”,实现Ethereum的账户模型和Qtum的UTXO模型的无缝交互。


为了做到这一点,Qtum在中间构建了“抽象帐户层(AAL)”。因此,以太坊虚拟机只是与账户抽象层进行通信,而不是直接与UTXO进行交互。一般来说,以太坊虚拟机通常只能在以太坊区块网络上运行,而AAL的工作则是将其翻译成UTXO能够理解的操作码传递给UXTO。类似的解决办法在软件开发中非常普遍,当你有两个互不相关的系统时,它们本身并不需要了解彼此,通过人为添加的中间层,使它们之间的交互成为可能。


以下为英文版本



What is QTUM? Programmerexplains


The main idea of Qtum is totake Bitcoin core code which they have done, change PoW to PoS and then put theEthereum virtual machine on top of it, making it compatible with Ethereum smartcontracts running on it. So as you can take the Ethereum smart contract anddeploy it on Qtum blockchain without any modifications, because Qtum have theEthereum virtual machine running on top of the Bitcoin software, but slightlymodified Bitcoin Software. So the whole idea is to take the both best parts ofboth worlds from Bitcoin & Ethereum and make this project that isindustrial-ready. So we are going to discuss how they make it possible and howthey actually bridge the gap between Bitcoin and Ethereum. At the end we’regoing to talk about the threats and risks with this project.

Something we have tounderstand is that Bitcoin and Ethereum are built slightly different. InBitcoin we have “Unspent transaction output(UXTO)”. We will talk about howBitcoin transaction work on the next slide and they are based on UXTO and youwill understand how it works. However Ethereum is built a bit differently, theyuse “Account model”. So the challenge of Qtum is to combine UTXO and accountmodel, in order to be a hybrid between Bitcoin and Ethereum. Qtum needs tosomehow solve this difference.

First of all let’sunderstand what’s UTXO and how transactions work on Bitcoin. So, a Bitcointransaction has a set of inputs and a set of outputs. A a transaction takessome inputs and produces some outputs. Those outputs can be in turn and used byother transactions. Bitcoin transaction usually has inputs and a bunch ofoutputs, some of these outputs are used in the next transaction, and some otheroutputs are used in other transactions, rest of the outputs are left unspent.So when we are talking about UXTO, we are talking about that each transactionhas a bunch of outputs, one or several outputs, and then these output can thenbe in turn, be used in order to build up new transaction. In that sense, Bitcoindoesn’t track your Balance. When you open your wallet you might see that youhave 1.2 Bitcoin. The 1.2 Bitcoin is not stored anywhere on the Blockchain,Bitcoin Blockchain doesn’t keep track of that at all, it keeps track oftransactions and transaction outputs. When your wallet displays you yourbalance, what it does is to add all of the unspent transaction that yourprivate keys control. This is an abstraction your wallet does, it looks at yourprivate keys and it checks the Blockchain and looks which unspent transactionoutputs does these private keys control and then add all of them together,displays you your balance. When you’re making a new transaction, your walletwill construct a transaction with some inputs and outputs. One outputs might goto your recipient, another might go back to you. This is something you cannotsee, because this is happening under the hood, your wallet is user friendly,most often it will just ask you for a recipient address, and the amount youwant to send. The reason why Qtum has decided to base their project on UXTO isbecause Qtum wants to make the whole ecosystem Bitcoin progress compatible, sothat when Bitcoin announced lightning or other innovations, it will be easierfor Qtum to adapt. Also because of the SPVs, Qtum could have lightweightclients for mobile devices. So that UTXO is at the core of Bitcoin and also atcore of Qtum.

Then how does Qtum bridgethe gap to Ethereum? In Ethereum instead we have a way simpler model calledaccount model and Ethereum does track Account’s Ether balance, Account’scontract code and storage.

The challenging issue forQtum is to connect these 2 technologies. They connected Ethereum’s accountmodel and Qtum’s UTXO model based on Bitcoin by implementing “AccountAbstracting Layer(AAL)”. The idea of Qtum is to put Ethereum virtual machine ontop of Qtum’s UTXO model without major modification,and make it communicate andrun on the UTXO system.

To do that, Qtum built the “ Abstract Account Layer (AAL)” in between. So the EVM justcommunicate with the Abstract Account Layer and doesn’t know about the UTXO atall, it only cares about how it usually works. Generally speaking, the EVMusually only works on the Ethereum Blockchain and the AAL’s work it to do thetranslation to UTXO, then the EMV and UTXO could communicate with each other.This is extremely common in software development, when you have 2 systems, theydon’t have to care each other because they have another layer in between whichmakes all the communications possible. So this is the technological aspect ofQtum.


点击查看你视频



关注Qtum量子链(qtumchain)公众号,回复关键字查阅Qtum量子链相关资料,以下是部分文档关键字


回复:‘ 白皮书 ’,查看《Qtum量子链白皮书,设计原理,实现方案,及应用》


回复:‘ 未来 ’,查看《Qtum量子链未来2年技术路线规划-简略版》


回复:‘ 指南 ’,查看《首篇Qtum量子链区块链开发指南系列面世》


回复:‘ 专访 ’,查看《Nasdaq专访Qtum:区块链会成为世界最大的信任服务商》


回复:‘ 文档 ’,查看英文版本《Qtum量子链实现文档》


回复:‘ 中文文档 ’,查看中文版本《Qtum量子链实现文档》








请到「今天看啥」查看全文