{"id":50940103,"url":"https://github.com/ppad-tech/bolt5","last_synced_at":"2026-06-17T13:04:09.386Z","repository":{"id":352580098,"uuid":"1214795014","full_name":"ppad-tech/bolt5","owner":"ppad-tech","description":"On-chain transaction handling for Lightning.","archived":false,"fork":false,"pushed_at":"2026-04-20T08:28:32.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-20T09:33:03.703Z","etag":null,"topics":["haskell","htlc","lightning","transactions"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ppad-tech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-04-19T03:58:58.000Z","updated_at":"2026-04-20T08:28:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ppad-tech/bolt5","commit_stats":null,"previous_names":["ppad-tech/bolt5"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ppad-tech/bolt5","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppad-tech%2Fbolt5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppad-tech%2Fbolt5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppad-tech%2Fbolt5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppad-tech%2Fbolt5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppad-tech","download_url":"https://codeload.github.com/ppad-tech/bolt5/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppad-tech%2Fbolt5/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34449283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","htlc","lightning","transactions"],"created_at":"2026-06-17T13:04:08.087Z","updated_at":"2026-06-17T13:04:09.382Z","avatar_url":"https://github.com/ppad-tech.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ppad-bolt5\n\n[![](https://img.shields.io/hackage/v/ppad-bolt5?color=blue)](https://hackage.haskell.org/package/ppad-bolt5)\n![](https://img.shields.io/badge/license-MIT-brightgreen)\n[![](https://img.shields.io/badge/haddock-bolt5-lightblue)](https://docs.ppad.tech/bolt5)\n\nA pure Haskell implementation of [BOLT #5][bolt5] (Lightning Network\non-chain transaction handling), including logic for mutual close,\nunilateral close, and revoked transaction close scenarios.\n\n## Usage\n\nA sample GHCi session:\n\n```\n  \u003e :set -XOverloadedStrings\n  \u003e\n  \u003e import qualified Data.ByteString as BS\n  \u003e import qualified Lightning.Protocol.BOLT3 as BOLT3\n  \u003e import qualified Lightning.Protocol.BOLT5 as BOLT5\n  \u003e\n  \u003e -- fee calculation using BOLT #5 Appendix A weight constants\n  \u003e let feerate = BOLT3.FeeratePerKw 5000\n  \u003e BOLT5.spending_fee feerate BOLT5.to_local_penalty_input_weight\n  Satoshi 1620\n  \u003e BOLT5.spending_fee feerate BOLT5.penalty_tx_base_weight\n  Satoshi 1070\n  \u003e\n  \u003e -- check if an HTLC has timed out at the current block height\n  \u003e let htlc = BOLT3.HTLC BOLT3.HTLCOffered (BOLT3.MilliSatoshi 50000000)\n  \u003e              (BOLT3.PaymentHash (BS.replicate 32 0xAA))\n  \u003e              (BOLT3.CltvExpiry 800000)\n  \u003e BOLT5.htlc_timed_out 799999 htlc\n  False\n  \u003e BOLT5.htlc_timed_out 800000 htlc\n  True\n  \u003e\n  \u003e -- extract a payment preimage from an offered HTLC witness\n  \u003e let preimage = BS.replicate 32 0xBB\n  \u003e let sig = BS.replicate 71 0xCC\n  \u003e let wit = BOLT3.Witness [sig, preimage]\n  \u003e BOLT5.extract_preimage_offered wit\n  Just PaymentPreimage \u003credacted\u003e\n  \u003e\n  \u003e -- construct an unsigned spending tx for a to_local output\n  \u003e let Just txid = BOLT3.mkTxId (BS.replicate 32 0x01)\n  \u003e let outpoint = BOLT3.OutPoint txid 0\n  \u003e let value = BOLT3.Satoshi 1000000\n  \u003e let revpk = BOLT3.RevocationPubkey (BOLT3.Pubkey (BS.replicate 33 0x02))\n  \u003e let delay = BOLT3.ToSelfDelay 144\n  \u003e let delayedpk = BOLT3.LocalDelayedPubkey (BOLT3.Pubkey (BS.replicate 33 0x03))\n  \u003e let dest = BOLT3.Script (BS.replicate 34 0x00)\n  \u003e\n  \u003e let stx = BOLT5.spend_to_local outpoint value revpk delay\n  \u003e             delayedpk dest feerate\n  \u003e BOLT5.stx_sighash_type stx\n  SIGHASH_ALL\n```\n\n## Documentation\n\nHaddocks are hosted at [docs.ppad.tech/bolt5][hadoc].\n\n## Security\n\nThis is a pre-release and makes no claims about security whatsoever.\n\n## Development\n\nYou'll require [Nix][nixos] with [flake][flake] support enabled. Enter a\ndevelopment shell with:\n\n```\n$ nix develop\n```\n\nThen do e.g.:\n\n```\n$ cabal build\n$ cabal test\n$ cabal bench\n```\n\n[bolt5]: https://github.com/lightning/bolts/blob/master/05-onchain.md\n[nixos]: https://nixos.org/\n[flake]: https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake.html\n[hadoc]: https://docs.ppad.tech/bolt5\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppad-tech%2Fbolt5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppad-tech%2Fbolt5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppad-tech%2Fbolt5/lists"}