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

Document Sphinx replay DB (Decayed Log Db) #6584

Open
AbelLykens opened this issue May 27, 2022 · 9 comments · May be fixed by #9616
Open

Document Sphinx replay DB (Decayed Log Db) #6584

AbelLykens opened this issue May 27, 2022 · 9 comments · May be fixed by #9616
Labels
beginner Issues suitable for new developers documentation Documentation changes that do not affect code behaviour good first issue Issues suitable for first time contributors to LND onion routing

Comments

@AbelLykens
Copy link
Contributor

AbelLykens commented May 27, 2022

Background

It's unclear to many people what sphinxreplay.db is for.

Context

Replying to the question: "What is sphinxreplay.db for", on Slack:
@Roasbeef : "Security: it prevents replays of onion packets, w/o this ppl can collect onion packetrs then re-inject them and see where they travel to attempt to de-annon"
@Roasbeef : "I think we might be the only impl that handles them properly, have been meaning to add more details to the spec on this front."

Request

Adding more docs / more info in specs would be good 💯

@Roasbeef Roasbeef added beginner Issues suitable for new developers documentation Documentation changes that do not affect code behaviour onion routing good first issue Issues suitable for first time contributors to LND labels May 27, 2022
@adam2k
Copy link

adam2k commented Sep 21, 2022

@AbelLykens I'm willing to take a look at this issue. I see some comments and references to sphinxreplay.db, but looking at the docs not really sure where it would make sense to add info about sphinxreplay.db. I was thinking at the end of the Secure Your Lightning Network Node section may make the most sense? Either that or maybe the section about configuring tor.

@angeria
Copy link

angeria commented Oct 4, 2022

@adam2k Did you find out more about this? Made any progress?

@adam2k
Copy link

adam2k commented Oct 12, 2022

@angeria I didn't push this ahead any further if you have time to take a look. The only thing I'm not sure about where is the correct location is to add this content.

@RolledTomato
Copy link

Sphinx is a protocol that allows for the creation of anonymous and untraceable messages in a network. It is often used in conjunction with a replay database, which is a database that stores copies of previously sent messages in order to prevent them from being replayed.

The exact implementation of a Sphinx replay database will vary depending on the specific needs of the network and the application that it is being used for. However, in general, a replay database for Sphinx will likely store copies of previously sent messages using a hash of the message as the key, along with metadata such as the time the message was sent and the sender's identity.

When a new message is received, the replay database can be checked to see if it has been previously sent. If the message has been sent before, it can be discarded as a replay attack. If the message is new, it can be added to the replay database and processed as a legitimate message.

Overall, the purpose of a Sphinx replay database is to prevent replay attacks, which are a type of attack where an attacker resends a previously sent message in order to try and trick the recipient into thinking it is a new message. By storing copies of previously sent messages and comparing incoming messages against the replay database, it is possible to prevent these types of attacks and ensure the integrity of the network.

@C-Otto
Copy link
Contributor

C-Otto commented Dec 11, 2022

That sounds like something ChatGPT would say... anyway, thanks :)

@Sharmalm
Copy link

Sharmalm commented Dec 16, 2022

Source-based onion routing (SPHINX) is the onion routing protocol used in Lightning.
Onion routing Sphinx describes a method of encrypted communication where a message sender builds successive nested layers of encryption that are “peeled” off by each intermediary node until the innermost layer is delivered to the intended recipient. The name “onion routing” describes this use of layered encryption that is peeled off one layer at a time, like the skin of an onion.
Each of the intermediary nodes can only “peel” one layer and see who is next in the communication path. Onion routing ensures that no one except the sender knows the destination or length of the communication path. Each intermediary only knows the previous and next hop.

" Lightning's onion routing SPHINX Mix Format is only similar to the Tor network routing in concept, but both the protocol and the implementation is entirely different from those used in the Tor network."

For detailed Knowledge about SPHINX and onion routing in the Lightning network, please refer to Chapter 10 of Mastering the Lightning Network .

@shwetank211
Copy link

I would like to take up this issue. Please assign me this issue. I would be glad if you could alongwith let me know where do I need to write about "sphinxreplay.db" as I could not find appropriate place to put it up.

@guggero
Copy link
Collaborator

guggero commented Feb 13, 2023

We don't currently assign issues to external contributors. But you can show you're working on it by submitting a (draft) PR.
I think we should add a new document docs/databases.md that describes the different database files (and other general information about the database setup in lnd, with all the new features like etcd, Postgres, SQLite and so on).
But for this I think it can just start with a section about the sphinxreplay.db file.

@shivansh-bhatnagar18
Copy link

@guggero I have created a new set of documentation for the databases as it is more convenient for the users to understand the working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner Issues suitable for new developers documentation Documentation changes that do not affect code behaviour good first issue Issues suitable for first time contributors to LND onion routing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants