{"id":28176335,"url":"https://github.com/azuchi/lnd-tool","last_synced_at":"2025-10-04T07:02:13.302Z","repository":{"id":56881734,"uuid":"430277030","full_name":"azuchi/lnd-tool","owner":"azuchi","description":"LND Tool - Ruby tools for LND","archived":false,"fork":false,"pushed_at":"2021-12-14T00:26:58.000Z","size":32,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-04T04:49:19.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/azuchi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-21T04:58:11.000Z","updated_at":"2021-12-14T00:27:01.000Z","dependencies_parsed_at":"2022-08-20T23:10:41.768Z","dependency_job_id":null,"html_url":"https://github.com/azuchi/lnd-tool","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuchi%2Flnd-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuchi%2Flnd-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuchi%2Flnd-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuchi%2Flnd-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azuchi","download_url":"https://codeload.github.com/azuchi/lnd-tool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442787,"owners_count":22071879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-05-16T00:17:54.029Z","updated_at":"2025-10-04T07:02:13.297Z","avatar_url":"https://github.com/azuchi.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LND::Tool [![Build Status](https://github.com/azuchi/lnd-tool/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/azuchi/lnd-tool/actions/workflows/main.yml) [![Gem Version](https://badge.fury.io/rb/lnd-tool.svg)](https://badge.fury.io/rb/lnd-tool) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE.txt)\n\nThis is a tool for LND written in Ruby. Subscribe to htlc events in LND and save their contents to SQLite3.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'lnd-tool'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install lnd-tool\n\n## Usage\n\n### Configuration\n\nFirst, create a configuration file for the gRPC connection to LND.\n\n* config.yml\n\n```yaml\nlnd:\n  credentials_path: 'Path to credential file like $LND_HOME/tls.cert.'\n  macaroon_path: 'Path to the macaroon file created by lnd like $LND_HOME/data/chain/bitcoin/mainnet/admin.macaroon'\n  host: 'lnd host'\n  port: 10009 # gRPC port\n```\n\n### Capture HTLC events\n\nRun following command specifying the above configuration file.\n\n    $ lnd-tool capture_htlc --config \"Path to configuration file\"\n\nRun process in the background as a daemon and starts capturing the HTLC event.\n\nA directory `$HOME/.lnd-tool` will be created and a SQLite3 database named `storage.db`\nwill be created in it. You can access this database:\n\n    $ sqlite3 $HOME/.lnd-tool\n    SQLite version 3.27.2 2019-02-25 16:06:06\n    Enter \".help\" for usage hints.\n    sqlite\u003e .tables\n    HtlcEvent\n    sqlite\u003e .header on\n    sqlite\u003e .mode column\n    sqlite\u003e select * from HtlcEvent;\n    id          incoming_channel_id  outgoing_channel_id  incoming_htlc_id  outgoing_htlc_id  timestamp_ns         event_type  forward_event  forward_fail_event  settle_event  link_fail_event                                                                                                                                                                                                                                                     created_datetime\n    ----------  -------------------  -------------------  ----------------  ----------------  -------------------  ----------  -------------  ------------------  ------------  --------------------------------------------------------------------------------------------------------------------                                                                                                                                                -------------------\n    1           759077539161571329   781080965883559937   201               0                 1637643738317254952  FORWARD                                                      {\"info\":{\"incomingTimelock\":711047,\"outgoingTimelock\":711007,\"incomingAmtMsat\":\"250004750\",\"outgoingAmtMsat\":\"250001250\"},\"wireFailure\":\"TEMPORARY_CHANNEL_FAILURE\",\"failureDetail\":\"INSUFFICIENT_BALANCE\",\"failureString\":\"insufficient bandwidth to route htlc\"}  2021-11-23 14:02:18\n    2           759077539161571329   781080965883559937   202               0                 1637643771224622997  FORWARD                                                      {\"info\":{\"incomingTimelock\":711047,\"outgoingTimelock\":711007,\"incomingAmtMsat\":\"973389706\",\"outgoingAmtMsat\":\"973378973\"},\"wireFailure\":\"TEMPORARY_CHANNEL_FAILURE\",\"failureDetail\":\"INSUFFICIENT_BALANCE\",\"failureString\":\"insufficient bandwidth to route htlc\"}  2021-11-23 14:02:51\n\nIf you stop the capturing, run following command:\n\n    $ lnd-tool stop_capture\n\n### Search HTLC events\n\nYou can use the `query_htlc` command to retrieve the data of HTLC events stored in SQLite3.\nSince it is a search to the database, it can be run even if the capture process is not running.\n\n    $ lnd-tool query_htlc\n    +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n    |                                                                                    HTLC Events                                                                                     |\n    +--------------------+---------------+--------------------+---------------+---------------------------+------------+--------------+------------------+---------------+---------------+\n    | incoming channel   | incoming htlc | outgoing channel   | outgoing htlc | timestamp                 | event type | result       | detail           | incoming msat | outgoing msat |\n    +--------------------+---------------+--------------------+---------------+---------------------------+------------+--------------+------------------+---------------+---------------+\n    | 759077539161571329 |           259 | 781080965883559937 |             0 | 2021-11-29 13:29:57 +0900 | FORWARD    | LINK_FAIL    | FEE_INSUFFICIENT |      75002825 |      75001075 |\n    | 759526139822866433 |            32 | 759077539161571329 |           441 | 2021-11-25 16:34:48 +0900 | FORWARD    | FORWARD FAIL |                  |               |               |\n    | 759526139822866433 |            32 | 759077539161571329 |           441 | 2021-11-25 16:34:44 +0900 | FORWARD    | FORWARD      |                  |     100050900 |     100000000 |\n    | 759526139822866433 |            31 | 759077539161571329 |           440 | 2021-11-25 16:34:39 +0900 | FORWARD    | FORWARD FAIL |                  |               |               |\n    | 759526139822866433 |            31 | 759077539161571329 |           440 | 2021-11-25 16:34:36 +0900 | FORWARD    | FORWARD      |                  |         11005 |         10000 |\n    +--------------------+---------------+--------------------+---------------+---------------------------+------------+--------------+------------------+---------------+---------------+\n\nThe `query_htlc` command has the following options.\n\n* `event`: Option to specify the event type(`send`, `receive`, `forward`). e.g. `$ lnd-tool query_htlc --event=forward`\n* `limit`: Option to narrows down the number of data. e.g. `$lnd-tool query_htlc --limit=30`\n\n### Prune HTLC events\n\nWhen the capture is running, the HTLC event is stored in the DB and the size of the DB grows.\nSince v0.3.0, the `prune_htlc` command to prune(delete) DB records has been added.\n\nThe `prune_htlc` command should be executed with one of the following options:\n\n* `max`: This is the maximum number of events to be retained in the DB. \nData exceeding this number will be pruned from the oldest data. (e.g.`$lnd-tool prune_htlc --max 10000`)\n* `date`: Delete data prior to this date. (e.g.`$lnd-tool prune_htlc --date 2021-11-24`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuchi%2Flnd-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazuchi%2Flnd-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuchi%2Flnd-tool/lists"}