Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental onion message support #3573

Closed

Conversation

rustyrussell
Copy link
Contributor

See lightning/bolts#755

This is a pre-requisite (in some form!) for offers, a.k.a more powerful invoices, but it's also much more efficient than abusing HTLCs to send messages (unless you want to send a payment as well anyway).

rustyrussell and others added 25 commits March 4, 2020 23:23
Does the allocation and copying; this is useful because we can
avoid being fooled into doing giant allocations.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
These just run the test vectors and add a test for the devtools/onion tool so
we don't accidentally break them.
We will later use these to generate RV compressed onions and to opt into the
rendezvous style generation.
Adds the `--rendezvous-id` option allowing the caller to specify the node_id
of the rendez-vous node, and opting into the compressed onion generation.
This one generates a compressed onion, decompresses it, and then proceeds with
normal processing.
Also implements a way to decompress an onion using the devtools/onion tool

Changelog-Added: devtools: The `onion` tool can now generate, compress and decompress onions for rendez-vous routing
Expands the interface to play with onions a bit more. Potentially a bit
slower due to allocations, but that's a small price to pay. It also allows us
to avoid serializing a compressed onion to `u8*` if we process it right away.
Suggested-by: Rusty Russell <@rustyrussell>
Signed-off-by: Christian Decker <@cdecker>
It also removes the duplicate compression code and serialization code.
Suggested-by: Rusty Russell <@rustyrussell>
Signed-off-by: Christian Decker <@cdecker>
We're going to use this for messages, not just rendezvous.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This avoid the requirement to use a temporary file.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is in preparation for messages, which want this as their assocdata.

Plus, it's a bit cleaner rather than creating a tmp tal array.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
I needed them to debug the onion messages API, so might as well record them
somewhere.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The Sphinx paper calls this "payload", but we've already used that
liberally in "per-hop payload":

    The payload of the message is kept separate from the mix header
    used to perform the routing. It is decrypted at each stage of
    mixing using a block cipher with a large block size (the size of
    the entire message), such as LIONESS [1]. In case the adversary
    modifies the payload in transit, any information contained in it
    becomes irrecoverable. Sender-anonymous messages contain the final
    address of the message, as well as the message itself as part of
    the payload, and so any modification destroys this information.

Since we don't want to add a block cypher, we use chacha20poly1305
with the shared secret as the key instead.

This is described in a BOLT proposal:

	lightning/bolts#755

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
For messages, we use the onion but payload lengths 0 and 1 aren't special.
Create a flag to disable that logic.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We'll need these to encrypt the end-to-end payload.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The message construction is subtle, so I left it to userspace (after
several attempts).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell rustyrussell added protocol These issues are protocol level issues that should be discussed on the protocol spec repo Optech Make Me Famous! Look! Look! Look! COOL NEW FEATURE! labels Mar 6, 2020
@rustyrussell rustyrussell added this to the 0.8.2 milestone Mar 6, 2020
@rustyrussell rustyrussell requested a review from cdecker as a code owner March 6, 2020 06:09
@rustyrussell
Copy link
Contributor Author

CLosing, we're going to use a different approach for messaging...

@rustyrussell rustyrussell removed the Optech Make Me Famous! Look! Look! Look! COOL NEW FEATURE! label Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
protocol These issues are protocol level issues that should be discussed on the protocol spec repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants