https://github.com/ppad-tech/bolt8
Encrypted and authenticated transport for Lightning.
https://github.com/ppad-tech/bolt8
aead bitcoin haskell lightning
Last synced: about 4 hours ago
JSON representation
Encrypted and authenticated transport for Lightning.
- Host: GitHub
- URL: https://github.com/ppad-tech/bolt8
- Owner: ppad-tech
- License: mit
- Created: 2026-04-18T02:51:54.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2026-05-30T21:52:18.000Z (18 days ago)
- Last Synced: 2026-05-30T23:19:47.851Z (18 days ago)
- Topics: aead, bitcoin, haskell, lightning
- Language: Haskell
- Homepage:
- Size: 74.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# ppad-bolt8
[](https://hackage.haskell.org/package/ppad-bolt8)

[](https://docs.ppad.tech/bolt8)
Haskell implementation of BOLT #8 (Lightning Network encrypted
transport), including the `Noise_XK_secp256k1_ChaChaPoly_SHA256` handshake
and encrypted message transport.
## Usage
A sample GHCi session:
```
> :set -XOverloadedStrings
>
> import qualified Data.ByteString as BS
> import qualified Lightning.Protocol.BOLT8 as BOLT8
>
> let Just (i_s_sec, i_s_pub) = BOLT8.keypair (BS.replicate 32 0x11)
> let Just (r_s_sec, r_s_pub) = BOLT8.keypair (BS.replicate 32 0x21)
>
> -- initiator knows responder static pubkey
> let Right (msg1, i_hs) = BOLT8.act1 i_s_sec i_s_pub r_s_pub
> (BS.replicate 32 0x12)
> let Right (msg2, r_hs) = BOLT8.act2 r_s_sec r_s_pub
> (BS.replicate 32 0x22) msg1
> let Right (msg3, i_res) = BOLT8.act3 i_hs msg2
> let Right r_res = BOLT8.finalize r_hs msg3
>
> let i_sess = BOLT8.session i_res
> let r_sess = BOLT8.session r_res
>
> let Right (ct, i_sess') = BOLT8.encrypt i_sess "hello"
> let Right (pt, r_sess') = BOLT8.decrypt r_sess ct
> pt
"hello"
```
## Framing
On a byte stream, use `decrypt_frame` when you have an exact frame, or
`decrypt_frame_partial` to work incrementally and learn how many bytes
are still required for the next step.
## Documentation
Haddocks are hosted at [docs.ppad.tech/bolt8][hadoc].
## Security
This is a pre-release library that, at present, claims no security
properties whatsoever.
## Development
You'll require [Nix][nixos] with [flake][flake] support enabled. Enter a
development shell with:
```
$ nix develop
```
Then do e.g.:
```
$ cabal build
$ cabal test
$ cabal bench
```
[nixos]: https://nixos.org/
[flake]: https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake.html
[hadoc]: https://docs.ppad.tech/bolt8