Rusty Russell [ARCHIVE] on Nostr: 📅 Original date posted:2019-11-07 📝 Original message: Anthony Towns <aj at ...
📅 Original date posted:2019-11-07
📝 Original message:
Anthony Towns <aj at erisian.com.au> writes:
> On Wed, Nov 06, 2019 at 10:43:23AM +1030, Rusty Russell wrote:
>> >> Rusty prepares a nonce, AAAAA and hashes it 25 times = ZZZZZ.
>> >> ZmnSCPxj prepares the onion, but adds extra fields (see below).
>> > It would have made more sense to me for Alice (Zmn) to generate
>> > the nonce, hash it, and prepare the onion, so that the nonce is
>> > revealed to Dave (Rusty) if/when the message ever actually reaches its
>> > destination. Otherwise Rusty has to send AAAAA to Zmn already so that
>> > Zmn can prepare the onion?
>> The entire point is to pay *up-front*, though, to prevent spam.
>
> Hmm, I'm not sure I see the point of paying upfront but not
> unconditionally -- you already commit the funds as part of the HTLC,
> and if you're refunding some of them, you kind-of have to keep them
> reserved or you risk finalising the HTLC causing a failure because you
> don't have enough msats spare to do the refund?
? These are upfront an unconditional. I'm confused. You pay per
HTLC added (or, in future, to send a message).
What part was unclear here?
Alice pays X to Bob. Bob gives X-<num-preimages> back to Alice. Bob
gets preimages from the onion, and from Carol etc.
This happens independent of HTLC success or failure.
>> Bob/ZmnSCPxj doesn't prepare anything in the onion. They get handed the
>> last hash directly: Alice is saying "I'll pay you 50msat for each
>> preimage you can give me leading to this hash".
>
> So my example was Alice paying Dave via Bob and Carol (so Alice/Bob,
> Bob/Carol, Carol/Dave being the individual channels).
>
> What you wrote to Zmn says "Rusty decrypts the onion, reads the prepay
> field: it says 14, LLLL." but Alice doesn't know anything other than
> ZZZZ so can't put LLLL in the onion?
Alice created the onion. Alice knows all the preimages, since she
created the chain AAAAA....ZZZZZ.
>> > I'm not sure why lucky hashing should result in a discount?
>> Because the PoW adds noise to the amounts, otherwise the path length is
>> trivially exposed, esp in the failure case. It's weak protection
>> though.
>
> With a linear/exponential relationship you just get "half the time it's
> 1 unit, 25% of the time it's 2 units, 12% of the time it's 3 units", so
> I don't think that's adding much noise?
It depends how much people are prepared to grind, doesn't it?
>> > You've only got two nonce choices -- the initial AAAA and the depth
>> > that you tell Bob and Carol to hash to as steps in the route;
>> No, the sphinx construction allows for grinding, that was my intent
>> here. The prepay hashes are independent.
>
> Oh, because you're also xoring with the onion packet, right, I see.
>
>> > I think you could just make the scheme be:
>> > Alice sends HTLC(k,v) + 1250 msat to Bob
>> > Bob unwraps the onion and forwards HTLC(k,v) + 500 msat to Carol
>> > Carol unwraps the onion and forwards HTLC(k,v) + 250 msat to Dave
>> > Dave redeems the HTLC, claims an extra 300 msat and refunds 200 msat to Carol
>
> The math here doesn't add up. Let's assume I meant:
>
> Bob keeps 500 sat, forwards 750 sat
> Carol keeps 250 sat, forwards 500 sat
> Dave keeps 300 sat, refunds 200 sat
>
>> > Carol redeems the HTLC and refunds 200 msat to Bob
>> > Bob redeems the HTLC and refunds 200 msat to Alice
>> >
>> > If there's a failure, Alice loses the 1250 msat, and someone in the
>> > path steals the funds.
>> This example confuses me.
>
> Well, that makes us even at least? :)
>
>> So, you're charging 250msat per hop? Why is Bob taking 750? Does Carol
>> now know Dave is the last hop?
>
> No, Alice is choosing to pay 500, 250 and 300 msat to Bob, Carol and
> Dave respectively, as part of setting up the onion, and picks those
> numbers via some magic algo trading off privacy and cost.
OK.
>> Does Alice lose everything on any routing failure?
>
> That was my thought yeah; it seems weird to pay upfront but expect a
> refund on failure -- the HTLC funds are already committed upfront and
> refunded on failure.
AFAICT you have to overpay, since anything else is very revealing of
path length. Which kind of implies a refund, I think.
>> If so, that is strong incentive for Alice to reduce path-length privacy
>> by keeping payments minimal, which I was really trying to avoid.
>
> Assuming v is much larger than 1250msat, and 1250 msat is much lower than
> the cost to Bob of losing the channel with Alice, I don't think that's
> a problem. 1250msat pays for 125kB of bandwdith under your assumptions
> I think?
That's irrelevant? Since retries are common, it's natural for Alice to
want to minimize losses. If she's going to lose everything on any
failure, she'll pay the minimum amount, which exposes her path length
trivially.
Thus my attempt to try to reduce the lossage. I think.
>> > Does that miss anything that all the hashing achieves?
>> It does nothing if Carol is the one who can't route.
>
> If Carol can't route, then ideally she just refunds all the money and
> everyone's happy.
That tells Bob clearly that Carol failed. If Carol claims a variable
amount, it's less obvious (though still pretty bad).
> If Carol tries to steal, then she can keep 750 msat instead of 250 msat.
> This doesn't give any way for Bob to prove Carol cheated on him though;
> but Bob could just refund the 1250 msat and write the 750 msat off as a
> loss of dealing with cheaters like Carol.
What actually happens is that Carol sends a signature on a commitment
which Bob does't agree with (since he expected his money back). They go
onchain.
Now Bob is out the total he fwd to Carol, but he's probably more annoyed
at losing the channel.
Cheers,
Rusty.
Published at
2023-06-09 12:57:06Event JSON
{
"id": "b08d0b18efd7ae2eb6907c69b9dad12355a83ef7902a71dbb3a4e21c649ce94b",
"pubkey": "13bd8c1c5e3b3508a07c92598647160b11ab0deef4c452098e223e443c1ca425",
"created_at": 1686315426,
"kind": 1,
"tags": [
[
"e",
"0c91e21e034533f122e94b0fd3031654ae905512e27a1262e64ae8c7923a76b8",
"",
"root"
],
[
"e",
"eff4d91c6a6e46b96b61e5b599bb5ce199ae5bbcf13c153039c4b87cc6a56ff8",
"",
"reply"
],
[
"p",
"f0feda6ad58ea9f486e469f87b3b9996494363a26982b864667c5d8acb0542ab"
]
],
"content": "📅 Original date posted:2019-11-07\n📝 Original message:\nAnthony Towns \u003caj at erisian.com.au\u003e writes:\n\u003e On Wed, Nov 06, 2019 at 10:43:23AM +1030, Rusty Russell wrote:\n\u003e\u003e \u003e\u003e Rusty prepares a nonce, AAAAA and hashes it 25 times = ZZZZZ.\n\u003e\u003e \u003e\u003e ZmnSCPxj prepares the onion, but adds extra fields (see below). \n\u003e\u003e \u003e It would have made more sense to me for Alice (Zmn) to generate\n\u003e\u003e \u003e the nonce, hash it, and prepare the onion, so that the nonce is\n\u003e\u003e \u003e revealed to Dave (Rusty) if/when the message ever actually reaches its\n\u003e\u003e \u003e destination. Otherwise Rusty has to send AAAAA to Zmn already so that\n\u003e\u003e \u003e Zmn can prepare the onion?\n\u003e\u003e The entire point is to pay *up-front*, though, to prevent spam.\n\u003e\n\u003e Hmm, I'm not sure I see the point of paying upfront but not\n\u003e unconditionally -- you already commit the funds as part of the HTLC,\n\u003e and if you're refunding some of them, you kind-of have to keep them\n\u003e reserved or you risk finalising the HTLC causing a failure because you\n\u003e don't have enough msats spare to do the refund?\n\n? These are upfront an unconditional. I'm confused. You pay per\nHTLC added (or, in future, to send a message).\n\nWhat part was unclear here?\n\nAlice pays X to Bob. Bob gives X-\u003cnum-preimages\u003e back to Alice. Bob\ngets preimages from the onion, and from Carol etc.\n\nThis happens independent of HTLC success or failure.\n\n\u003e\u003e Bob/ZmnSCPxj doesn't prepare anything in the onion. They get handed the\n\u003e\u003e last hash directly: Alice is saying \"I'll pay you 50msat for each\n\u003e\u003e preimage you can give me leading to this hash\".\n\u003e\n\u003e So my example was Alice paying Dave via Bob and Carol (so Alice/Bob,\n\u003e Bob/Carol, Carol/Dave being the individual channels).\n\u003e\n\u003e What you wrote to Zmn says \"Rusty decrypts the onion, reads the prepay\n\u003e field: it says 14, LLLL.\" but Alice doesn't know anything other than\n\u003e ZZZZ so can't put LLLL in the onion?\n\nAlice created the onion. Alice knows all the preimages, since she\ncreated the chain AAAAA....ZZZZZ.\n\n\u003e\u003e \u003e I'm not sure why lucky hashing should result in a discount?\n\u003e\u003e Because the PoW adds noise to the amounts, otherwise the path length is\n\u003e\u003e trivially exposed, esp in the failure case. It's weak protection\n\u003e\u003e though.\n\u003e\n\u003e With a linear/exponential relationship you just get \"half the time it's\n\u003e 1 unit, 25% of the time it's 2 units, 12% of the time it's 3 units\", so\n\u003e I don't think that's adding much noise?\n\nIt depends how much people are prepared to grind, doesn't it?\n\n\u003e\u003e \u003e You've only got two nonce choices -- the initial AAAA and the depth\n\u003e\u003e \u003e that you tell Bob and Carol to hash to as steps in the route;\n\u003e\u003e No, the sphinx construction allows for grinding, that was my intent\n\u003e\u003e here. The prepay hashes are independent.\n\u003e\n\u003e Oh, because you're also xoring with the onion packet, right, I see.\n\u003e\n\u003e\u003e \u003e I think you could just make the scheme be:\n\u003e\u003e \u003e Alice sends HTLC(k,v) + 1250 msat to Bob\n\u003e\u003e \u003e Bob unwraps the onion and forwards HTLC(k,v) + 500 msat to Carol\n\u003e\u003e \u003e Carol unwraps the onion and forwards HTLC(k,v) + 250 msat to Dave\n\u003e\u003e \u003e Dave redeems the HTLC, claims an extra 300 msat and refunds 200 msat to Carol\n\u003e\n\u003e The math here doesn't add up. Let's assume I meant:\n\u003e\n\u003e Bob keeps 500 sat, forwards 750 sat\n\u003e Carol keeps 250 sat, forwards 500 sat\n\u003e Dave keeps 300 sat, refunds 200 sat\n\u003e\n\u003e\u003e \u003e Carol redeems the HTLC and refunds 200 msat to Bob\n\u003e\u003e \u003e Bob redeems the HTLC and refunds 200 msat to Alice\n\u003e\u003e \u003e\n\u003e\u003e \u003e If there's a failure, Alice loses the 1250 msat, and someone in the\n\u003e\u003e \u003e path steals the funds.\n\u003e\u003e This example confuses me.\n\u003e\n\u003e Well, that makes us even at least? :)\n\u003e\n\u003e\u003e So, you're charging 250msat per hop? Why is Bob taking 750? Does Carol\n\u003e\u003e now know Dave is the last hop?\n\u003e\n\u003e No, Alice is choosing to pay 500, 250 and 300 msat to Bob, Carol and\n\u003e Dave respectively, as part of setting up the onion, and picks those\n\u003e numbers via some magic algo trading off privacy and cost.\n\nOK.\n\n\u003e\u003e Does Alice lose everything on any routing failure?\n\u003e\n\u003e That was my thought yeah; it seems weird to pay upfront but expect a\n\u003e refund on failure -- the HTLC funds are already committed upfront and\n\u003e refunded on failure.\n\nAFAICT you have to overpay, since anything else is very revealing of\npath length. Which kind of implies a refund, I think.\n\n\u003e\u003e If so, that is strong incentive for Alice to reduce path-length privacy\n\u003e\u003e by keeping payments minimal, which I was really trying to avoid.\n\u003e\n\u003e Assuming v is much larger than 1250msat, and 1250 msat is much lower than\n\u003e the cost to Bob of losing the channel with Alice, I don't think that's\n\u003e a problem. 1250msat pays for 125kB of bandwdith under your assumptions\n\u003e I think?\n\nThat's irrelevant? Since retries are common, it's natural for Alice to\nwant to minimize losses. If she's going to lose everything on any\nfailure, she'll pay the minimum amount, which exposes her path length\ntrivially.\n\nThus my attempt to try to reduce the lossage. I think.\n\n\u003e\u003e \u003e Does that miss anything that all the hashing achieves?\n\u003e\u003e It does nothing if Carol is the one who can't route.\n\u003e\n\u003e If Carol can't route, then ideally she just refunds all the money and\n\u003e everyone's happy.\n\nThat tells Bob clearly that Carol failed. If Carol claims a variable\namount, it's less obvious (though still pretty bad).\n\n\u003e If Carol tries to steal, then she can keep 750 msat instead of 250 msat.\n\u003e This doesn't give any way for Bob to prove Carol cheated on him though;\n\u003e but Bob could just refund the 1250 msat and write the 750 msat off as a\n\u003e loss of dealing with cheaters like Carol.\n\nWhat actually happens is that Carol sends a signature on a commitment\nwhich Bob does't agree with (since he expected his money back). They go\nonchain.\n\nNow Bob is out the total he fwd to Carol, but he's probably more annoyed\nat losing the channel.\n\nCheers,\nRusty.",
"sig": "d4c30d9dd026651d138a305912cd92e58438ea0d8934ae38a5558e69d28e4c50660f29d50921e68c1af129a148f1fdbf393f38bd077f0c9ded08880ccbada7ba"
}