Research/Bitcoin Dev Archive / lightning-dev list
Loop attack with onion routing..
27 messages, Aug 20 to Sep 2, 2015. Started by Rusty Russell.
Anthony Towns (12), Rusty Russell (7), CJP (6), Joseph Poon (2)
Hi all!
So, with some prompting from AJ who has been working on node incentives, I realized there's a nasty attack available to the network. You simply route a payment back to another channel you own, then refuse to dislose R.
You have to lock up N bitcoins, but so does every node in the path (and nobody gets paid!). Onion routing means nobody knows who to blame (you can simply claim there's another hop after you).
I think in this case we need to peel the onion[1]: if a payment takes too long you tell the previous node where you sent it (and relay where it sent it, etc.) If you're the last in the queue, you also need to prove that you closed the channel to the offender[2] (which costs you a txfee, providing disincentive).
Anyone see any other problems?
Thanks, Rusty.
[1] Which means exposing a set of hashes corresponding to hashes of the
route steps, and including a nonce inside each route step, so you
can prove you decrypted it.
[2] eg. provide the commitment tx or mutual close tx, and a signature
from that node's key provign that they created it with you.On Thu, Aug 20, 2015 at 03:19:29PM +0930, Rusty Russell wrote:
Quoted text (8 lines)
> So, with some prompting from AJ who has been working on node > incentives, I realized there's a nasty attack available to the > network. You simply route a payment back to another channel you own, > then refuse to dislose R. > > You have to lock up N bitcoins, but so does every node in the path > (and nobody gets paid!). Onion routing means nobody knows who to > blame (you can simply claim there's another hop after you).
This can be defined as a feature, though. If one expects the coins to be locked up for the duration from the outset, the risk models are a lot more clear.
It forces the graph to be more diffuse. It also forces intermediate nodes who are well-connected (who therefore also are the most likely subject of attacks) to offload their HTLCs to 3rd party channel liquidity providers.
E.g. If Mallory tries to tie up the Alice<->Bob link, then if Carol is connected to both Alice and Bob, she can take the HTLC to be Alice->Carol->Bob, so that the Alice<->Bob link is clear.
Quoted text (5 lines)
> I think in this case we need to peel the onion[1]: if a payment takes > too long you tell the previous node where you sent it (and relay where > it sent it, etc.) If you're the last in the queue, you also need to > prove that you closed the channel to the offender[2] (which costs you > a txfee, providing disincentive).
My concern with mitigating this by establishing blame via information disclosure is that it will encourage graph centralization.
Quoted text (1 line)
> Anyone see any other problems?
I see the primary problem with "onion" routing is that some parts of the graph may be faster with disclosure of R. In effect, some people may have higher costs in the "time" part of "time-value"
E.g. A->B->C->D->E. If C, D, and E are colluding participants to each other, and their R gets disclosed immediately, their channel's value permits much lower fees. They can collude to be dishonest with B, so that B's channel is tied up for the maximum period of time. This increases the costs for B and biases channels to use the C,D,E cartel due to lower costs (since the channels aren't locked up as long).
However! The effect isn't necessarily that the cartel is successful, there are always second order effects in preventing potential problems. It's possible that B mitigates this by biasing the routing towards certain participants that B "likes" (IOW, trusts to not withhold R to the maximum time), which is where I think the real complexity with incentives lie -- B will discourage using onion routing entirely.
I see the tradeoffs as having both as an option may make sense, the second order effect gives you an option for either (with one possibly being slightly more expensive due to the withholding risks), whereas forcing onion *only* on everything may create emergent cartelization incentives. I haven't fully thought out the implications, and not particularly attached to this viewpoint, though.
Thaddeus mentioned a possible solution to all this being funds sent to each participant with multiple signatures for different times of disclosure of R (having the spending transaction be double-spent with different locktimes, this is dependent upon a longer-term malleability fix and may require a more elaborate tree structure for the HTLC spends). E.g. release within 4 hours will have each hop make slightly more money in fees. It doesn't guarantee against withholding, it just creates a material cost to do so. I don't think we've really fleshed out the idea, though AFAIK.
On 20 August 2015 at 23:08, Joseph Poon <joseph at lightning.network> wrote:
Quoted text (8 lines)
> I see the primary problem with "onion" routing is that some parts of the > graph may be faster with disclosure of R. In effect, some people may > have higher costs in the "time" part of "time-value" > > E.g. A->B->C->D->E. If C, D, and E are colluding participants to each > other, and their R gets disclosed immediately, their channel's value > permits much lower fees. They can collude to be dishonest with B, so > that B's channel is tied up for the maximum period of time.
If they do that, C doesn't get paid until the timeout; and the only way D gets paid is from C, and the only way E gets paid is from D. So I don't see what good colluding actually does them? ie you just get:
Immediate: D pays E C pays D Later: B pays C A pays B
But C could achieve that outcome on its own, just by delaying notifying B until near the timeout; no collusion necessary. In any event, if the transaction's going to succeed, the money on the B-C channel's HTLC is going to be C's, so C is mainly depriving itself by filing to communicate.
If you have B and D collude instead, so that E reveals R to D, and D reveals R to B instead of C, then the payments could go:
D pays E D reveals R to B A pays B B pays D
with the transaction from B->C and C->D remaining open until the timeout, but everyone else is square. That would inconvenience C, possibly cheaply for B and D. If there's already a channel between B and D (for the "B pays D" step), I'm not sure why B and D wouldn't just announce that, and once it was announced, I don't see why A would route via C anyway...
Cheers, aj
On Fri, Aug 21, 2015 at 12:12:15AM +0200, Anthony Towns wrote:
Quoted text (5 lines)
> But C could achieve that outcome on its own, just by delaying > notifying B until near the timeout; no collusion necessary. In any > event, if the transaction's going to succeed, the money on the B-C > channel's HTLC is going to be C's, so C is mainly depriving itself by > filing to communicate.
Yes, the point is that pending sends between participants in this cartel have a shorter time than outside this cartel. So the point is that C<->D<->E links will always have shorter HTLCs in transit than B's. It's only C holding it up, but before that D and E decided not to hold it up.
Quoted text (14 lines)
> If you have B and D collude instead, so that E reveals R to D, and D > reveals R to B instead of C, then the payments could go: > > D pays E > D reveals R to B > A pays B > B pays D > > with the transaction from B->C and C->D remaining open until the > timeout, but everyone else is square.??? That would inconvenience C, > possibly cheaply for B and D. If there's already a channel between B > and D (for the "B pays D" step), I'm not sure why B and D wouldn't > just announce that, and once it was announced, I don't see why A would > route via C anyway...
Perhaps I may be misunderstanding things, but the purpose of not announcing is to collectively make any paths to C delay closing out the HTLC as long as possible, so that anyone that transacts with C has to wait a long time, which will decrease the incentive to transact with C. So the threat is that if C is being attacked, and B is not colluding, then A and B will dislike transacting with C, even though it's not C's fault. There's insufficient incentive to push funds when closing out the HTLC (as opposed to pulling), e.g. A->B, due to the off-chance they forget, but I may be wrong here, this is a bit speculative.
Joseph Poon <joseph at lightning.network> writes:
Quoted text (13 lines)
> On Thu, Aug 20, 2015 at 03:19:29PM +0930, Rusty Russell wrote: >> So, with some prompting from AJ who has been working on node >> incentives, I realized there's a nasty attack available to the >> network. You simply route a payment back to another channel you own, >> then refuse to dislose R. >> >> You have to lock up N bitcoins, but so does every node in the path >> (and nobody gets paid!). Onion routing means nobody knows who to >> blame (you can simply claim there's another hop after you). > > This can be defined as a feature, though. If one expects the coins to be > locked up for the duration from the outset, the risk models are a lot > more clear.
My concern is that the risk model is "good txs take < 30 seconds, bad take 4 days". And you have no way of judging which side of that 10,000 factor this is...
Quoted text (8 lines)
> It forces the graph to be more diffuse. It also forces intermediate > nodes who are well-connected (who therefore also are the most likely > subject of attacks) to offload their HTLCs to 3rd party channel > liquidity providers. > > E.g. If Mallory tries to tie up the Alice<->Bob link, then if Carol is > connected to both Alice and Bob, she can take the HTLC to be > Alice->Carol->Bob, so that the Alice<->Bob link is clear.
It's not clear to me how you would atomically move an HTLC? Or are you assuming you know in advance?
Quoted text (8 lines)
>> I think in this case we need to peel the onion[1]: if a payment takes >> too long you tell the previous node where you sent it (and relay where >> it sent it, etc.) If you're the last in the queue, you also need to >> prove that you closed the channel to the offender[2] (which costs you >> a txfee, providing disincentive). > > My concern with mitigating this by establishing blame via information > disclosure is that it will encourage graph centralization.
You lost me between these two statements?
Though the important point is that some channel gets closed for slow payments, to produce disincentive. I think that's sufficient, and potentially leaks less information?
But unacceptable risk levels will lead to onion protocol deprecation (thus, no financial privacy), so you can prevent attacks. The onion protocol will be so much more expensive because it's only used by Mallory and co, so you have to assume every HTLC will timeout. Everyone loses.
Quoted text (12 lines)
>> Anyone see any other problems? > > I see the primary problem with "onion" routing is that some parts of the > graph may be faster with disclosure of R. In effect, some people may > have higher costs in the "time" part of "time-value" > > E.g. A->B->C->D->E. If C, D, and E are colluding participants to each > other, and their R gets disclosed immediately, their channel's value > permits much lower fees. They can collude to be dishonest with B, so > that B's channel is tied up for the maximum period of time. This > increases the costs for B and biases channels to use the C,D,E cartel > due to lower costs (since the channels aren't locked up as long).
First time they do this, if they don't close a channel (costing them on-blockchain fees), B closes connection to C as dishonest?
That seems to work...
Quoted text (13 lines)
> However! The effect isn't necessarily that the cartel is successful, > there are always second order effects in preventing potential problems. > It's possible that B mitigates this by biasing the routing towards > certain participants that B "likes" (IOW, trusts to not withhold R to the > maximum time), which is where I think the real complexity with > incentives lie -- B will discourage using onion routing entirely. > > I see the tradeoffs as having both as an option may make sense, the > second order effect gives you an option for either (with one possibly > being slightly more expensive due to the withholding risks), whereas > forcing onion *only* on everything may create emergent cartelization > incentives. I haven't fully thought out the implications, and not > particularly attached to this viewpoint, though.
I worry about not having onion because as we've seen in bitcoin, your privacy matters to my privacy: I can't be the only private one on the network. And onion is basically free on a technology level.
Quoted text (9 lines)
> Thaddeus mentioned a possible solution to all this being funds sent to > each participant with multiple signatures for different times of > disclosure of R (having the spending transaction be double-spent with > different locktimes, this is dependent upon a longer-term malleability > fix and may require a more elaborate tree structure for the HTLC > spends). E.g. release within 4 hours will have each hop make slightly > more money in fees. It doesn't guarantee against withholding, it just > creates a material cost to do so. I don't think we've really fleshed out > the idea, though AFAIK.
AJ has been assuming similar per-hop contracts, but I'd like to simplify for the first attempt if I can.
So I think it makes sense to begin with to have a "per hop maxdelay" (so you can indicate, and be charged appropriately, if this is expected to be slow). Think "20 seconds".
If you can't complete the HTLC with the next node in maxdelay seconds, you return route fail. If the next node doesn't complete or routefail in maxdelay * MAX_HOPS (aka "20") seconds, you unilaterally close the channel and send that tx in your "delay" message back.
I *think* this works?
Cheers, Rusty.
On 21 August 2015 at 01:57, Joseph Poon <joseph at lightning.network> wrote:
Quoted text (11 lines)
> On Fri, Aug 21, 2015 at 12:12:15AM +0200, Anthony Towns wrote: > > But C could achieve that outcome on its own, just by delaying > > notifying B until near the timeout; no collusion necessary. In any > > event, if the transaction's going to succeed, the money on the B-C > > channel's HTLC is going to be C's, so C is mainly depriving itself by > > filing to communicate. > Yes, the point is that pending sends between participants in this cartel > have a shorter time than outside this cartel. So the point is that > C<->D<->E links will always have shorter HTLCs in transit than B's. It's > only C holding it up, but before that D and E decided not to hold it up. >
I'm still not following how that's a problem? If C/D and D/E are really quick and reliable, isn't it desirable to send more transactions their way anyway?
(a) Assuming source routing. A chooses to route a payment. Her options are "A->B->C->D->E" or "A->C->D->E". Based on time, she presumably chooses the latter. Based on cost, maybe A->B or B->C has negative fees involved, so she /might/ choose the longer path for slightly lower fees.
In that case either B is paying A to get funds on the B side of A->B or C is paying A to get funds on the C side of B->C. In the latter case, I can't imagine why C would want to punish B when she's desperate for funds that she's offering negative fees. So afaics the only case is if B is paying A to get funds to send back to A,
So, fund status is:
D->E paid B->C locked A->B locked
and C->D is either paid or locked, leaving one of C or D out of pocket. That's a cost to C or D of TIMEOUT*AMOUNT worth of funds on the B/C or C/D channels, in order to encourage future transactions to deposit funds on C's side of the A/C channel rather than the B/C channel. Since D doesn't benefit directly, I don't see why he'd suffer the loss rather than letting C do it.
But if C's willing to lose TIMEOUT*AMOUNT worth of time-value-of-bitcoin, to encourage transactions over A/C rather than B/C, why doesn't she just offer reduced/negative fees?
(b) Assuming onion routing, C/D don't actually know who A is -- it may be someone that only has a connection to B; so if they delay transactions, they run the risk that future txns will be routed A->B->F->E bypassing them completely.
(c) Assuming non-source routing, by delaying transactions, they risk B choosing a different route for future transactions, rather than A doing so. I'm not sure how the liklihoods balance out there though.
Cheers, aj
On 21 August 2015 at 04:22, Rusty Russell <rusty at rustcorp.com.au> wrote:
Quoted text (3 lines)
> My concern is that the risk model is "good txs take < 30 seconds, bad > take 4 days". And you have no way of judging which side of that 10,000 > factor this is...
You charge fees for 4 days, and if it only takes <30s you get a bunch of profit, yay!
Those fees are still pretty reasonable: 20% ROI per year is just 0.2% over four days; .2% times 8 hops is 1.6% which is still much better than Visa/Paypal etc, even without the benefit of scaling to microtransactions.
Also, the extra profit on fast transactions is the only thing that you've got to pay for the coins in your channel(s) that aren't currently doing anything.
Quoted text (10 lines)
> It forces the graph to be more diffuse. It also forces intermediate > > nodes who are well-connected (who therefore also are the most likely > > subject of attacks) to offload their HTLCs to 3rd party channel > > liquidity providers. > > E.g. If Mallory tries to tie up the Alice<->Bob link, then if Carol is > > connected to both Alice and Bob, she can take the HTLC to be > > Alice->Carol->Bob, so that the Alice<->Bob link is clear. > It's not clear to me how you would atomically move an HTLC? Or are you > assuming you know in advance? >
/Alice/ always knows in advance -- she knows the state of the Alice/Bob channel before she tries adding an HTLC. I think she can just add a hop in the route even under onion routing with no particular problems.
Quoted text (14 lines)
>> Anyone see any other problems? > > I see the primary problem with "onion" routing is that some parts of the > > graph may be faster with disclosure of R. In effect, some people may > > have higher costs in the "time" part of "time-value" > > E.g. A->B->C->D->E. If C, D, and E are colluding participants to each > > other, and their R gets disclosed immediately, their channel's value > > permits much lower fees. They can collude to be dishonest with B, so > > that B's channel is tied up for the maximum period of time. This > > increases the costs for B and biases channels to use the C,D,E cartel > > due to lower costs (since the channels aren't locked up as long). > First time they do this, if they don't close a channel (costing them > on-blockchain fees), B closes connection to C as dishonest? >
How does B know C is dishonest, and not D or E? How does B know someone was dishonest, and that the delay wasn't desired by both of A and E?
(Delays might be desirable if they assist with privacy by resisting traffic analysis)
Quoted text (3 lines)
> AJ has been assuming similar per-hop contracts, but I'd like to simplify > for the first attempt if I can. >
I think you need to have "reputation" as part of the routing service at that point; but while lightning is small, that's probably trivial, IMHO.
Quoted text (4 lines)
So I think it makes sense to begin with to have a "per hop maxdelay" (so > you can indicate, and be charged appropriately, if this is expected to > be slow). Think "20 seconds". >
Hmm. You'd have to have that be cumulative:
A -> B -> C -> D
A: I expect a response in 2 days + 40s B: you can expect a response in 2 days + 20s C: you can expect a response in 2 days
But what happens if D takes longer than 2 days 90 seconds? C accuses D o being unreliable and maybe closes the channel. But does B also close the channel with C? Or does C say "Hey, D didn't contact me" at 2 days and 10s and get let off? (What happens if C is lying?) In either event, B only charged fees for 2 days + 20s of time-value, but still has to wait for the timeout, no matter how nice C is.
Quoted text (6 lines)
If you can't complete the HTLC with the next node in maxdelay seconds, > you return route fail. If the next node doesn't complete or routefail > in maxdelay * MAX_HOPS (aka "20") seconds, you unilaterally close the > channel and send that tx in your "delay" message back. > I *think* this works? >
Closing the channel doesn't give you your money back any earlier, so afaics you still need to charge fees for the full timeout. I don't /think/ a separate pretend-timeout makes things any less exploitable.
If people get over-confident and run hubs at rates assuming the timeout will never get hit, I think you have to treat them as effectively subsidising the network; eventually they'll hit a bunch of slow transactions in a row either by happenstance or enemy action, and end up losing money.
Cheers, aj
- - Anthony Towns <aj at erisian.com.au>
On 20 August 2015 at 07:49, Rusty Russell <rusty at rustcorp.com.au> wrote:
Quoted text (1 line)
> I think in this case we need to peel the onion[1]:
Okay, so how might this actually work?
Alice sends a payment to Emma, via Bob, Carol and Dave.
Case 1: Dave misbehaves by taking a few minutes rather than a few seconds to talk to Emma.
* Carol decides that's unacceptable and asks Dave for an excuse. Dave cannot provide one. Carol closes the channel (unilaterally, or with Dave's grudging cooperation) * At this point Bob believes Carol has taken too long too, so he asks Carol for an excuses. Carol says its Dave's fault, and points to the transaction closing the Carol/Dave channel as evidence; Bob knows that Dave was cheating because the HTLC is still present in that transaction (Carol reveals the P2SH script if necessary); Bob knows that Dave was who Carol was forwarding to, because Carol provides a verifiable decryption of the onion routing message Bob passed on to Carol. * Bob likewise passes this back on to Alice as the explanation of why it's taking so long.
Case 2: Carol misbehaves by pretending Dave was misbehaving, when he wasn't.
* Carol closes the channel with Dave before accepting Dave's resolution of the HTLC, passing the info to Bob as before. * Since he's not cheating, Dave claims the HTLC output on the blockchain. * Bob sees the HTLC output Carol was pointing at has been spent in a timely fashion, indicating Carol is cheating. * Bob claims funds from Alice in a timely fashion, so does not have to justify being a cheat himself. * Bob closes the channel with Carol since she's being weird.
That seems like it works as expected to me?
But this reveals the chain of payees all the way back to the root. If you were routing a payment from
Joe Commie -> Bank of America -> Deutsche Bank -> Central Bank of Cuba -> Cuba Communist Party
then you might find that a network hiccup in Cuba might cause BoA to realise you're sending money to Cuba, and be forced to cease their relationship with you. This potentially gets worse if you're not actually trying to send money to some forbidden organisation, but you just happened to randomly choose a route that looks suspicious to hide your payments to Ashley Madison or your donation in support of traditional marriage.
But if that's okay, and you don't mind BoA (or someone snooping on BoA's traffic) knowing who you're sending money too, why do onion routing in the first place?
Cheers, aj
Anthony Towns <aj at erisian.com.au> writes:
Quoted text (3 lines)
> On 20 August 2015 at 07:49, Rusty Russell <rusty at rustcorp.com.au> wrote: > >> I think in this case we need to peel the onion[1]:
I changed my mind by the way. You don't need to peel the onion, you just need the commit transaction + htlc transactions tied to the closure (and you can see the HTLC is yours, by the R value).
Quoted text (10 lines)
> Okay, so how might this actually work? > > Alice sends a payment to Emma, via Bob, Carol and Dave. > > Case 1: Dave misbehaves by taking a few minutes rather than a few seconds > to talk to Emma. > > * Carol decides that's unacceptable and asks Dave for an excuse. Dave > cannot provide one. Carol closes the channel (unilaterally, or with Dave's > grudging cooperation)
A -> B -> C XXX D -> E
Quoted text (9 lines)
> * At this point Bob believes Carol has taken too long too, so he asks > Carol for an excuses. Carol says its Dave's fault, and points to the > transaction closing the Carol/Dave channel as evidence; Bob knows that Dave > was cheating because the HTLC is still present in that transaction (Carol > reveals the P2SH script if necessary); Bob knows that Dave was who Carol > was forwarding to, because Carol provides a verifiable decryption of the > onion routing message Bob passed on to Carol. > * Bob likewise passes this back on to Alice as the explanation of why it's > taking so long.
Yep, seems to work.
Quoted text (12 lines)
> Case 2: Carol misbehaves by pretending Dave was misbehaving, when he wasn't. > > * Carol closes the channel with Dave before accepting Dave's resolution > of the HTLC, passing the info to Bob as before. > * Since he's not cheating, Dave claims the HTLC output on the blockchain. > * Bob sees the HTLC output Carol was pointing at has been spent in a > timely fashion, indicating Carol is cheating. > * Bob claims funds from Alice in a timely fashion, so does not have to > justify being a cheat himself. > * Bob closes the channel with Carol since she's being weird. > > That seems like it works as expected to me?
No, that doesn't work: Bob can't tell if Dave really sent it to Carol or not. But Alice doesn't care: she just knows that someone paid 2 txfees in apology money for the delay.
To recap (mainly for others), there are two failure cases:
The good one: 1) Carol can't reach Dave in 20 seconds (no timely response to the update_add_htlc packet). She send update_remove_htlc() back to Bob, who sends it back to Alice, undoing all the HTLCs just like any route or fee failure.
The bad one: 2) Dave starts the HTLC process, but then times out (doesn't resolve HTLC in 20*11 seconds, and doesn't send back a blame packet from Emma, either).
In the latter case, Carol dumps the commit tx to the blockchain, and the screwed-up HTLC (and any other casualty HTLCs in progress, sorry). She can include this commit tx + htlc txs in the blame packet back to Bob; there's no reason to name Dave AFAICT[1].
If Carol values Dave too much to drop the channel, she risks that Bob will drop the channel with her. It's not foolproof, but it provides some disincentive. I'm hoping that along with the profit motive, it's sufficient.
Cheers, Rusty. [1] Normal bitcoin coin analysis might reveal who Dave is, of course...
On 24 August 2015 at 02:59, Rusty Russell <rusty at rustcorp.com.au> wrote:
Quoted text (7 lines)
> Anthony Towns <aj at erisian.com.au> writes: > > On 20 August 2015 at 07:49, Rusty Russell <rusty at rustcorp.com.au> wrote: > >> I think in this case we need to peel the onion[1]: > I changed my mind by the way. You don't need to peel the onion, you > just need the commit transaction + htlc transactions tied to the closure > (and you can see the HTLC is yours, by the R value). >
(I'm counting anything that reveals multiple forward steps in the chain as unpeeling the onion)
Quoted text (17 lines)
> > Case 2: Carol misbehaves by pretending Dave was misbehaving, when he > wasn't. > > * Carol closes the channel with Dave before accepting Dave's resolution > > of the HTLC, passing the info to Bob as before. > > * Since he's not cheating, Dave claims the HTLC output on the > blockchain. > > * Bob sees the HTLC output Carol was pointing at has been spent in a > > timely fashion, indicating Carol is cheating. > > * Bob claims funds from Alice in a timely fashion, so does not have > I > to > > justify being a cheat himself. > > * Bob closes the channel with Carol since she's being weird. > > That seems like it works as expected to me? > > No, that doesn't work: Bob can't tell if Dave really sent it to Carol or > not.
Dave didn't send anything to Carol; he resolved the transaction on the blockchain. Bob can tell this, because Carol pointed Bob at the exact transaction that Dave spent, and the fact that Dave spent it reveals R and the time at which Dave spent it (either included in the blockchain or with 0-confirmations) indicates that Dave wasn't very delayed.
Quoted text (4 lines)
> > But Alice doesn't care: she just knows that someone paid 2 txfees > in apology money for the delay. >
I'm not sure where the apology money comes from? Why would Bob or Carol pay Alice when Alice was the one who chose to route via Dave? Why would Dave pay if his channel's getting closed anyway?
Quoted text (9 lines)
The bad one: > 2) Dave starts the HTLC process, but then times out (doesn't resolve > HTLC in 20*11 seconds, and doesn't send back a blame > packet from Emma, either). > In the latter case, Carol dumps the commit tx to the blockchain, and the > screwed-up HTLC (and any other casualty HTLCs in progress, sorry). She > can include this commit tx + htlc txs in the blame packet back to Bob; > there's no reason to name Dave AFAICT[1]. >
The HTLC txn provides Dave's public key id though (assuming you un-P2SH it, which you need to to prove that it corresponds with the R you expect), which is the only name for Dave that matters, isn't it?
Cheers, aj
Anthony Towns <aj at erisian.com.au> writes:
Quoted text (12 lines)
> On 24 August 2015 at 02:59, Rusty Russell <rusty at rustcorp.com.au> wrote: >> 2) Dave starts the HTLC process, but then times out (doesn't resolve >> HTLC in 20*11 seconds, and doesn't send back a blame >> packet from Emma, either). >> In the latter case, Carol dumps the commit tx to the blockchain, and the >> screwed-up HTLC (and any other casualty HTLCs in progress, sorry). She >> can include this commit tx + htlc txs in the blame packet back to Bob; >> there's no reason to name Dave AFAICT[1]. > > The HTLC txn provides Dave's public key id though (assuming you un-P2SH > it, which you need to to prove that it corresponds with the R you expect), > which is the only name for Dave that matters, isn't it?
There's no reason for the two to be connected. You have a pubkey as your ID for network and routing encryption, but you can offer any transaction as an anchor, and use any keys you want.
Now, Joseph was suggested that it doesn't *have* to be this way, such that the blockchain would show all the channels open, but while that's a cute hack I don't think it's necessary.
Cheers, Rusty.
On 24 August 2015 at 12:58, Rusty Russell <rusty at rustcorp.com.au> wrote:
Quoted text (19 lines)
> Anthony Towns <aj at erisian.com.au> writes: > > On 24 August 2015 at 02:59, Rusty Russell <rusty at rustcorp.com.au> wrote: > >> 2) Dave starts the HTLC process, but then times out (doesn't resolve > >> HTLC in 20*11 seconds, and doesn't send back a blame > >> packet from Emma, either). > >> In the latter case, Carol dumps the commit tx to the blockchain, and the > >> screwed-up HTLC (and any other casualty HTLCs in progress, sorry). She > >> can include this commit tx + htlc txs in the blame packet back to Bob; > >> there's no reason to name Dave AFAICT[1]. > > > > The HTLC txn provides Dave's public key id though (assuming you un-P2SH > > it, which you need to to prove that it corresponds with the R you > expect), > > which is the only name for Dave that matters, isn't it? > > There's no reason for the two to be connected. You have a pubkey as > your ID for network and routing encryption, but you can offer any > transaction as an anchor, and use any keys you want. >
Are we talking about different transactions? I'm thinking:
T1: Carol+Dave Anchor(s) Inputs: whatever Output: requires Carol + Dave
T2: Channel closure
Inputs: T1
Outputs:
Carol balance
Dave balance
HTLC 1
HTLC 2
HTLC 3
...
T3: Dave cashing in HTLC 2 Input: T2 HTLC 2; R, Dave's key Outputs: whatever
For Carol to prove to Bob that she closed the channel, she points Bob at T2/HTLC 3 providing the expanded P2SH as necessary, which reveals Dave's "lightning" key as well as R. The anchor isn't really relevant.
But maybe Dave could have a different key for each channel, and choose them independently of his lightning network id as used for routing (and the corresponding public key used for onion routing)?
But if the key isn't linked, then Carol could construct her own "Carol-in-a-Dave-suit" set of keys, and make a fake "channel closure" transaction to convince Bob that Dave was being bad, It would cost a bitcoin transaction and lock up her bitcoins for the timeout period (assuming she never finds out R), though -- but I'm not sure that's enough?
Cheers, aj
Anthony Towns <aj at erisian.com.au> writes:
Quoted text (4 lines)
> On 24 August 2015 at 12:58, Rusty Russell <rusty at rustcorp.com.au> wrote: > But maybe Dave could have a different key for each channel, and choose them > independently of his lightning network id as used for routing (and the > corresponding public key used for onion routing)?
Yep.
Quoted text (3 lines)
> But if the key isn't linked, then Carol could construct her own > "Carol-in-a-Dave-suit" set of keys, and make a fake "channel closure" > transaction to convince Bob that Dave was being bad,
As I said before, you could never use this to convince anyone that anyone was bad anyway.
Maybe Carol ignored Dave's perfectly valid reply. Maybe Dave didn't reply. You can't tell.
Quoted text (3 lines)
> It would cost a > bitcoin transaction and lock up her bitcoins for the timeout period > (assuming she never finds out R), though -- but I'm not sure that's enough?
Someone bled (in fees and delayed funds). That's hopefully enough; at least it cost them to inconvenience you.
Cheers, Rusty.
Quoted text (8 lines)
> So, with some prompting from AJ who has been working on node > incentives, I realized there's a nasty attack available to the network. > You simply route a payment back to another channel you own, then refuse > to dislose R. > > You have to lock up N bitcoins, but so does every node in the path (and > nobody gets paid!). Onion routing means nobody knows who to blame (you > can simply claim there's another hop after you).
Yes, that's a nasty one: the total damage to the network is much larger than the damage to the attacker, especially when the attacker is free to choose a very long route. This could be used to perform a DoS attack on the network.
Quoted text (7 lines)
> I think in this case we need to peel the onion[1]: if a payment takes > too long you tell the previous node where you sent it (and relay where > it sent it, etc.) If you're the last in the queue, you also need to > prove that you closed the channel to the offender[2] (which costs you a > txfee, providing disincentive). > > Anyone see any other problems?
I don't like the "peeling the onion" idea, since it breaks down a very important privacy layer. This privacy is necessary e.g. to make sure the network remains open for new participants to start routing, even against the will of an existing cartel of routers.
Maybe I'm overlooking something, but wouldn't it be enough to add a fine, to be paid from payee-side of a single link to the payer-side of the link, if the R value is delayed? It wouldn't even be necessary to cryptographically enforce such a fine: if the fine isn't paid, the other node can simply close the channel, isolating the misbehaving node. Well-behaving nodes will always pay the fine, thereby keeping their link intact and keeping a healthy network of well-behaving nodes.
In order to punish the attacker, these fines should be accumulated towards the payee side of the route; this sounds like a similar problem as the accumulation of ordinary transaction fees across a route.
Intuitively I'd say that, for a mixed source/non-source routing network, it'd be reasonable that the endpoints of the transaction (final payer and payee) explicitly pay fees to the source-routed nodes in a route, and that any fees of non-source routed nodes are covered by the fees paid to their closest source-routed nodes(**). Explicitly paying fines to source-routed nodes also provides an incentive(*) to keep routes short.
CJP
(*) unless the explicit fee is negative of course, but that's a feature, not a bug.
(**) Example (for ordinary fees, but could be similar for fines): capitals are source-routed nodes
A - b - c - D - e - F - g - H
A pays 1.000 mBTC to H (main payment from payer A to payee H) A pays 0.003 mBTC to D (explicit source routing fee; D is the "meeting point" agreed by A and H) H pays 0.003 mBTC to F (explicit source routing fee; H selected F for onion-routing towards D, without A's knowledge) A pays 0.002 mBTC to b (non-source routing fee) b pays 0.001 mBTC to c (non-source routing fee) D pays 0.001 mBTC to c (non-source routing fee) D pays 0.001 mBTC to e (non-source routing fee) F pays 0.001 mBTC to e (non-source routing fee) F pays 0.001 mBTC to g (non-source routing fee) H pays 0.001 mBTC to g (non-source routing fee)
Net result: A: -1.005 b: +0.001 c: +0.002 D: +0.001 e: +0.002 F: +0.001 g: +0.002 H: +0.996
On 30 August 2015 at 03:50, CJP <cjp at ultimatestunts.nl> wrote:
Quoted text (7 lines)
> Maybe I'm overlooking something, but wouldn't it be enough to add a > fine, to be paid from payee-side of a single link to the payer-side of > the link, if the R value is delayed? It wouldn't even be necessary to > cryptographically enforce such a fine: if the fine isn't paid, the other > node can simply close the channel, isolating the misbehaving node. >
I think that gives the following choices for the payee:
a) acts quickly, everyone's happy! b) reveal R later, get less money due to having to pay a fine c) fail the payment /and/ pay a fine for taking so long d) pay the fine and close the channel cooperatively e) close the channel unilaterally
I think (b) or (c) is better than (d) always.
If the fine is small (relative to bitcoin blockchain fees), then (d) should always be better than (e).
Between (b) and (c), I think the fine is just a sunk cost, so (b) is probably always better than (c), assuming you know R.
I'm not sure the fine is necessarily small relative to the blockchain fees, though (especially if the blockchain fee is zero...)? A long chain might get fees into the 1% range, and for a moderate sized payment ($5 coffee, 20 mBTC) that would be .2 mBTC, exceeding a 1kB txn fee of .1 mBTC...
Quoted text (3 lines)
> Well-behaving nodes will always pay the fine, thereby keeping their link > intact and keeping a healthy network of well-behaving nodes. >
The thing that I can't get to work out here is when you have a misbehaving node at the end of a chain, who doesn't pay their fine, but well-behaved nodes making up the rest of the chain.
Quoted text (4 lines)
> A - b - c - D - e - F - g - H H pays 0.003 mBTC to F (explicit source routing fee; H selected F for > onion-routing towards D, without A's knowledge) >
You mean "D selected F for onion-routing towards H" here, surely?
Quoted text (8 lines)
> A pays 0.002 mBTC to b (non-source routing fee) > b pays 0.001 mBTC to c (non-source routing fee) > D pays 0.001 mBTC to c (non-source routing fee) > D pays 0.001 mBTC to e (non-source routing fee) > F pays 0.001 mBTC to e (non-source routing fee) > F pays 0.001 mBTC to g (non-source routing fee) > H pays 0.001 mBTC to g (non-source routing fee) >
These fees still don't vary with time, so a 30s result versus a 4 day result still has a factor of 10k difference in cost vs revenue. I think over 4 days, a 0.20% fee is about reasonable matching the 0.002 fees that c, e and g end up with above (0.20%/4 days works out to a 20% ROI per annum if all your channels are constantly at 100% use), so linearising to an hour that's a 0.002% fee, which works out to 2 satoshi per mBTC per hour.
Hmm, you /could/ actually lock those fees in cryptographically just by updating the channel once an hour with the fees applied to the balances -- at the above rate, accepting the update would be cheaper than paying a 0.1mBTC blockchain txn fee, as long as you had less than 10 BTC worth of active transactions that you're paying fines on.
Cheers, aj
Quoted text (6 lines)
> > I'm not sure the fine is necessarily small relative to the blockchain > fees, though (especially if the blockchain fee is zero...)? A long > chain might get fees into the 1% range, and for a moderate sized > payment ($5 coffee, 20 mBTC) that would be .2 mBTC, exceeding a 1kB > txn fee of .1 mBTC...
You assume the present-day exchange rate. When scaling towards larger numbers of users and transactions, the exchange rate will increase a lot. This will make the blockchain tx fee much worse. With increasing numbers of users the route length in Lightning might also increase a bit (hence increase its tx fee too), but the situation is much better than with in-blockchain transactions.
A very simplistic estimate of the exchange rate in a very ambitious scenario: assume a future world of 10e9 people, who have all reached developed-nation wealth, and who use Bitcoin for all their finances. Each of them can have 2.1 mBTC of savings. Assuming the average developed-nation person has about $10e3 savings in today's dollars, 2.1 mBTC savings in our scenario should be equivalent to $10e3 in today's dollars. So that is $4800 / mBTC = $4.8 mln / BTC! Note that the actual exchange rate in our hypothetical scenario will be much higher, since the dollar will have become worthless.
CJP
Quoted text (1 line)
>
Quoted text (9 lines)
> Well-behaving nodes will always pay the fine, thereby keeping > their link > intact and keeping a healthy network of well-behaving nodes. > > > The thing that I can't get to work out here is when you have a > misbehaving node at the end of a chain, who doesn't pay their fine, > but well-behaved nodes making up the rest of the chain. >
If all fines are accumulated towards the payee side, the effect would be that the last well-behaving node has to pay the fine. So we've punished an innocent party. Luckily, this innocent party can prevent further damage by closing the channel to the real bad guy. If the risk of paying fines because of mis-behaving neighbors is really significant, you could demand non-trusted (e.g. anonymous) neighbors to pre-pay a fine fund to you, before you start routing payments towards them.
Of course you could also try to design a cryptographic payment channel method for enforcing fine payment, but I think that, by now, we're already so deep into 2nd-order, 3rd-order etc. effects that it might not be worth the added complexity. You should keep things simple to make them work reliably and have them implemented in time.
CJP
Quoted text (7 lines)
> A - b - c - D - e - F - g - H > H pays 0.003 mBTC to F (explicit source routing fee; H > selected F for > onion-routing towards D, without A's knowledge) > > > You mean "D selected F for onion-routing towards H" here, surely?
No :-)
Both sides of a payment may value their privacy, so both sides may want to perform onion routing independently. It's a bit similar to TOR hidden services: you route from both sides towards a "meeting point" somewhere on the route, which is not necessarily one of the end points.
Note that, because locking of transaction funds is always done in payer -> payee direction, this requires a separate routing phase before the locking. So, first you find a route (where all parties say they agree to fees, tx amount, timeouts and other conditions), and then you start performing transaction-channel actions.
Quoted text (17 lines)
> > A pays 0.002 mBTC to b (non-source routing fee) > b pays 0.001 mBTC to c (non-source routing fee) > D pays 0.001 mBTC to c (non-source routing fee) > D pays 0.001 mBTC to e (non-source routing fee) > F pays 0.001 mBTC to e (non-source routing fee) > F pays 0.001 mBTC to g (non-source routing fee) > H pays 0.001 mBTC to g (non-source routing fee) > > > These fees still don't vary with time, so a 30s result versus a 4 day > result still has a factor of 10k difference in cost vs revenue. I > think over 4 days, a 0.20% fee is about reasonable matching the 0.002 > fees that c, e and g end up with above (0.20%/4 days works out to a > 20% ROI per annum if all your channels are constantly at 100% use), so > linearising to an hour that's a 0.002% fee, which works out to 2 > satoshi per mBTC per hour.
Yeah, after writing that e-mail, I realized I was contradicting myself a bit. That system is OK for normal tx fees, but it doesn't seem to work for "delayed tx fines". It's a bit of an open question for me how to distribute these fines on a mixed source/non-source routing network.
On the non-source routed parts, you can't check whether intermediate nodes are honest when calculating the to-be-paid fines. Is that a problem, or is it good enough to let the free market do its job, so that nodes who demand too high fines will lose connections, just like with tx fees? Anyway, I think that for the non-source routing parts, the height of the fine (as a function of tx amount and delay) should be agreed prior to performing a transaction. An intermediate node can demand a payee-side fine that includes a weighed average of the fines it has to pay payer-side on its other links, to stay profitable. This is the same as with regular tx fees.
On the source-routed parts, the fines seem to end up with the end points. Problems: 1. There is no persistent business / trust relationship and no payment channel between endpoint and intermediate source-routed node. So there is no way to enforce fine payment? 2. The payee endpoint is not always the bad guy in a delayed payment scenario. It could be that fund locking from payer to payee stopped somewhere in the middle of the route: in that case, the payee endpoint rightfully never discloses R.
You could of course ignore source routing for the fines, and distribute the fines as if it is only a non-source routing path. The problem is that an attacker can create an arbitrarily long path with source routing, thereby creating arbitrarily large total damage to the network, corresponding to arbitrarily large total fines. If you use pre-calculated fine amounts, an attacker can always make a route that will result in a (large) loss for some intermediate nodes.
CJP
CJP <cjp at ultimatestunts.nl> writes:
Quoted text (13 lines)
>> So, with some prompting from AJ who has been working on node >> incentives, I realized there's a nasty attack available to the network. >> You simply route a payment back to another channel you own, then refuse >> to dislose R. >> >> You have to lock up N bitcoins, but so does every node in the path (and >> nobody gets paid!). Onion routing means nobody knows who to blame (you >> can simply claim there's another hop after you). > > Yes, that's a nasty one: the total damage to the network is much larger > than the damage to the attacker, especially when the attacker is free to > choose a very long route. This could be used to perform a DoS attack on > the network.
Indeed.
Quoted text (9 lines)
>> I think in this case we need to peel the onion[1]: if a payment takes >> too long you tell the previous node where you sent it (and relay where >> it sent it, etc.) If you're the last in the queue, you also need to >> prove that you closed the channel to the offender[2] (which costs you a >> txfee, providing disincentive). >> >> Anyone see any other problems? > > I don't like the "peeling the onion" idea, since it breaks down a very
Me too.
Quoted text (3 lines)
> important privacy layer. This privacy is necessary e.g. to make sure the > network remains open for new participants to start routing, even against > the will of an existing cartel of routers.
Fortunately, I've abandoned it :)
My latest scheme simply requires you to return some valid unilateral close transaction. If you don't, I will close the channel to you, and use that unilateral close to prevent my upstream from closing on me.
I think this has the right incentive; unilateral closes are painful in locked funds, fees and opportunity cost.
We might need to get more sophisticated eventually, but I think it's enough for now?
Thanks, Rusty.
On 31 August 2015 at 04:01, CJP <cjp at ultimatestunts.nl> wrote:
Quoted text (13 lines, sent without quote marks)
> > A - b - c - D - e - F - g - H > > H pays 0.003 mBTC to F (explicit source routing fee; H > > selected F for > > onion-routing towards D, without A's knowledge) > > You mean "D selected F for onion-routing towards H" here, surely? > No :-) > Both sides of a payment may value their privacy, so both sides may want > to perform onion routing independently. > > It's a bit similar to TOR hidden services: you route from both sides towards a "meeting point" somewhere > on the route, which is not necessarily one of the end points. >
Hmm. I would look at that more like:
Setup: - H wants to be secretive. - H establishes a channel with g - H tells F he can route to H via g - H tells D he can route to H via F
Announcement: - H tells other people (such as A) they can route to H via D
Then A sends a txn for H to D as instructed, and D chooses to forward it on via F.
(Hmm. In that scenario, if e tried to send a txn to H, she would route via D, then find D routed the txn back to it -- using the same R -- and that F was the next destination. This would be an information leak, arguably. Likewise for anyone whose cheapest path to D was through e)
Quoted text (6 lines)
Note that, because locking of transaction funds is always done in payer > -> payee direction, this requires a separate routing phase before the > locking. So, first you find a route (where all parties say they agree to > fees, tx amount, timeouts and other conditions), and then you start > performing transaction-channel actions. >
Isn't that a bit circular -- "you obtain the route by sending messages along the route" ?
It also relies on end-to-end communication in realtime, which wouldn't work for paying to a cold-wallet lightning channel that's only occassionally online.
If you *did* assume everything is in realtime, you could avoid fines entirely just by having the protocol be something like:
- the official timeout was 4 days, the unofficial timeout is 4 minutes - ... - okay 4 minutes is up, do you know R? - no, okay, we're revoking the transaction. - you don't want to? fine, channel is closed.
Maybe that's what the default protocol should be anyway, and fines are just an extension to that to bribe the payer not to close the channel...
Quoted text (5 lines)
You could of course ignore source routing for the fines, and distribute > the fines as if it is only a non-source routing path. The problem is > that an attacker can create an arbitrarily long path with source > routing, thereby creating arbitrarily large total damage to the network, > corresponding to arbitrarily large total fines.
I don't think it can go arbitrarily large -- if the recipient is paying the fines at each point, then the scenario is:
incoming HTLC: (Alice to Bob) timeout T X (onward funds) + f (Bob's fees) on success x*t (fine Bob pays Alice) if it takes a long time, t
forwarded HTLC (Bob to Carol) timeout T' X (onward funds) (x+y)*t' (fine Carol pays Bob) if it takes a long time, t'
So Bob can set T' <= M/x where M is the maximum fine I'm willing to pay Alice to keep the channel open, if Carol fails to pay the fine and just closes the channel. If T'<=1 hour or similar, you just return a PKT_ROUTE_FAIL quickly and don't pay any fines.
Carol is faced with T'' <= M/(x+y) which is likely smaller still, and s on.
In the case where a node is expected to take a while, the original payer should be able to send a fee along to cover that node's fines.
Quoted text (4 lines)
If you use > pre-calculated fine amounts, an attacker can always make a route that > will result in a (large) loss for some intermediate nodes. >
Only by sacrificing a channel, though. If you set
commit_fee = 1 mBTC (how much a unilateral channel close costs) close_fee = 0.1 mBTC (fees on a cooperative close)
then if you've got N open HTLC's on your channel with Mallory, then you can set M=0.8/N mBTC and offer Mallory the following options:
a) he pays you the fines he owes, and everyone's happy b) he closes the channel unilaterally and gets whatever he can c) you both close the channel cooperatively, splitting the 0.9 mBTC in fees as 0.8 to you, 0.1 to him.
Mallory's better off in c) than b), and with c) you can afford to pay your fines. Active HTLCs in both directions complicate matters, and 0.8/N mBTC still isn't very much, though.
Cheers, aj
On 31 August 2015 at 03:18, CJP <cjp at ultimatestunts.nl> wrote:
Quoted text (6 lines)
> > I'm not sure the fine is necessarily small relative to the blockchain > > fees, though (especially if the blockchain fee is zero...)? A long > > chain might get fees into the 1% range, and for a moderate sized > > payment ($5 coffee, 20 mBTC) that would be .2 mBTC, exceeding a 1kB > > txn fee of .1 mBTC... > You assume the present-day exchange rate.
Well for concreteness, sure, but what I'm really assuming is that blockchain txn fees maintain a small real value.
I think that's a reasonable assumption to some degree, though, because we're assuming end users will bump their lightning channels at least once every couple of years. That makes the blockchain fee comparable to an annual account keeping fee on a bank account, which puts a ceiling of maybe $10-$20 on blockchain fees. (If bitcoins fees go higher, then presumably you'd be running lightning nodes off of a sidechain or altcoin with lower fees, or you wouldn't be using lightning at all because debit cards are cheaper).
Quoted text (7 lines)
A very simplistic estimate of the exchange rate in a very ambitious > scenario: assume a future world of 10e9 people, who have all reached > developed-nation wealth, and who use Bitcoin for all their finances. > Each of them can have 2.1 mBTC of savings. Assuming the average > developed-nation person has about $10e3 savings in today's dollars, 2.1 > mBTC savings in our scenario should be equivalent to $10e3 in today's > dollars. So that is $4800 / mBTC
In that case $1 uBTC is $4.80, and 1 satoshi is about 5c; so you couldn't charge a fee less than 1% for a $5 coffee, and couldn't spend less than 5c when doing microtransactions.
(Well, obviously if you got to that point you'd *actually* either add more precision to bitcoin, or use sidechains or altcoins at that point. Actually, I guess you could just add more precision to lightning, but round it off for the blockchain transactions)
Quoted text (1 line)
> = $4.8 mln / BTC!
List etiquette question: when people post numbers like this is it required to drink a shot of whisky/tequilla and shout "to the moon!" ? ;)
Cheers, aj
On 31 August 2015 at 12:16, Rusty Russell <rusty at rustcorp.com.au> wrote:
Quoted text (10 lines)
> My latest scheme simply requires you to return some valid unilateral > close transaction. If you don't, I will close the channel to you, and > use that unilateral close to prevent my upstream from closing on me. > > I think this has the right incentive; unilateral closes are painful in > locked funds, fees and opportunity cost. > > We might need to get more sophisticated eventually, but I think it's > enough for now? >
+1
(I think it's actually *more* than enough for now tbh)
Cheers, aj
Anthony Towns schreef op di 01-09-2015 om 07:08 [+1000]:
Quoted text (25 lines)
> On 31 August 2015 at 04:01, CJP <cjp at ultimatestunts.nl> wrote: > > A - b - c - D - e - F - g - H > > H pays 0.003 mBTC to F (explicit source routing fee; > H > > selected F for > > onion-routing towards D, without A's knowledge) > > You mean "D selected F for onion-routing towards H" here, > surely? > No :-) > Both sides of a payment may value their privacy, so both sides > may want > to perform onion routing independently. > > It's a bit similar to TOR hidden > services: you route from both sides towards a "meeting point" > somewhere > on the route, which is not necessarily one of the end points. > > > Hmm. I would look at that more like: > > > Setup: > - H wants to be secretive. > - H establishes a channel with g
Yes.
Quoted text (2 lines)
> - H tells F he can route to H via g > - H tells D he can route to H via F
No. If H has a routable address (which is optional in this scenario, since it's not used here), it would be "g tells F he can route to H via g". But that information isn't used here, and the transaction isn't tied to H's routable address, since there is no "routing to H" in this scenario: there is only routing from A to D and from H to D through F.
Quoted text (2 lines)
> Announcement: > - H tells other people (such as A) they can route to H via D
No. H just tells A he can route this particular transaction to D. A doesn't know H.
Quoted text (3 lines)
> > Then A sends a txn for H to D as instructed, and D chooses to forward > it on via F.
No. The sequence is: - A establishes a route to D as instructed - H establishes a route to F, and instructs F to establish a route to D - F establishes a route to D as instructed - D matches the two sides, and informs both sides that a route is present. - The transaction is locked (HTLC created), starting on the A-b link, then b-c, and so on, all the way to the g-H link.
Quoted text (6 lines)
> > (Hmm. In that scenario, if e tried to send a txn to H, she would route > via D, then find D routed the txn back to it -- using the same R -- > and that F was the next destination. This would be an information > leak, arguably. Likewise for anyone whose cheapest path to D was > through e)
Does not apply to the way I describe how it should work.
Quoted text (14 lines)
> > Note that, because locking of transaction funds is always done > in payer > -> payee direction, this requires a separate routing phase > before the > locking. So, first you find a route (where all parties say > they agree to > fees, tx amount, timeouts and other conditions), and then you > start > performing transaction-channel actions. > > > Isn't that a bit circular -- "you obtain the route by sending messages > along the route" ?
No. Route finding can consist of several attempts, and each attempt consists of sending messages between nodes. Once you find a route (probably the first attempt in a well-optimized routing system), you can send further messages along the route, but you did in fact already send messages along the route prior to knowing that it will become your
Quoted text (5 lines)
route. > > It also relies on end-to-end communication in realtime, which wouldn't > work for paying to a cold-wallet lightning channel that's only > occassionally online.
I don't see how lightning could pay to a cold wallet. I assume that, at least when starting a transaction, all nodes on the route are online.
Quoted text (11 lines)
> > If you *did* assume everything is in realtime, you could avoid fines > entirely just by having the protocol be something like: > > > - the official timeout was 4 days, the unofficial timeout is 4 > minutes > - ... > - okay 4 minutes is up, do you know R? > - no, okay, we're revoking the transaction. > - you don't want to? fine, channel is closed.
I assume the "official" timeout is the one mentioned in the HTLC; it has to be large (several days) to avoid nodes becoming vulnerable due to loss of connectivity in the middle of a transaction: it might take you some time to establish an alternative internet connection, and it has to happen before the official timeout.
Neighbors can always try to impose shorter unofficial time-outs, with the sanction that the channel will be closed. The consequence is that both sides, and the network as a whole, lose a link, so it should be avoided if possible.
Quoted text (4 lines)
> > Maybe that's what the default protocol should be anyway, and fines are > just an extension to that to bribe the payer not to close the > channel...
Yes.
Quoted text (13 lines)
> You could of course ignore source routing for the fines, and > distribute > the fines as if it is only a non-source routing path. The > problem is > that an attacker can create an arbitrarily long path with > source > routing, thereby creating arbitrarily large total damage to > the network, > corresponding to arbitrarily large total fines. > > > I don't think it can go arbitrarily large -- if the recipient is > paying the fines at each point, then the scenario is:
I don't understand how an intermediate point (D or F) can enforce payment of fines by A or H.
You could of course pre-pay the fines with a separate transaction, which has D or F as payee endpoint, and send the fines back in case of a successful transaction. This assumes the intermediate nodes are trusted with the fine amounts.
CJP
On 1 September 2015 at 17:07, CJP <cjp at ultimatestunts.nl> wrote:
Quoted text (6 lines)
> Anthony Towns schreef op di 01-09-2015 om 07:08 [+1000]: > > On 31 August 2015 at 04:01, CJP <cjp at ultimatestunts.nl> wrote: > > > A - b - c - D - e - F - g - H > No. H just tells A he can route this particular transaction to D. A > doesn't know H. >
That doesn't make sense to me -- if A doesn't know H, how can H tell A anything?
Quoted text (7 lines)
> > Then A sends a txn for H to D as instructed, and D chooses to forward > > it on via F. > > No. The sequence is: > - A establishes a route to D as instructed > - H establishes a route to F, and instructs F to establish a route to D >
Same here; how does H know to do anything? A doesn't know H, so A can't tell them. If D's telling H, then isn't D already using the F/g route to do so?
Quoted text (9 lines)
- F establishes a route to D as instructed > - D matches the two sides, and informs both sides that a route is > present. > - The transaction is locked (HTLC created), starting on the A-b link, > then b-c, and so on, all the way to the g-H link. > > > It also relies on end-to-end communication in realtime, which wouldn't > > work for paying to a cold-wallet lightning channel that's only > > occassionally online.
I don't see how lightning could pay to a cold wallet.
Maybe. The case I'm thinking about is if you're doing most of your day-to-day transactions over lightning (buying coffee and lunch and groceries and bus tickets and fuel and whatnot), then your channels will empty out pretty quickly; so you'll want to have some way to "get money from the ATM" once a week or so. And conversely you'll want some way to put your salary into the "ATM" as well. Doing that via the blockchain works fine of course, but then your average lightning user is doing a blockchain transaction once every week or three, rather than once every two years,
Quoted text (14 lines)
> You could of course ignore source routing for the fines, and > > distribute > > the fines as if it is only a non-source routing path. The > > problem is > > that an attacker can create an arbitrarily long path with > > source > > routing, thereby creating arbitrarily large total damage to > > the network, > > corresponding to arbitrarily large total fines. > > I don't think it can go arbitrarily large -- if the recipient is > > paying the fines at each point, then the scenario is: > I don't understand how an intermediate point (D or F) can enforce > payment of fines by A or H. >
I think fines have to be paid on the payee side, so H not A -- it's the payee that can close the transaction early, so if they choose not to, it's their responsibility. I think that's independent of whether the routing was source/non-source (though for source routing, the original payer might add some fees to cover the potential fines).
Then doesn't it just reduce to enforcing payments from your direct neighbour, and relying on them transitively doing the same? ie, D forces e to pay a fine, and in order to cover those costs e forces F to pay a larger fine, F forces g to pay an even larger fine, and g forces H to cover all of that.
Cheers, aj
Anthony Towns schreef op di 01-09-2015 om 17:56 [+1000]:
Quoted text (13 lines)
> On 1 September 2015 at 17:07, CJP <cjp at ultimatestunts.nl> wrote: > > Anthony Towns schreef op di 01-09-2015 om 07:08 [+1000]: > > On 31 August 2015 at 04:01, CJP <cjp at ultimatestunts.nl> > wrote: > > > A - b - c - D - e - F - g - H > No. H just tells A he can route this particular transaction to > D. A > doesn't know H. > > > That doesn't make sense to me -- if A doesn't know H, how can H tell > A anything?
Sorry, that must have been confusing.
The way I see it (and the way it's implemented in Amiko Pay), payer and payee (A and H in the scenario) have a direct communication link between each other (temporary, for the duration of the payment), to coordinate the payment. They exchange things like the hash of R, the to-be-paid amount and the address of the meeting point (D).
Currently, it's a normal TCP connection, so they know each others' IP address, but I guess that, even without changes to the Amiko Pay code, you could run Amiko Pay as a TOR hidden service (payer connects to payee, so payee has to be the hidden service). Or they could meet each other physically (without knowing each other), and communicate over a temporary link (WiFi, Bluetooth or something else).
There is no technical reason why they should know each others' identity, IP address or any routable address on the Lightning / Amiko network.
I guess your further questions followed from this issue. Is it all clear now?
CJP
Quoted text (1 line)
>
On 2 September 2015 at 05:48, CJP <cjp at ultimatestunts.nl> wrote:
Quoted text (6 lines)
> The way I see it (and the way it's implemented in Amiko Pay), payer and > payee (A and H in the scenario) have a direct communication link between > each other (temporary, for the duration of the payment), to coordinate > the payment. They exchange things like the hash of R, the to-be-paid > amount and the address of the meeting point (D). >
Okay, I was figuring a *much* more lightweight initiation, essentially just a one-way packet from H (or someone representing H) to A giving hash of R, amount, and the routable lightning address it needs to get to ("H via D" maybe). That way you can kick a lightning transaction off by QR code or NFC as well as over TCP, which I think would be nice. (A printed price tag could literally be all you need to pay for an item!)
Also, I think it makes it easier for you to add payment-by-lightning to other protocols; eg if you want your bittorrent client to demand a lightning payment every 10MB, you can just set it up with a bunch of hashes to send to peers, and preimages to check to confirm payment, and otherwise have it operate completely independent of the lightning protocol. ie, it's just:
if (peer->balance < 100kb) {
choose_hash(&peer->payment);
send("Payment required: R=%s A=%d H=%s", peer->payment.hash, std_amt(),
lightning_route);
wait_for_preimage(peer->payment.preimage);
peer->balance += 1MB;
}
sent_len = send_block();
peer->balance -= sent_len
and the lightning stuff can happen entirely out of band -- it only needs to share the list of hashes and preimages, and agree on the amounts to accept.
There might be a security benefit there too; even having a tor connection open to someone gives you more chance of finding a buffer overflow and taking control of their system than just viewing a QR code they present to you?
Cheers, aj
Anthony Towns <aj at erisian.com.au> writes:
Quoted text (3 lines)
> In that case $1 uBTC is $4.80, and 1 satoshi is about 5c; so you couldn't > charge a fee less than 1% for a $5 coffee, and couldn't spend less than 5c > when doing microtransactions.
I was momentarily tempted to make HTLCs in thousandths of satoshi. Obviously, you'd have some agreed rounding for the on-chain versions.
This has the advantage that you can only have 0.042 BTC (~$10) per HTLC.
Cheers, Rusty.