{"id":20626619,"url":"https://github.com/roosoft/lnd_client","last_synced_at":"2025-04-15T15:20:38.972Z","repository":{"id":48831518,"uuid":"379388996","full_name":"RooSoft/lnd_client","owner":"RooSoft","description":"Connects to the Lightning Network Daemon known as LND","archived":false,"fork":false,"pushed_at":"2023-05-23T12:39:35.000Z","size":238,"stargazers_count":5,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T21:42:48.877Z","etag":null,"topics":["bitcoin","lightning-network","lnd"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RooSoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2021-06-22T20:10:36.000Z","updated_at":"2023-05-25T05:04:23.000Z","dependencies_parsed_at":"2024-12-22T20:38:17.307Z","dependency_job_id":"b1843b9f-93e3-4058-b6aa-791fff3f0d81","html_url":"https://github.com/RooSoft/lnd_client","commit_stats":{"total_commits":124,"total_committers":5,"mean_commits":24.8,"dds":"0.41129032258064513","last_synced_commit":"30e1229c402f58d36c1fa6537cea64705aa556fe"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RooSoft%2Flnd_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RooSoft%2Flnd_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RooSoft%2Flnd_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RooSoft%2Flnd_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RooSoft","download_url":"https://codeload.github.com/RooSoft/lnd_client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249094939,"owners_count":21211837,"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":["bitcoin","lightning-network","lnd"],"created_at":"2024-11-16T13:14:12.141Z","updated_at":"2025-04-15T15:20:38.930Z","avatar_url":"https://github.com/RooSoft.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LndClient ⚡\n\nConnects to the [Lightning Network Daemon](https://github.com/lightningnetwork/lnd)'s [gRPC API](https://api.lightning.community/#lnd-grpc-api-reference) known as LND\n\n## Donations\n\nThis library is being built in the wild according to these principles\n\n- Free to use\n- Developer friendly\n- Modular\n\nArguably, the most important part is that it is `unbiased`.\n\nIf you want to keep it that way, and want to promote its active development, please send donations\nhere: `bc1qwpj2nyunrvjkj7z0unk4gg3ht26h2ysh9dqtez`\n\nThank you!\n\n## Prerequisites for umbrel users\n\nwith a fresh clone of this project, run\n\n```bash\nmix deps.get\n```\n\ncopy those files from the umbrel to the computer running the app\n\n- `/home/umbrel/umbrel/lnd/tls.cert` must be copied to `~/.lnd/umbrel.cert`\n- add `/home/umbrel/umbrel/lnd/data/chain/bitcoin/mainnet/readonly.macaroon` to the `~/.lnd`\n- look below for the NODE environment variable that must be set when you run `iex -S mix`\n\n## How to use as a dependency\n\nThe package can be installed by adding `lnd_client`\nto your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:lnd_client, \"~\u003e 0.1.7\"}\n  ]\nend\n```\n\n## Usage\nThis may be used with another Elixir application or on its own using IEx.\n\n## How to use in an app\n\n### Add this dependency in mix.exs\n\n```elixir\n{:lnd_client, \"~\u003e 0.1\"}\n```\n\n### LND config\n\nWhenever you start a LndClient GenServer, you need to specify the credential config.\n\n```elixir\nconn_config = %LndClient.ConnConfig{\n  node_uri: System.get_env(\"BOB_NODE\"),\n  cert_path: System.get_env(\"BOB_CERT\"),\n  macaroon_path: System.get_env(\"BOB_MACAROON\")\n}\n```\n\n### Start the server, get node info and then stop the server\n\n```elixir\nLndClient.start_link(%LndClient.Config{conn_config: conn_config})\nLndClient.get_info\nLndClient.stop\n```\n\n### Multiple LNDs\nYou can start multiple GenServers by passing in the name:\n\n```elixir\nLndClient.start_link(%LndClient.Config{conn_config: conn_config, name: BobLndClient})\nLndClient.get_info(BobLndClient)\n```\n\n## How to use it with a Supervisor\n\nAdd this to the list of children:\n\n```elixir\nchildren = [\n  # ...\n] ++ LndClient.child_specs(%LndClient.Config{conn_config: conn_config})\n```\n\nIf you're going to make more than one connection to an LND, pass in the name.\n\n```elixir\nchildren = [\n  # ...\n] ++ LndClient.child_specs(%LndClient.Config{conn_config: alice_conn_config, name: AliceLndClient}) ++ LndClient.child_specs(%LndClient.Config{conn_config: bob_conn_config, name: BobLndClient})\n```\n\nThen, somewhere else in your app:\n\n```elixir\nLndClient.add_invoice(%Lnrpc.Invoice{value_msat: 150_000}, BobLndClient)\n```\n\n## How to use with IEx\n\nIn the root of the folder, ensure that the following env vars in the example below exist:\n\n```bash\nNODE=localhost:100009\nCERT=~/path/to/tls.cert\nMACAROON=~/path/to/macaroon\n```\n\nThen `iex -S mix`\n\nSee if the connection was made:\n\n```elixir\nLndClient.get_info\n```\n\nYou didn't need to call `start_link` because `.iex.exs` calls that for you.\n\n## Tests\n\nRun `mix test`\n\n## Library Maintenance\n\n### Get fresh protos\n\n[List of protos](https://api.lightning.community/#lnd-grpc-api-reference)\n\nMake sure protoc is properly installed. Here is how to do it on Debian.\n\n```bash\nsudo apt install -y protobuf-compiler\nmix escript.install hex protobuf\nasdf reshim\n```\n\n```bash\ncd proto\n\ncurl -O https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/lightning.proto\ncurl -O https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/routerrpc/router.proto\ncurl -O https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/invoicesrpc/invoices.proto\n\nprotoc --elixir_out=plugins=grpc:../lib/gRPC lightning.proto\nprotoc --elixir_out=plugins=grpc:../lib/gRPC router.proto\nprotoc --elixir_out=plugins=grpc:../lib/gRPC invoices.proto\n\ncd ..\n```\n\n### HTLC examples\n\n#### Routerrpc.ForwardEvent\n\n```elixir\n%Routerrpc.HtlcEvent{\n  event: {:forward_event,\n   %Routerrpc.ForwardEvent{\n     info: %Routerrpc.HtlcInfo{\n       incoming_amt_msat: 11005,\n       incoming_timelock: 680165,\n       outgoing_amt_msat: 11000,\n       outgoing_timelock: 680125\n     }\n   }},\n  event_type: :FORWARD,\n  incoming_channel_id: 744146171265875972,\n  incoming_htlc_id: 87,\n  outgoing_channel_id: 742921315233366017,\n  outgoing_htlc_id: 379,\n  timestamp_ns: 1619026298906259040\n}\n```\n\n#### Routerrpc.ForwardFailEvent\n\n```elixir\n%Routerrpc.HtlcEvent{\n  event: {:forward_fail_event, %Routerrpc.ForwardFailEvent{}},\n  event_type: :FORWARD,\n  incoming_channel_id: 744146171265875972,\n  incoming_htlc_id: 88,\n  outgoing_channel_id: 742921315233366017,\n  outgoing_htlc_id: 380,\n  timestamp_ns: 1619028533664696456\n}\n```\n\n#### Routerrpc.SettleEvent\n\n```elixir\n%Routerrpc.HtlcEvent{\n  event: {:settle_event, %Routerrpc.SettleEvent{}},\n  event_type: :RECEIVE,\n  incoming_channel_id: 744146171265875972,\n  incoming_htlc_id: 90,\n  outgoing_channel_id: 0,\n  outgoing_htlc_id: 0,\n  timestamp_ns: 1619028715648844495\n}\n```\n\n#### Routerrpc.LinkFailEvent\n\n```elixir\n%Routerrpc.HtlcEvent{\n  event: {:link_fail_event,\n   %Routerrpc.LinkFailEvent{\n     failure_detail: :INVALID_KEYSEND,\n     failure_string: \"invalid keysend parameters\",\n     info: %Routerrpc.HtlcInfo{\n       incoming_amt_msat: 10000,\n       incoming_timelock: 680090,\n       outgoing_amt_msat: 0,\n       outgoing_timelock: 0\n     },\n     wire_failure: :INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS\n   }},\n  event_type: :RECEIVE,\n  incoming_channel_id: 744146171265875972,\n  incoming_htlc_id: 89,\n  outgoing_channel_id: 0,\n  outgoing_htlc_id: 0,\n  timestamp_ns: 1619028709202674659\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froosoft%2Flnd_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froosoft%2Flnd_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froosoft%2Flnd_client/lists"}