[Lightning-dev] Onion-Routing for Messages

Mats Jerratsch mats.jerratsch at blockchain.com
Tue Dec 8 17:13:22 UTC 2015

Hash: SHA512

I've been thinking a lot about the Onion Routing we designed a couple
of weeks ago and how we would use it in practice.

So I am in full privacy mode currently and I would prefer to design a
system in which sender and receiver of a payment by default do not
learn any additional information about each other. This means that
payments will - by default - get routed over a rendezvous point(RP)
and encrypted using a onion scheme.

So if A wants to make a payment to E, E will choose a RP C and create
an onion object which will allow C to route the payment further
towards E. A will not know which node is receiving the payment, A only
knows that it should route the payments towards C. So A uses the
object E sent him and wraps the onion layers for the routing towards C
around it. When C receives it, it does not know that A sent it, nor
that it should be relayed to E finally. It will just follow the
instructions E put in the onion object.

In practice E can use a (reasonably sized) QR code to transmit this
blob of data to A.

However, we have to decide whether we want this whole onion-routing to
be one-time and one-directional or not.

The design where we stopped few weeks ago did fill up the onion
objects with zeros, so unless the nodes store some data to relate to
that message later, it is not possible for the receiver to send a
message back to the sender. (or to have any additional communications
at all for that matter)

This means we would need to transmit the payment hash together with
the blob in the QR code. Furthermore, if the payment goes missing, we
need some additional communications channel to address routing of the
refund payment. (NFC would qualify for that if we are using a mobile
It also means that payment requests are one-time only, as they include
the payment hash. (even though we could try to do some fancy things if
we settle for EC keys for payments)

On the other hand, it would be possible to have a message system
integrated. When parsing the onion object, each node could encrypt and
append the pubkey of the node it received the object from together
with the ephemeral key used initially. When the receiver wants to send
a message back, he encrypts it using some designated ephemeral key
included by the sender and uses the onion object to send it back. The
nodes on the route can unwrap the onion object again to route it back
to the original sender.

This means that a payment request is just a way of contacting the
receiver to obtain information about making a payment. It can be
stored and reused whenever you want to make a payment. You can also
send the necessary signatures for the pay-to-contract scheme as
include other data necessary if we want to implement something like
Proof-of-Payment. In general, it would allow for very general purposes.

Which - on the other hand - is also problematic. It is difficult to
provide a reasonable DoS protection against nodes just spamming the
network with unnessesary messages. We could assign super tiny payments
to the process of sending a message to counter spam, but it might be
difficult to implement.

Additionally it serves a security risk, as someone obtaining the onion
object can 'hunt down' the sender by targeting the nodes consisting
the route one by one. Currently this is only possible for tracking
down the receiver. For one to succeed in such a task, it is necessary
to extract the private key used for encryption for ALL nodes in the rout

- -- 
Mats Jerratsch
Backend Engineer, Blockchain
e: mats.jerratsch at blockchain.com
PGP: https://pgp.mit.edu/pks/lookup?op=get&search=0x7F3EC6CA
Comment: GPGTools - https://gpgtools.org


More information about the Lightning-dev mailing list