A reusable parser for Lightning Network gossip messages format.
Project description
โก ln-history-python-client
A Python client library to parse and handle raw Lightning Network gossip messages from the gossip store. Centralized, reusable, and production-tested on real-world data. Perfect for microservices that consume Lightning Network data in raw_hex format.
๐ฆ Features
- ๐ Parses raw gossip messages: Channel Announcements, Channel Updates, Node Announcements, and more
- ๐งฑ Clean and extensible object model (e.g.,
ChannelAnnouncement,NodeAnnouncement,ChannelUpdate) - ๐งช Tested on real-world data
- ๐งฐ Built with reusability in mind for microservice architectures
๐ ๏ธ Installation
pip install
๐งฌ Usage
from lnhistoryclient.parser import parser_factory
raw_hex = "0101..." # Replace with actual raw gossip hex string
parsed = parser_factory.parse(raw_hex)
print(parsed)
You can also directly use individual parsers if you know the message type:
from lnhistoryclient.parser.channel_announcement_parser import parse_channel_announcement
result = parse_channel_announcement(raw_hex)
print(result.channel_id, result.node1_id, result.node2_id)
๐ Project Structure
lnhistoryclient
โโโ model
โ โโโ __init__.py
โ โโโ Address.py
โ โโโ AddressType.py
โ โโโ ChannelAnnouncement.py
โ โโโ ChannelUpdate.py
โ โโโ core-lightning-internal
โ โ โโโ __init__.py
โ โ โโโ ChannelAmount.py
โ โ โโโ ChannelDying.py
โ โ โโโ DeleteChannel.py
โ โ โโโ GossipStoreEnded.py
โ โ โโโ PrivateChannelAnnouncement.py
โ โ โโโ PrivateChannelUpdate.py
โ โโโ NodeAnnouncement.py
โโโ parser
โโโ __init__.py
โโโ channel_announcement_parser.py
โโโ channel_update_parser.py
โโโ common.py
โโโ core-lightning-internal
โ โโโ channel_amount_parser.py
โ โโโ channel_dying_parser.py
โ โโโ delete_channel_parser.py
โ โโโ gossip_store_ended_parser.py
โ โโโ private_channel_announcement_parser.py
โ โโโ private_channel_update_parser.py
โโโ node_announcement_parser.py
โโโ parser_factory.py
๐งช Testing
Unit tests coming soon.
๐ง Requirements
Python >=3.7, <4.0 Pure Python, no external dependencies
๐ค Contributing
Pull requests, issues, and feature ideas are always welcome! Fork the repo Create a new branch Submit a PR with a clear description
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lnhistoryclient-1.0.1.tar.gz.
File metadata
- Download URL: lnhistoryclient-1.0.1.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b6ee18ea8cdda8b8bb3edfe4e0ac39d489cd13004f0d75852ac88e02d82932b
|
|
| MD5 |
b079af5b29a8cc248632866e68e58249
|
|
| BLAKE2b-256 |
203fa9bb8095bcf0d846e78fa859d528ad8933fd457544c9e7129e1ed3467585
|
Provenance
The following attestation bundles were made for lnhistoryclient-1.0.1.tar.gz:
Publisher:
release.yml on ln-history/ln-history-python-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lnhistoryclient-1.0.1.tar.gz -
Subject digest:
5b6ee18ea8cdda8b8bb3edfe4e0ac39d489cd13004f0d75852ac88e02d82932b - Sigstore transparency entry: 237188214
- Sigstore integration time:
-
Permalink:
ln-history/ln-history-python-client@7a8ee9dc9e44745d3b480c9fb6c8f05bc9c1089f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ln-history
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7a8ee9dc9e44745d3b480c9fb6c8f05bc9c1089f -
Trigger Event:
push
-
Statement type:
File details
Details for the file lnhistoryclient-1.0.1-py3-none-any.whl.
File metadata
- Download URL: lnhistoryclient-1.0.1-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c98fd67e22b2a17b3323e3b0a5db1fe0e664a98ad229f14d6335befcb91c927
|
|
| MD5 |
c4e3d0cb035db06f195a576f9cca3de9
|
|
| BLAKE2b-256 |
d3b430fd446926ab72013264068755e3cca394322afb59535b0ec0b7c62184ba
|
Provenance
The following attestation bundles were made for lnhistoryclient-1.0.1-py3-none-any.whl:
Publisher:
release.yml on ln-history/ln-history-python-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lnhistoryclient-1.0.1-py3-none-any.whl -
Subject digest:
9c98fd67e22b2a17b3323e3b0a5db1fe0e664a98ad229f14d6335befcb91c927 - Sigstore transparency entry: 237188218
- Sigstore integration time:
-
Permalink:
ln-history/ln-history-python-client@7a8ee9dc9e44745d3b480c9fb6c8f05bc9c1089f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ln-history
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7a8ee9dc9e44745d3b480c9fb6c8f05bc9c1089f -
Trigger Event:
push
-
Statement type: