Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/elnosh/lightning-onion-routing

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/elnosh/lightning-onion-routing

  • v0.0.0-20241007023357-e793b72950fd
  • Source
  • Go
  • Socket score

Version published
Created
Source

lightning onion routing

My lame attempt at trying to understand the Lightning Network's onion routing.

It roughly follows BOLT#4 but focused mostly on how to construct and decrypt the onion.

It does the following route:

Alice (origin node) -> Bob -> Charlie -> Dave (final node)

build

go build -o lnonion main.go

Build the onion

./lnonion onion

This will start a prompt to specify a payload for each hop (i.e bob, charlie, dave).

Something like this:

start building the onion. What payload do you want to put for Bob:
hi bob
What payload do you want to put for Charlie (2nd hop):
hi charlie
What payload do you want to put for Dave (last hop):
hi dave
onion to pass to first hop (bob): <onion>

After specifying the payload, it will return an onion that can be sent to the first hop in the route (bob).

Peel the onion

To start peeling the onion, pass it to the first hop.

./lnonion parse --hop "bob" "<onion here>"

This will print the payload that was intended for this hop (bob) and then the onion to pass to the next hop (charlie).

Continue peeling the onion until it gets to the final hop (dave).

./lnonion parse --hop "charlie" "<onion from previous parse>"
credits

BOLT#4

Lightning Network Onion Routing: Sphinx Packet Construction

lightning-onion

onion

FAQs

Package last updated on 07 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc