首页 公告 Gemini 打破比特币闪电网络:eltoo(谷歌翻译)
Lightning Network是第2层解决方案,允许您与其他Bitcoiner一起创建微支付渠道。它允许即时和无信任的点对点交易,同时限制链上所需的数据量。在这篇文章中,我详细说明了它的工作原理,以及其中新建议的更新协议,称为单向支付渠道。最简单的在闪电网络中实施,因为资金只在一个方向流动。最常见的用例是流媒体资金;例如,您观看的视频的每分钟微支付。您想要使用Netflix启动此类频道。首先,您创建了一个Say you使用10比特币为此交易提供资金并将其发布在比特币区块链上。在开采之后,这笔资金交易可以由你的和Netflix的密钥组成的2比2的多重分配。当Netflix开始流式传输你的视频字节时,你开始流式传输它们 - 比如每分钟视频币.000001比特币 - 通过使用资金交易作为输入的部分签名交易。您创建两个新输出:一个发送.000001到Netflix,另一个9.999999给你。您签署此交易并与Netflix离线共享(即,不试图将其发布到比特币区块链)。此交易被视为“部分签名”,因为它只包含花费所需的两个签名之一。当Netflix收到此部分签名的交易时,它们处于控制之中。 Netflix可以选择立即声明.000001比特币,并在此过程中将剩余的9.999999比特币发回给您,方法是将他们的签名添加到部分签名的交易并发布。这被视为相反,只要您每分钟继续提供更大的部分签名交易,Netflix将继续为您提供视频流。使用单向支付渠道,不可能作弊。如果您每分钟停止发送Netflix部分签名的交易,每次都会获得更高的金额,Netflix将停止为您播放视频。他们将签署您发送给他们的最近部分签名的交易(这使他们有权获得最多的比特币),发布它,从而关闭渠道。此外,没有人发布“过时”交易的风险。 Netflix是唯一一个能够支付任何部分签名交易的人(因为Netflix有你的签名,但你没有他们的任何签名),你发送Netflix的每个新的部分签名交易对他们来说都比任何旧的更好。 。 Netflix只能作弊当资金流向两个方向时,这变得更加棘手。双方都可以发布交易,因此存在发布过时交易的激励措施。所以Alice和Bob开辟了一个支付渠道,每个人都锁定了.5比特币在融资交易中。现在,爱丽丝同意向Bob .1 BTC支付洗车费。她向Bob发送了一份部分签名的交易,该交易使用融资交易作为输入,有两个输出:一个向她发送.4 BTC,另一个为Bob发送.6 BTC。由于不发布此交易,Bob保持其渠道开放。他后来同意向Alice .3 BTC支付一幅画。如果Bob向Alice发送一份部分签名的交易,该交易使用融资交易作为其输入,他们将分别拥有相同融资交易的不同但有效的支出。交易在比特币中没有到期日,因此他们的交易将永久有效。如果他们继续为其他商品和服务来回发送部分签名的交易并不重要。他们中的任何一个都可以通过发布任何先前的交易来恶意行为,这些交易将其命名为更多比特币,从而关闭渠道,并使所有其他签名交易无效。双向渠道需要一种方式来实现闪电网络中的双向支付渠道。 -box今天因为虽然LN-Penalty今天起作用,但它有问题。除了它的复杂性之外,存在边缘情况,其中存在意外惩罚诚实用户的风险。在eltoo中,双方创建的融资交易表示在签署融资交易之前,Alice和Bob首先签署了一个在他们签署第一笔结算交易后,各方可以安全地签署融资交易。资金交易的锁定脚本如下所示:有两种方式可以花费资金交易:一个在你会注意到这个锁定脚本的结算分支包含而不是发布结算交易,Alice和Bob保留了频道打开。说Alice希望向Bob发送1比特币,所以他们的新余额是4比特币为Alice,6比特币为Bob.Alice和Bob做的第一件事就是交换签名,这是eltoo的关键点:这个新的结算交易确实如此不要从同一笔融资交易中花钱。相反,它花费了Alice和Bob尚未做出的交易的输出:a更新交易的目的是有效地花费资金交易,以便原始的结算交易(Alice和Bob都签署了,其中有一个块延迟10个街区,变得无法使用。重新启动资金交易的锁定脚本:当结算分支有10个块延迟时,After Alice和Bob签署新的结算交易,将4个比特币发送给Alice,6个发送给Bob结算密钥,它们从更新密钥交换签名以创建更新事务。这样,退还其初始余额的旧结算交易变得无关紧要,并且新的结算交易 - 花费更新交易 - 是唯一可以发出支付的交易。这个创建更新交易和结算交易的过程可以无限期地继续,如前面的图像所示。最近的结算交易您会注意到,虽然此提议的模型有效,但它要求每个中间更新事务都在链上发布。这违背了闪电网络的目的,该网络通过离线交易来保持链上数据光。这就是输出的锁定脚本可以指示上图中的With As,使用因此,只有三个事务必须发布在渠道结束时:资金交易,最后一次更新交易,以及通过花费最后一次更新交易将最终余额分配给各方的最后结算交易。您可能会注意到自由浮动更新交易存在问题。如果最后一个更新事务可以绑定到任何早期更新事务(包括资金事务),则情况恰恰相反:任何早期更新事务也可以绑定到上一个更新事务。这将使最后的结算交易无效!为了解决这个问题,eltoo巧妙地引用了The的概念但是这里有一个聪明的伎俩!如果你说资金交易指定为现在,如果Alice和Bob试图将第一个更新交易绑定到后来的输出 - 比如第三个输出 - 比特币区块链会拒绝它,因为第一个更新交易的nLockTime是1,而第三个输出有一个锁定脚本,要求nLockTime至少为3.尽管所有的更新事务都是用结算事务签名的,但事务处理也必须使用但是,您会注意到锁定脚本的结算分支不包含任何状态编号的概念乍一看,这似乎会导致我们之前描述的相同问题:旧的结算交易可以应用于未来的更新交易,产生竞争条件以查看将在链上开采的结算交易。这里的解决方案不是使用州号,而是每个结算交易使用双向状态渠道可能很复杂,但eltoo提供了一个简单的,创新的实施它们的方法。我希望你喜欢这个闪电网络的观点 - 请继续关注类似的帖子!写的
Breaking Down the Bitcoin Lightning Network: eltoo
The Lightning Network is a Layer 2 solution that allows you to create micropayment channels with other Bitcoiners. It allows instant and trustless peer-to-peer transacting while limiting the amount of data needed on-chain.In this post, I break down exactly how it works, as well as a newly proposed update protocol within it called Unidirectional payment channels are the simplest to implement in the Lightning Network because money only flows in one direction. The most common use case is streaming money; for example, a micropayment for each minute of a video you watch.Say you want to start such a channel with Netflix. First, you create a Say you fund this transaction with 10 Bitcoin and publish it on the Bitcoin blockchain. After being mined, this funding transaction can be spent by a 2-of-2 multisig consisting of your’s and Netflix’s keys.As Netflix starts streaming you bytes of video, you start streaming them money — say .000001 Bitcoin per minute of video — via partially signed transactions that spend this funding transaction.Using the funding transaction as input, you create two new outputs: one sending .000001 to Netflix, and the other 9.999999 to you. You sign this transaction and share it with Netflix off-chain (that is, without attempting to publish it to the Bitcoin blockchain). This transaction is considered “partially signed” because it only contains one of the two signatures necessary to spend.When Netflix receives this partially-signed transaction, they are in control. Netflix can choose to claim that .000001 Bitcoin immediately, and in the process send the remaining 9.999999 Bitcoin back to you, by adding their signature to the partially signed transaction and publishing it. This is considered Instead, Netflix will continue streaming you video so long as you keep providing larger partially signed transactions every minute. With unidirectional payment channels, there’s no possibility of cheating. If you stop sending Netflix partially signed transactions every minute for higher amounts each time, Netflix will stop streaming you video. They will sign the most recent partially signed transaction you sent them (which entitles them to the most Bitcoin), publish it, and thus close the channel.Furthermore, there’s no risk of anyone publishing an “outdated” transaction. Netflix is the only one capable of spending any of the partially signed transactions (since Netflix has your signatures, but you don’t have any of theirs), and every newer partially signed transaction you send Netflix is strictly better for them than any older one. Netflix can only cheat When money flows in both directions, this gets trickier. Both parties can publish transactions, so incentives exist to publish an outdated transaction.Say Alice and Bob open up a payment channel and each lock up .5 Bitcoin in the funding transaction. Now, Alice agrees to pay Bob .1 BTC for a carwash. She sends Bob a partially signed transaction that uses the funding transaction as its input with two outputs: one that sends .4 BTC to her, and one that sends .6 BTC for Bob.By not publishing this transaction, Bob keeps their channel open. He later agrees to pay Alice .3 BTC for a painting.If Bob sends Alice a partially signed transaction that uses the funding transaction as its input, they will each be in possession of a different, yet valid, spend of the same funding transaction. Transactions have no expiration date in Bitcoin, so their transactions will be valid forever.It doesn’t matter if they keep sending partially signed transactions back and forth for other goods and services. Either of them can act maliciously by publishing any earlier transaction that entitled them to more Bitcoin, thereby closing the channel, and making all other signed transactions invalid.Bidirectional channels need a way to Bidirectional payment channels in the Lightning Network work out-of-the-box today because the Though LN-Penalty works today, it has problems. Besides its complexity, edge cases exist where it risks accidentally penalizing an honest user. In eltoo, the two parties create the funding transaction denoted by Before signing the funding transaction, Alice and Bob first sign a After they sign the first settlement transaction, the parties can safely sign the funding transaction. The locking script for the funding transaction looks as follows:There are two ways to spend the funding transaction: one in the You’ll notice that the settlement branch of this locking script contains Instead of publishing the settlement transaction, Alice and Bob keep the channel open. Say Alice wants to send 1 Bitcoin to Bob, so their new balances are 4 Bitcoin for Alice, and 6 Bitcoin for Bob.The first thing Alice and Bob do is exchange signatures for a Here’s the key point of eltoo: this new settlement transaction does not spend from the same funding transaction. Instead, it spends the output of a transaction Alice and Bob have yet to make: an An update transaction’s purpose is effectively to double-spend the funding transaction, so that the original settlement transaction (that Alice and Bob both signed, which had a block delay of 10 blocks), becomes unusable.Recall the locking script of the funding transaction:While the settlement branch has a 10 block delay, the After Alice and Bob sign the new settlement transaction that sends 4 Bitcoin to Alice and 6 to Bob with their settlement keys, they exchange signatures from their update keys to create the update transaction. With that, the old settlement transaction that refunded their initial balances becomes irrelevant, and the new settlement transaction — which spends the update transaction — is the only one that can issue payouts.This process of creating update transactions and settlement transactions can continue like this indefinitely, as the image from earlier showed. The most recent settlement transaction You’ll notice that while this proposed model works, it requires every intermediary update transaction to be published on-chain. This defeats the purpose of the Lightning Network, which transacts off-chain to keep on-chain data light.That’s where Though an output’s locking script can dictate that a With As in the diagram above, using the Thus, only three transactions must be published by the end of the channel: the funding transaction, the last update transaction, and the last settlement transaction which distributes the final balances to each party by spending that last update transaction.You might notice that free floating update transactions present an issue. If the last update transaction can bind to to any earlier update transaction (including the funding transaction), then the opposite is true: any of the earlier update transactions can bind to the last update transaction as well. This would nullify the last settlement transaction!To address this, eltoo cleverly invokes the concept of The But there’s a clever trick here! If you make Say the funding transaction specified an Now, if Alice and Bob tried to bind the first update transaction to a later output — say, the third output — the Bitcoin blockchain would reject it, because the first update transaction’s nLockTime is 1, while the third output has a locking script requiring an nLockTime of at least 3.Although all of the update transactions are signed with Settlement transactions must also use However, you’ll notice the settlement branch of the locking script does not contain any concept of state numbers like the update branch does.At first glance, it would seem this would cause the same problem we described earlier: old settlement transactions could be applied to future update transactions, producing a race condition to see which settlement transaction would be mined on-chain.Instead of using state numbers, the solution here is that each settlement transaction uses a Bidirectional state channels can be complex, but eltoo provides a simple, innovative way to implement them. I hope you enjoyed this view into the Lightning Network — stay tuned for similar posts!Written by