上图是硬分叉时刻第1920000区块前后的情况,左侧数字为区块编号,右侧16进制数代表区块的哈西值。直线代表分叉后新链,大多数矿工都升级了软件并在这条链上记账(挖矿);曲线分支代表原(旧)链,少数没有升级的矿工,依然停留在旧链上记账。新链出块的速度大于旧链,说明大部分算力都已切换到新链上了。
The chart above shows the situation around block 1920,000 at the time of the hard split, with the number of blocks to the left, and the 16-point number to the right, which represents the Hasi value of the block. The straight line represents the new chain after the split, with most miners upgrading the software and recording it on the chain (mining); the curve branch represents the old (old) chain, with a small number of unupgraded miners remaining on the old chain. The new chain is faster than the old one, suggesting that most of the algorithms have been switched to the new chain.
在区块链的硬分叉中,由于更改了系统规则,按照新规则产生的区块只被新节点认可,旧节点则不认为新区块合法。因此,旧节点一直用旧规则来组织自己的链,所以,无论新旧节点数目的比例如何,一定会产生两条链 。若大多数节点都升级到新版本,旧链能否成活要看有多少算力的支持。
In the hard fork of the block chain, since the rules of the system have been changed and the blocks generated under the new rules have only been endorsed by the new nodes, the old nodes have not considered the new nodes to be legitimate. Thus, the old nodes have used the old rules to organize their own chains, so that no matter the proportion of the number of new or old nodes, the strong will produce two chains strong >. If most nodes are upgraded to the new version, the ability of the old nodes to function depends on the amount of calculating support.
之前在比特币等区块链上也出现过硬分叉的情况,当时绝大多数矿工都切换到新链上,旧链也就自动消亡了。可这次以太坊硬分叉却不同,由于社区存在分歧,部分矿工还继续维持着旧链,因此旧链并未即刻消失,还在顽强地活着。从经济效益上看,矿工在旧链上挖出的“旧版”以太币几乎没有任何价值,不仅在交易所里无法交易,而且因为旧链生死未卜,没有人愿意担风险买入旧版币。矿工没有了经济来源,旧链消失也只是时间问题了。
In terms of economic efficiency, the “old version” dug by the miners on the old chain is of little value, not only in the exchange, but also because the old chain is not known and no one is willing to take the risk of buying the old ones because the old chain is dead. The miners have no economic resources, and the old chain is just a matter of time.
就在旧链风雨飘摇之际,大救星出现了。全球最大的以太坊交易平台Poloniex(P网)率先地宣布开始交易旧版以太币。为和新版以太币ETH 区别,旧币代号为ETC (Ethereum Classic,经典以太坊)。ETC由此具有了流通价值,因为价格极低,有愿意冒险的投资(机)人买入,矿工们的生计得以为继。旧链上的算力比新链要小很多,挖矿难度和成本也要比新链低,部分摇摆的矿工(池)见有利可图,纷纷加入旧链中挖矿,整网算力迅速增强,和新链的算力比从1:20猛增到1:4。除了P网外,其他原本反对ETC的交易平台、在线钱包等服务看到需求旺盛,也改变初衷,开始支持ETC,甚至Github上在分叉前几天也出现了Ethereum Classic的项目。旧链起死回生!既在意料之外,又在情理之中!
Just as the old chain was rocking, the Great Savior appeared. The world’s largest trade platform, Poloniex (Pnet), was the first to announce the start of trading in the old currency. To distinguish the new version from the NTH, the old currency is the ETC (Etherium Classic, classic Ether). The ETC thus had a circulation value, because the price was so low that there were risk-taking investors who bought it, and the miners’ livelihoods succeeded. The old chain was much smaller than the new one, the mine-mining difficulties and costs were lower than the new one, the swing miners (pools) were more profitable than the new one, the network was rapidly enhanced by joining the old chain, and the new chain was increased from 1:20 to 1:4. In addition to the P net, other services that were opposed to the ETC trading platform, online wallets, etc., saw the demand boom.
ETC的价格波动
ETC price volatility
重放攻击(Replay Attack)
Replay Attack
以太坊同时存在新旧两条链(ETH和ETC),代码相同(除了涉及The DAO的部分),历史账本一样(分叉前),地址的私钥也一样,交易广播到两个网上都是合法的,许多不可思议的事情发生了。例如, 分叉前持有以太币(ETH)的用户,在分叉后同时拥有了等量的 ETH币和ETC币。就是说原来你如果有1个ETH币,分叉后忽然凭空多出了1个ETC币,并且可以在旧链上卖掉换钱花,就象天上掉下钱来一样。
There are two new and old chains (ETH and ETC) in Etheria, the same code (except for the part of the DAO), the same history book (in front of the split), the same private key to the address, the transaction was broadcast to both networks, and a lot of incredible things happened. For example, users holding ETH before the split, had the same amount of ETH and ETC after the split. That is, if you had an ETH currency, then you suddenly had an ETC currency after the split, and you could sell it off the old chain, as if the money fell from the sky.
除了钱变多的“美妙”之外,也带来了重放攻击(Replay Attack)的烦恼。譬如,在新链上发送货币的交易,同样会广播到旧链上,并且交易还能成功(后面会讲到例外),可被利用来作为攻击手段。
In addition to the “beautiful” nature of the money, there is also concern about the re-launching of the attack. For example, transactions that send money on the new chain are broadcast on the same chain, and the transaction is successful (with the exception later), and can be used as a means of attack.
假设分叉前地址A有100个ETH,地址B拥有500个ETH。分叉后,在ETH链上从地址A转100个ETH到地址B上,再把100个ETH从B转回A,地址A最终还是拥有100个ETH(扣除少量gas损耗),地址B的余额不变。上述交易在ETC链上也广播一次(重放),同样也会执行从A转100个ETC到B,再从B转100个ETC到A,一切都还正常。但是,如果攻击者设法使得A在ETH链上的余额为100个ETH,在ETC链上余额为0,上述交易在ETC链上重放时,从A转B因余额不足失败;而因B的余额足够,从B转A成功,结果就是A从B取走了100个ETC。
Assuming that the pre-distribution address A has 100 ETHs and B has 500 ETHs. After the split, it is normal to transfer 100 ETHs from A to B on the ETH chain, 100 ETHs from B to A, and 100 ETHs from A to 0 on the ETH chain. The above transactions were also broadcast (replayed) once on the ETC chain, and 100 ETCs from A to B and 100 ETCs from B to A. However, if the attackers managed to bring the balance from A to 100 ETHs on the ETH chain, the balance from A to B to B was not enough when the ETC chain was re-placed, the above-mentioned transactions failed because the balance was sufficient and the B to move from B-A was successful, with the result that A removed 100 ETCs from B-B.
这种重放攻击最典型目标的就是以太币交易所,攻击者从自己的地址A向交易所地址B存币然后发起提币请求,交易所在ETH链上确认交易并把币转到A,殊不知这个交易在ETC链上同样执行,交易所的ETC就被人提走了。为什么目标是交易所呢?因为交易所的地址B一般存放多个客户的ETC币,余额较大,这样攻击容易得手。部分交易所都因防备不足而中招,有的还不得不赔付给客户ETC。
The most typical target of this re-address is the Ether Exchange, where the attackers deposit currency from their own address A to their address B and then initiate a request for money, where the exchange confirms the transaction on the ETH chain and transfers it to A. It is not surprising that the transaction is also carried out on the EtC chain, and the exchange’s EtC is taken away. Why is the target of the exchange? Because the exchange’s address B usually holds multiple customers’ EtCs, with large balances, the attack is easy.
重放攻击还有一个前提,就是需要有个地址A在两条链中的余额不同,这是怎么做到的呢?最容易想到的就是The DAO的众筹人,他们在硬分叉后在ETH链上可取回自己投资The DAO的ETH币,可是这些ETH在对应的ETC链中是依然存放在The DAO的合约中,因为分叉时,ETC和ETH的差别就是在The DAO合约的余额上,如下图。The DAO众筹人取回自己的ETH后,就拥有了这样一个地址:在新旧链中余额不同。后面还会介绍另一种错开地址在新旧链余额的方法。
The re-launching of the attack is also premised on the need to have an address A has a different balance in the two chains. The easiest thing to think about is the crowd of the DAO, who, after a hard break, can invest their ETH in the ETH chain, but these ETHs are still stored in the contract of the ETC in the corresponding ETC chain, because the difference between the ETC and the ETH is in the balance of the DAO contract, as shown below. When the crowd takes back their ETH, they have the address: the balance in the old chain is different.
以太坊硬分叉瞬间新旧链区块的差别
The difference between the new and the old chain blocks is instantaneous with the hard fork in the courtyard.
新旧链上以太币的区分
distinction in tasers on the old and new chains
ETH和ETC同源的两条区块链并存,交易互相交错,一时之间带来使用上的混乱,在任何一条链上做交易,都要考虑在另一条链上是否有重放影响。最好的办法还是把在ETH和ETC存放在不同的地址上,从而互不影响。以太坊官方推荐了第三方的智能合约,可以把原来同地址的ETH和ETC发向不同的新地址,即本来在双链上都存放在地址X的以太币,分别转到ETH的地址Y和ETC的地址Z。下面是安全分拆合约代码,在split()方法中判断合约运行在哪条链上,然后把ETH/ETC转到不同的目标地址上。这个代码有点象操作系统进程fork调用之后,判断代码到底在子进程还是父进程运行。代码中用到了另一个称为oracle(预言家)的合约AmIOnTheFork ,地址是0x2bd2326c993dfaef84f696526064ff22eba5b362 。这个合约在硬分叉前发布到区块链上,并且在硬分叉后,根据The DAO黑客合约的余额,立刻记录下合约到底是处于新链还是旧链,从而给其他合约提供了判断依据。限于篇幅,不再介绍其原理,有兴趣的读者可以查看oracle合约的源代码:
The best way is to keep the ETH and ETC in separate addresses. The ETH and ETC contracts of third parties can be sent to different new addresses, i.e. the ETH and ETC, which were stored on both addresses in X, and the ETH and ETC addresses in Z, which were transferred to the ETH, respectively. The secure division contract code, which determines where the contract runs in the Split () method, and then transfers the ETH/ETC to different target addresses. This code is similar to that of the operating system process, which will determine whether the ETH and ETC are operating at a different address, i.e., at the same time at the same address in X, at the same time, at the same time, at the same time, as the ETC addresses Y and ETC.
http://etherscan.io/address/0x2bd2326c993dfaef84f696526064ff22eba5b362#code
分拆合约的源代码
Split the source code of the contract
新旧链之争
The New and Old Chain Contest > /strang >
尽管长期趋势不明朗,至少ETC短期已经存活下来。ETC的币值也从2元涨到最高18元(人民币),并伴随着巨大的换手量,甚至有人还估计ETC将来价格会比ETH更高。那么谁是ETC的幕后推手呢?一种猜测是比特币的圈里人。比特币在加密货币里是当之无愧的老大,当然不希望有个小弟变得越来越强大,以致最终成为自己的对手。现在以太坊这个小弟的快速成长,已经有超越比特币的苗头,比特币怎能坐视不理?比特币社区对以太坊的硬分叉基本都是谴责的,现在又出现了ETC这个难得的机会,比特币的大佬们忍不住狂吃廉价ETC筹码(大量的ETC被用BTC买走),用很少的成本,就能够控制一条和ETH对抗的链,这是绝佳的上车机会。
Although the long-term trend is uncertain, at least the ETC has survived in the short term. The value of the ETC has also risen from $2 to a maximum of $18 (the renminbi) and has been accompanied by a huge exchange of hands, and even some have estimated that the ETC will have higher prices in the future. So who is behind the ETC?
另一方面,比特币社区里一直就有大区块和小区块两派之争,大区块可解决比特币网络吞吐量低的问题,但是要靠硬分叉来实现,这点遭到小区块派的强烈反对。此次以太坊硬分叉的成败,对比特币以至整个区块链社区都有极重要的参考意义,小区块派当然希望ETC能够活下来,从而证明硬分叉具有很大风险,小区块派应该是ETC最忠实的支持者。各大交易所基本都是从事比特币起家,深受各种比特币势力的影响,支持ETC的交易也不足为奇了。
On the other hand, the Bitcoin community has been fighting over large blocks and small blocks, which can solve the problem of low bitcoin infestation, but this is achieved by hard fork, which is strongly opposed by the small fork. The success or failure of the hard fork in the courthouse is of great significance to the entire block chain community, which certainly hopes that the ETC will survive, thus proving that the hard fork is at great risk, and that the small fork should be the most loyal supporter of the ETC.
ETC的出现,使得以太坊社区的争论焦点从The DAO转移到了ETC和ETH将来的发展上。一种观点认为,ETC和ETH相比,是更纯粹的去中心化系统,因此最终会胜出。另一种观点则认为,ETH得到多数人拥护,以及核心开发者Vitalik等的支持,ETH才是代表着未来。那么,到底谁才是主宰公共区块链系统生死的判官呢?
The emergence of the ETC has shifted the focus of the debate in the Ethio community from The DAO to the future development of the ETC and the ETH. One view is that the ETC is a more pure decentralised system than the ETH, and will eventually win. Another view is that the ETH is supported by the majority and by the core developer Vitalik, among others.
笔者认为,以太坊(ETH)拥有雄厚的资金,优秀的开发团队,明确的技术路线,众多的用户和合作伙伴组成庞大的生态圈,更具有长期发展优势。经典以太坊(ETC)要想后来居上,至关重要的是要有独立创新的核心技术团队。现在ETC和ETH是相同源代码的两个项目,ETC和ETH是兼容的。但ETC若长期依赖和跟随ETH的技术路线,没有自己的团队和发展蓝图(类似以太坊从Frontier到Serenity的规划),即使爆炒ETC甚至使其币值高于ETH,短期吸引人气,也无法最终取信于用户。
In my view, Etherm has a strong capital, an excellent development team, a well-defined technology team, and a vast conglomerate of users and partners, with greater long-term development advantages. For the classic Etherms to come up, it is essential to have a core team of independent and innovative technologies. Now EtCs and ETHs are two projects with the same source code, and EtCs and ETHs are compatible. But if EtCs rely on and follow the ETH's technology routes for a long time, they do not have their own teams and blueprints for development (similar to planning from Frontier to Serenity), even if they blow up ETCs and even make them worth more than ETH, they are short-term attractive and cannot ultimately trust users.
ETC链的算力从峰值从900GH/s以上回落到620GH/s,区块高度落后ETH2000左右,挖矿难度也低于ETH
The ETC chain fell from a peak of more than 900 GH/s to 620 GH/s. Blocks are at an altitude of about ETH 2000, and mining is less difficult than ETH
结束语
concluding remarks
从The DAO发起众筹开始,到资金被盗,到软硬分叉的大辩论,再到以太坊的双链共存,经历了风风雨雨,各方力量在技术、经济、道德、伦理等方面进行了激烈地博弈,俨然一场诗史级的大戏。相信许多技术爱好者都和笔者一样,观赏到许多区块链领域新奇的事物,如DAO代码控制一切的模式、双链平行世界相互影响等等。在The DAO系列文章中笔者也和大家做了剖析和分享,今后有更多的进展,将与大家继续交流。
From the beginning of the DAO’s campaign, to the theft of funds, to the large debate of the soft and hard divides, to the coexistence of the two chains of the Etherms, to the wind and rain, the forces of the parties engaged in a heated game of technology, economy, morality, and ethics, and a poetic and historical scene. It is believed that many technocrats, like me, are watching new things in the area of the chain, such as the model of the DAO code’s control of everything, the interaction of the two-chain parallel worlds, and so on. The authors of the The DAO series have also analysed and shared with you, and more progress will continue to be shared with you.
发表评论