CJP [ARCHIVE] on Nostr: 📅 Original date posted:2016-02-02 📝 Original message: > > * Message ...
📅 Original date posted:2016-02-02
📝 Original message:
> > * Message confirmation: this is done manually (instead of relying on
> > TCP), so that a node knows which messages were received / need to be
> > re-transmitted, even after a crash + restart.
>
> I think the protocol itself needs to be robust against retransmissions.
> There's no way to know if the other side received your acknowledgement
> before a crash, so you will always need to handle duplication on
> re-establishment.
Yes. Amiko Pay does that: It assigns a number to every message, and the
receiving side can confirm "I've received up to this number".
Not-yet-confirmed messages will be retransmitted, and the receiving
sides will ignore duplicates (except it will send a confirmation again,
in case the previous confirmation was lost).
> > * There is not only two-way communication between linked peers, but also
> > between payer and payee. This is necessary for Amiko Pay's
> > bi-directional routing, but also useful e.g. for transmitting meta-data
> > that doesn't fit in a QR code. Amiko Pay transmits an arbitrary-contents
> > "receipt" from payee to payer; in the future, this might be digitally
> > signed by the payee, as a "proof of transfer of ownership" of
> > non-cryptographic goods.
>
> I agree. There's room in the initial onion design for payer -> payee
> messages, but we don't have a channel for responses.
>
> I can't see an easy way to implement the payee --> payer comms reliably:
> to be reliable it would have to be published on-chain in the commit tx.
> (Which we could do by constructing HTLCs such that they require a blob
> signed by the payee, but that's tracable ...).
>
> Mats and Laolu wanted to add an arbitrary comms protocol layer, but I
> think that's something we can defer.
In Amiko Pay, payer <-> payee communication is done on a direct TCP
stream between them. Note that this also reduces latency: once
transaction locking reaches the payee, the payee knows (s)he's capable
of claiming the money, and can tell the payer that the payment is
completed. If reduced latency is in the interest of the payee, this is
likely to happen.
> > * Reserving before locking: this is an optimization, to reduce the risk
> > of locking funds in payment channels on a part of the route, and then
> > having to undo the locking when it turns out that the remaining part of
> > the route doesn't exist (anymore). Reserving is an informal(*),
> > temporary locking of funds for use in the transaction, and can be done
> > and undone very fast, without any channel operations. It is done
> > together with route searching + establishment.
>
> I think that trades one DoS for another, though. It saves cryptographic
> constructs, but latency is the real cost, and this increases it.
>
> Of course, we'll have to revisit that if the network in practice proves
> subject to these problems...
For one category of channel designs, reserving is absolutely essential:
channels where bi-directional payments are made possible with a
decrementing lock time. There, you want to make sure that failed routing
attempts don't cause lock time decrements, since that would reduce the
channel lifetime more than necessary. I'd have to check whether there is
still any use case for this channel design, and whether the reserving
step is important for some other reason.
Note that reserving is necessary for bi-directional routing: on the
payee side of the meeting point, routing happens in the payee -> meeting
point direction, but locking has to happen in the meeting point -> payee
direction. So, they have to be different steps.
On latency: what latency do you think is needed for different use cases,
and what can we reach? Does this extra step really make a difference?
My estimate is that we'll typically have 10 hops ("six degrees of
separation" theory), and 100ms to transmit a message(*) over one hop.
Without reserving, you need to traverse all hops once(**) (the locking
operation) before payer(***)+payee know that the transaction has
succeeded. Actual settlement on the channels happens afterwards, but is
no longer critical for the latency as seen by payer+payee.
With reserving, you need to traverse all hops three times(**), in the
worst case that the meeting point is on one of the end points of the
route: once for making the route and reserving funds, once for
confirming that the route has been established and once for locking.
So, instead of one second, a transaction might take three seconds. Is
that a game changer? Maybe it is for e.g. public transport access gates,
where passenger throughput is essential. But then, people could reduce
latency a lot by having a direct channel with the public transport
operator.
For some use cases, e.g. high-frequency trading, people might of course
manually optimize their network and physical location to get better
figures than this.
CJP
(*) Not counting sending the confirmation back: a node that receives a
message can immediately forward a message on the next hop; message
confirmation on the receiving side can occur in parallel.
(**) Not counting failed routing attempts
(***) Assuming the payee tells the payer directly about the payment
succes, over a low-latency connection
Published at
2023-06-09 12:45:37Event JSON
{
"id": "75f5c85ac69d96933f80fc9780bd8666eee6cba12b43e1e0d52f9dee7414486c",
"pubkey": "880fa8c3080c3bd98e574cfcd6d6f53fd13e0516c40ea3f46295438b0c07bdf5",
"created_at": 1686314737,
"kind": 1,
"tags": [
[
"e",
"771d658c92b68acdc5def78ff79f0e01ddc0e6bfbf6060824e7ed3f8eca99874",
"",
"root"
],
[
"e",
"e6cd11e74faced0e4c752fb433b716a85b1a950fef2b461d902192c9991251c9",
"",
"reply"
],
[
"p",
"13bd8c1c5e3b3508a07c92598647160b11ab0deef4c452098e223e443c1ca425"
]
],
"content": "📅 Original date posted:2016-02-02\n📝 Original message:\n\u003e \u003e * Message confirmation: this is done manually (instead of relying on\n\u003e \u003e TCP), so that a node knows which messages were received / need to be\n\u003e \u003e re-transmitted, even after a crash + restart.\n\u003e \n\u003e I think the protocol itself needs to be robust against retransmissions.\n\u003e There's no way to know if the other side received your acknowledgement\n\u003e before a crash, so you will always need to handle duplication on\n\u003e re-establishment.\n\nYes. Amiko Pay does that: It assigns a number to every message, and the\nreceiving side can confirm \"I've received up to this number\".\nNot-yet-confirmed messages will be retransmitted, and the receiving\nsides will ignore duplicates (except it will send a confirmation again,\nin case the previous confirmation was lost).\n\n\u003e \u003e * There is not only two-way communication between linked peers, but also\n\u003e \u003e between payer and payee. This is necessary for Amiko Pay's\n\u003e \u003e bi-directional routing, but also useful e.g. for transmitting meta-data\n\u003e \u003e that doesn't fit in a QR code. Amiko Pay transmits an arbitrary-contents\n\u003e \u003e \"receipt\" from payee to payer; in the future, this might be digitally\n\u003e \u003e signed by the payee, as a \"proof of transfer of ownership\" of\n\u003e \u003e non-cryptographic goods.\n\u003e \n\u003e I agree. There's room in the initial onion design for payer -\u003e payee\n\u003e messages, but we don't have a channel for responses.\n\u003e \n\u003e I can't see an easy way to implement the payee --\u003e payer comms reliably:\n\u003e to be reliable it would have to be published on-chain in the commit tx.\n\u003e (Which we could do by constructing HTLCs such that they require a blob\n\u003e signed by the payee, but that's tracable ...).\n\u003e \n\u003e Mats and Laolu wanted to add an arbitrary comms protocol layer, but I\n\u003e think that's something we can defer.\n\nIn Amiko Pay, payer \u003c-\u003e payee communication is done on a direct TCP\nstream between them. Note that this also reduces latency: once\ntransaction locking reaches the payee, the payee knows (s)he's capable\nof claiming the money, and can tell the payer that the payment is\ncompleted. If reduced latency is in the interest of the payee, this is\nlikely to happen.\n\n\u003e \u003e * Reserving before locking: this is an optimization, to reduce the risk\n\u003e \u003e of locking funds in payment channels on a part of the route, and then\n\u003e \u003e having to undo the locking when it turns out that the remaining part of\n\u003e \u003e the route doesn't exist (anymore). Reserving is an informal(*),\n\u003e \u003e temporary locking of funds for use in the transaction, and can be done\n\u003e \u003e and undone very fast, without any channel operations. It is done\n\u003e \u003e together with route searching + establishment.\n\u003e \n\u003e I think that trades one DoS for another, though. It saves cryptographic\n\u003e constructs, but latency is the real cost, and this increases it.\n\u003e \n\u003e Of course, we'll have to revisit that if the network in practice proves\n\u003e subject to these problems...\n\nFor one category of channel designs, reserving is absolutely essential:\nchannels where bi-directional payments are made possible with a\ndecrementing lock time. There, you want to make sure that failed routing\nattempts don't cause lock time decrements, since that would reduce the\nchannel lifetime more than necessary. I'd have to check whether there is\nstill any use case for this channel design, and whether the reserving\nstep is important for some other reason.\n\nNote that reserving is necessary for bi-directional routing: on the\npayee side of the meeting point, routing happens in the payee -\u003e meeting\npoint direction, but locking has to happen in the meeting point -\u003e payee\ndirection. So, they have to be different steps.\n\nOn latency: what latency do you think is needed for different use cases,\nand what can we reach? Does this extra step really make a difference?\n\nMy estimate is that we'll typically have 10 hops (\"six degrees of\nseparation\" theory), and 100ms to transmit a message(*) over one hop.\n\nWithout reserving, you need to traverse all hops once(**) (the locking\noperation) before payer(***)+payee know that the transaction has\nsucceeded. Actual settlement on the channels happens afterwards, but is\nno longer critical for the latency as seen by payer+payee.\n\nWith reserving, you need to traverse all hops three times(**), in the\nworst case that the meeting point is on one of the end points of the\nroute: once for making the route and reserving funds, once for\nconfirming that the route has been established and once for locking.\n\nSo, instead of one second, a transaction might take three seconds. Is\nthat a game changer? Maybe it is for e.g. public transport access gates,\nwhere passenger throughput is essential. But then, people could reduce\nlatency a lot by having a direct channel with the public transport\noperator.\n\nFor some use cases, e.g. high-frequency trading, people might of course\nmanually optimize their network and physical location to get better\nfigures than this.\n\nCJP\n\n(*) Not counting sending the confirmation back: a node that receives a\nmessage can immediately forward a message on the next hop; message\nconfirmation on the receiving side can occur in parallel.\n\n(**) Not counting failed routing attempts\n\n(***) Assuming the payee tells the payer directly about the payment\nsucces, over a low-latency connection",
"sig": "c7a1ec3d97fe2891ad0e66164b8806183df019ffd11e37a0609200f9b1e19f025052d1f9fe2146c3198b4cb0942586573d8c9f304d98c088857d16d7fc654649"
}