Research/Bitcoin Dev Archive / lightning-dev list
Updated commitment design + Release thunder.network
4 messages, May 17 to Jun 1, 2016. Started by Mats Jerratsch.
Mats Jerratsch (2), Rusty Russell (2)
Hey everybody,
Using SegWit, I thought of a more elegant way to solve the coupling problem between revocation delay and payment timeouts. ( https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2015/return-to-the-layered-commit-transactions#m-999a0438 and following)
A basic schema with one included payment can be seen here:
https://raw.githubusercontent.com/blockchain/thunder/master/docs/dual-tx-diagram.png
The idea is that each payment and each refund does not directly pay to their respective owner, but to a intermediate 2-of-2 transaction. For redeeming a payment, one has to also use R to broadcast Redeem-TX, for broadcasting Refund-TX one has to wait the agreed refund time. Having broadcasted the additional transaction, one basically *secured* the funds, under the premise that one has not cheated by using an old commitment transaction. If he did cheated though, the other party can claim all funds directly from the commitment outputs or from the Redeem-TX outputs.
This makes it possible to set revocation delay and payment timeouts to completely separate values (if it is not obvious why this was not possible before, I suggest reading the thread linked above).
Now there are two downsides to this approach:
(1) Clearing a payment on the blockchain is more expensive. Because we have an additional transaction for each payment, fees for redeeming the payment are higher. One has to take into account the fee for the additional transaction when producing the outputs for the commitment transaction. However, as most channels will not get settled on the blockchain anyways, this is a minor issue.
(2) Updating the commitment transaction, one has produce and send a new signature for each currently included payment. For channels that have lots of uncleared payments for a long time this might be problematic, however, uncleared payments are undesirable for many reasons and adding disincentives for delaying the clearing process is on the TODO anyways.
However, having a clean solution to the problem of high refund times (>30d) and low revocation times (<3d) is more important in the long run.
This means adding a few more fields to the way a new commitment status is negotiated, you can see the full exchange thunder is using here: https://github.com/matsjj/lightning/blob/master/communications/high/%5BTN%5DPaymentNegotiation.md
—————————————————————————————
Also, following the tradition of the other releases here on the mailing list I like to bring it over here more formally.
thunder.network is a full lightning network implementation, based on my ongoing development for the past 15 months. The software is now at a point where it can be actively used and also integrated into other projects. If you have not tried the wallet out and made a basic payment, feel invited to start up two instances and try it out.
The implementation already uses CSV and will utilize SegWit (in progress). It’s a small change, about 250 LoC[1]. The intention is to build as trustless a system as possible. SegWit was not prioritized any higher than it is since it will be awhile before it can be utilized for any mainnet system.
This release contains two executables, a node and a wallet, and they both use the same library. The node is a passive participant of the network. On startup the user can specify which nodes to build payment channels with. It will broadcast its existence into the network, such that other peers can also build payment channels with it. If you do want to start up the node, make sure you forwarded port 2204, such that you can receive incoming connections.
The wallet is the counterpart, an active participants. The wallet is used to make and receive payments, but it will not broadcast its existence. Once we have RP routing sorted out, it will not broadcast anything anymore (for routing it still broadcasts any payment channel it has). It also provides some GUI as an example and for easier usage.
By default wallet and nodes do not communicate with the bitcoin network yet, as this makes it easier to debug and to try out. If you want to use testcoins, toggle the setting in Constants. Also, if you do want to see which messages are sent under the hood, toggle EncryptionProcessorImpl.OUTPUT_MESSAGE.
Both, Node and Wallet software can be downloaded at https://github.com/blockchain/thundernetwork/releases
Further information can be found at https://github.com/blockchain/thundernetwork https://blockchain.com/thunder
Cheers!
[1] https://github.com/blockchain/thunder/commit/e9132c9f30719f430385e88cc1c04d7611b5dfd0
Mats Jerratsch via Lightning-dev <lightning-dev at lists.linuxfoundation.org> writes:
Quoted text (3 lines)
> Hey everybody, > > Using SegWit, I thought of a more elegant way to solve the coupling problem between revocation delay and payment timeouts. ( https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2015/return-to-the-layered-commit-transactions#m-999a0438 and following)
Hi Mats!
Quoted text (15 lines)
> A basic schema with one included payment can be seen here: > > https://raw.githubusercontent.com/blockchain/thunder/master/docs/dual-tx-diagram.png > > The idea is that each payment and each refund does not directly pay to their respective owner, but to a intermediate 2-of-2 transaction. For redeeming a payment, one has to also use R to broadcast Redeem-TX, for broadcasting Refund-TX one has to wait the agreed refund time. Having broadcasted the additional transaction, one basically *secured* the funds, under the premise that one has not cheated by using an old commitment transaction. If he did cheated though, the other party can claim all funds directly from the commitment outputs or from the Redeem-TX outputs. > > This makes it possible to set revocation delay and payment timeouts to completely separate values (if it is not obvious why this was not possible before, I suggest reading the thread linked above). > > Now there are two downsides to this approach: > > (1) Clearing a payment on the blockchain is more expensive. Because we have an additional transaction for each payment, fees for redeeming the payment are higher. One has to take into account the fee for the additional transaction when producing the outputs for the commitment transaction. However, as most channels will not get settled on the blockchain anyways, this is a minor issue. > > (2) Updating the commitment transaction, one has produce and send a new signature for each currently included payment. For channels that have lots of uncleared payments for a long time this might be problematic, however, uncleared payments are undesirable for many reasons and adding disincentives for delaying the clearing process is on the TODO anyways. > > However, having a clean solution to the problem of high refund times (>30d) and low revocation times (<3d) is more important in the long run.
At first I wasn't sure that anyone would really set 30 day CSV delays. I'm not sure that I want my funds locked for 30 days, or even to deal with a node which indicates it's likely to be offline for anything like that long.
But I'm wrong. If you're just an occasional end-user, this might make perfect sense to ask for a 30 day timeout as an alternative to outsourcing enforcement. And since it's a private arrangement between two nodes, it could easily be added as an option.
The main downside I see is the slight additional complexity for the on-chain case, so I really like the idea of making it an option.
Quoted text (1 line)
> Also, following the tradition of the other releases here on the mailing list I like to bring it over here more formally.
This deserves a mail of its own! I like to see release announcements, and I know the subscribers do.
Quoted text (6 lines)
> Both, Node and Wallet software can be downloaded at > https://github.com/blockchain/thundernetwork/releases > > Further information can be found at > https://github.com/blockchain/thundernetwork > https://blockchain.com/thunder
Congratulations! Rusty.
Quoted text (28 lines)
>> A basic schema with one included payment can be seen here: >> >> https://raw.githubusercontent.com/blockchain/thunder/master/docs/dual-tx-diagram.png >> >> The idea is that each payment and each refund does not directly pay to their respective owner, but to a intermediate 2-of-2 transaction. For redeeming a payment, one has to also use R to broadcast Redeem-TX, for broadcasting Refund-TX one has to wait the agreed refund time. Having broadcasted the additional transaction, one basically *secured* the funds, under the premise that one has not cheated by using an old commitment transaction. If he did cheated though, the other party can claim all funds directly from the commitment outputs or from the Redeem-TX outputs. >> >> This makes it possible to set revocation delay and payment timeouts to completely separate values (if it is not obvious why this was not possible before, I suggest reading the thread linked above). >> >> Now there are two downsides to this approach: >> >> (1) Clearing a payment on the blockchain is more expensive. Because we have an additional transaction for each payment, fees for redeeming the payment are higher. One has to take into account the fee for the additional transaction when producing the outputs for the commitment transaction. However, as most channels will not get settled on the blockchain anyways, this is a minor issue. >> >> (2) Updating the commitment transaction, one has produce and send a new signature for each currently included payment. For channels that have lots of uncleared payments for a long time this might be problematic, however, uncleared payments are undesirable for many reasons and adding disincentives for delaying the clearing process is on the TODO anyways. >> >> However, having a clean solution to the problem of high refund times (>30d) and low revocation times (<3d) is more important in the long run. > > At first I wasn't sure that anyone would really set 30 day CSV delays. > I'm not sure that I want my funds locked for 30 days, or even to deal > with a node which indicates it's likely to be offline for anything like > that long. > > But I'm wrong. If you're just an occasional end-user, this might make > perfect sense to ask for a 30 day timeout as an alternative to > outsourcing enforcement. And since it's a private arrangement between > two nodes, it could easily be added as an option. > > The main downside I see is the slight additional complexity for the > on-chain case, so I really like the idea of making it an option.
Yes exactly, this high of a revocation timeout is not for 24/7 nodes, but rather to ease problems for endusers when adopting to this new way of transacting.
Keep in mind though that only the revocation value is a private arrangement. The dual-tx approach is backward compatible, meaning it is possible relaying payments with the old setup, with the cost of using long refund times. It is not possible to relay a payment that is optimised for dual-tx over hops that don’t support it, because they would deduct their usual refund-time (often between 1-2 days per hop), leaving no room for the rest of the route.
Yes when having multiple payments with different timeouts one has to keep track of when to broadcast which transaction, but this is similar to the current approach. It does make it significantly harder to transact sub-dust amounts though. For a 1 satoshi payments one would often pay >500 satoshi for claiming it on-chain.
What we can do, however, is to use the old schema for these low-amount payments, given that a long clearance time isn’t that much of a problem for these either way.
Cheers Mats
Mats Jerratsch <mats at blockchain.com> writes:
Quoted text (2 lines)
> Keep in mind though that only the revocation value is a private arrangement. > The dual-tx approach is backward compatible, meaning it is possible relaying payments with the old setup, with the cost of using long refund times. It is not possible to relay a payment that is optimised for dual-tx over hops that don’t support it, because they would deduct their usual refund-time (often between 1-2 days per hop), leaving no room for the rest of the route.
But nodes need to publish their HTLC time subtraction anyway. If they're using dual-tx, that'll just be lower than otherwise.
BTW, my prototype started by using times everywhere, but I'm switching to blocks. The protobuf file supports both, but I now think that adds complexity.
Block counts are what active nodes care about, particularly when we're talking about tight timings: I'm comfortable with a 6 block delay, but not a 1 hour delay.
And for larger counts, they're roughly convertible anyway (a UI problem, really).
Quoted text (1 line)
> Yes when having multiple payments with different timeouts one has to keep track of when to broadcast which transaction, but this is similar to the current approach. It does make it significantly harder to transact sub-dust amounts though. For a 1 satoshi payments one would often pay >500 satoshi for claiming it on-chain.
You can't really create < 546 satoshi outputs anyway, since they'd be non-standard ATM. I currently keep those off-chain (they add to fees).
A probabalistic scheme is possible, but it adds an extra round-trip (we both need to generate the random number before we know what's in the tx to exchange signatures).
And even then, you can decide to dump your tx onchain if it works in your favour, so a probabalistic scheme is probably pointless.
Cheers, Rusty.