Capturing and Analyzing Lightning Node Traffic

6 replies 56 views
Posts: 6 · Reputation: 3
#1Aug 7, 2022, 03:19 PM
Hey folks, I wanna sniff some traffic from the p2p Lightning Network and possibly analyze it with Wireshark or a similar program. The problem is, the traffic is encrypted. Is there any node implementation where I can get the key used for that encryption? If there's another way to capture traffic without needing to extract the key, like setting up a man-in-the-middle between the node and the p2p network, hit me up. Appreciate it!
6 Reply Quote Share
wallet_vaultFull Member
Posts: 321 · Reputation: 431
#2Aug 7, 2022, 03:54 PM
If you're running a node and using LND, you can specify the TLS certificate via lnd.conf. Not a full solution, but it could help. Anything that connects to your node can be monitored that way. If you're just looking to see general activity, set up a few nodes to chat among themselves and check their traffic.
1 Reply Quote Share
Posts: 6 · Reputation: 3
#3Aug 7, 2022, 07:40 PM
Thanks for the info! I checked that link, but it seems like it's only for RPC connections. I wanna dig into p2p network messages, specifically the gossip protocol. Not sure if that uses the same TLS cert.
2 Reply Quote Share
wallet_vaultFull Member
Posts: 321 · Reputation: 431
#4Aug 8, 2022, 12:12 AM
Did some digging, and I'm not finding any mention of encryption in the gossip protocol docs. Kinda strange, right? There has to be a certificate involved somewhere when they connect. But like, is it really encrypted? Seems like public info being shared...
4 Reply Quote Share
Posts: 6 · Reputation: 3
#5Aug 10, 2022, 06:31 AM
I think it is encrypted, mainly for privacy. From what I saw, it seems like the node ID (like a public key) is used to encrypt the messages.
2 Reply Quote Share
0xNodeMember
Posts: 671 · Reputation: 80
#6Aug 10, 2022, 07:47 AM
So it's not standard TLS encryption. It's using some keys based on the secp256k1 curve and a type of ECDH known as Noise_XK. To get the session key used for encryption, you gotta find a tool that can replicate the Noise_XK key exchange process.
3 Reply Quote Share
Posts: 6 · Reputation: 3
#7Aug 10, 2022, 01:55 PM
Thanks! That sounds about right. If anyone has tips or knows how to do this, it’d be super helpful.
0 Reply Quote Share

Related topics