Coder Social home page Coder Social logo

lightningnetwork / lightning-onion Goto Github PK

View Code? Open in Web Editor NEW
395.0 52.0 123.0 444 KB

Onion Routed Micropayments for the Lightning Network

License: MIT License

Go 100.00%
cryptography cryptocurrency bitcoin lightning-network onion-architecture micropayments

lightning-onion's People

Contributors

andrewshvv avatar borisd avatar cdecker avatar cfromknecht avatar creslinux avatar crypt-iq avatar ellemouton avatar guggero avatar joostjager avatar mdrollette avatar roasbeef avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lightning-onion's Issues

Implement error message wraping/encryption and decryption

Issue

Within the network, it's important that when an HTLC forwarding failure occurs, the recipient is notified in a timely manner in order to ensure that errors are graceful and not unknown. However, we also want to ensure the privacy of the onion routing scheme, meaning that the intermediate hops don't know the exact location of the initiating sender. Therefore, nodes need to use the existing circuit to report the error with a message traveling backwards from the point of error to the original sender.

Within the current spec draft the handling of the scenario described above is detailed in sufficiently in the returning messages section.

This error wrapping and decryption at the sender is currently unimplemented.

Steps to Completion

  • The ProcessPacket method should also return an object which encapsulates the derived shared secret, and provides a method/function to create a wrapped error messages.

  • Similarly, the NewOnionPacket function should return a similar object which encapsulates the derived shared secret, and the encoded route. The object should provide a method/function to perform trial decryption (O(N^2) work, since we don't know which node in the route send the message).

bug in Sphinx padding allows for last hop to learn the route length

I do not know if your use of the Sphinx packet format is such that variable length routes are used... however you should know that your Sphinx packet implementation does leak the route length to the last hop.

According to the recently submitted paper: Breaking and (Partially) Fixing Provably Secure Onion Routing, ( https://arxiv.org/abs/1910.13772 ) there is a padding bug where a sphinx implementation creates a header and in so doing uses zeros to pad the beta field whereas random data should be used instead because of the use of the stream cipher...

https://github.com/UCL-InfoSec/sphinx/blob/c05b7034eaffd8f98454e0619b0b1548a9fa0f42/SphinxClient.py#L67

# The os.urandom used to be a string of 0x00 bytes, but that's wrong
beta = dest + id + os.urandom(((2 * (p.r - nu) + 2)*p.k - len(dest)))
beta = p.xor(beta,
p.rho(p.hrho(asbtuples[nu-1]['s']))[:(2*(p.r-nu)+3)*p.k]) + phi

This bug, that is, if beta were padded with zeros instead of random bytes would allow
an adversary to determine the length of the route. This adversary would have to be the last hop and it could then XOR the beta portion of the header with zero bytes to learn how many skipped hops the Sphinx packet had.

CHDR introducing version

Hi Roastbeef,

Although in the original paper is not expected, IMHO it would be appropriate to add a byte at the beginning of Common header to be used to versioning the Hornet protocol (as indeed exists in the IP protocol). My proposal is:

Bit 0-3 4-7 8-15 16-23 24-
0 Version Future Uses Control Type Hops ...

Andrea

Insuffcient capacity and HTLC

If there is a topology, say, A-B-C, and A want to send a transaction to C via this route.
However, the channel from B to C does not have sufficient capacity, from the wiki, we know that there will be a temporary_channel_failure error msg responsed.

Then the question is: Will the HTLC contract between A and B be cancelled before the timeout of this HTLC?

lightning-onion roadmap (HORNET, SURB's, general purpose)

hey, nice work with ln and this module!

at hashmatter we're planning to implement the sphinx-onion and hornet message formats and protocols for general purpose, to be used as a privacy preserving primitive. it would be very helpful not to have to implement everything from the bottom up. since this module looks like the best golang implementation of sphinx, have you considered to refactor this module at any point for general purpose?

also, what are the goals in terms of implementing HORNET? again, it would be great to have a general purpose module that could be used by any project. I'm sure there are other project-related priorities, but I believe we could help with that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.