{"id":19001436,"url":"https://github.com/bumi/lnrpc","last_synced_at":"2025-07-02T21:33:55.794Z","repository":{"id":34083796,"uuid":"169691140","full_name":"bumi/lnrpc","owner":"bumi","description":"a gRPC client for the Lightning Network Daemin (LND) packed as rubygem","archived":false,"fork":false,"pushed_at":"2023-10-18T12:57:13.000Z","size":222,"stargazers_count":19,"open_issues_count":5,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-26T10:51:27.053Z","etag":null,"topics":["bitcoin","grpc","lightning","lightning-network","lnd","ruby"],"latest_commit_sha":null,"homepage":"","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/bumi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2019-02-08T05:49:20.000Z","updated_at":"2025-04-10T22:15:35.000Z","dependencies_parsed_at":"2022-08-20T13:00:43.446Z","dependency_job_id":"bed875d9-d405-4465-805d-29809cbc710e","html_url":"https://github.com/bumi/lnrpc","commit_stats":{"total_commits":86,"total_committers":5,"mean_commits":17.2,"dds":"0.10465116279069764","last_synced_commit":"951291c8038660135a7fb61e481a1098f8e7b223"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/bumi/lnrpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumi%2Flnrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumi%2Flnrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumi%2Flnrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumi%2Flnrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bumi","download_url":"https://codeload.github.com/bumi/lnrpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumi%2Flnrpc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263218736,"owners_count":23432545,"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","grpc","lightning","lightning-network","lnd","ruby"],"created_at":"2024-11-08T18:11:09.805Z","updated_at":"2025-07-02T21:33:55.688Z","avatar_url":"https://github.com/bumi.png","language":"Ruby","readme":"# Lnrpc - ruby gRPC client for LND\n[![Gem Version](https://badge.fury.io/rb/lnrpc.svg)](https://badge.fury.io/rb/lnrpc)\n\na [gRPC](https://grpc.io/) client for [LND, the Lightning Network Daemon](https://github.com/lightningnetwork/lnd/) packed as ruby gem.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'lnrpc', '~\u003e 0.15.5'\n```\nlnrpc follows the lnd versioning, thus it is recommended to specify the exact version you need for your lnd node as dependency (see [#Versioning](#Versioning)).\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install lnrpc\n    # or for pre releases:\n    $ gem install lnrcp --pre\n\n## Usage\n\nThis gem makes the gRPC client classes created from the [LND service definitions](https://github.com/lightningnetwork/lnd/tree/master/lnrpc) available.  \n\n```ruby\nrequire \"lnrpc\"\n\n# With the changes in LND v.10.0 this load the `Lnrpc` and `Routerrpc` namespace\n\nLnrpc::Lightning::Stub\nRouterrpc::Routerrpc::Stub\nLnrpc::GetInfoRequest\n...\n```\n\nLearn more about [gRPC](https://grpc.io/) on [gRPC.io](https://grpc.io/).\n\nThe LND API reference can be found here: [https://api.lightning.community/](https://api.lightning.community/)\n\n### Example\n\n```ruby\nrequire \"lnrpc\"\n\ncredentials = File.read(\"/path/to/tls.cert\")\nmacaroon = File.read(\"/path/to/readonly.macaroon\").unpack(\"H*\")\n\n# initialize a new client\nclient = Lnrpc::Lightning::Stub.new(\"localhost:10009\", GRPC::Core::ChannelCredentials.new(self.credentials))\n\n# perform a request\nrequest = Lnrpc::GetInfoRequest.new\nresponse = client.get_info(request, { metadata: { macaroon: macaroon } }) #=\u003e Lnrpc::GetInfoResponse\nputs response.alias\n\nrouter = Routerprc::Router::Stub.new(\"localhost:10009\", GRPC::Core::ChannelCredentials.new(self.credentials))\n...\n\n```\n\n### Client wrapper\n\nNOTE: v10.0 has breaking changes!\n\nAn optional client wrapper ([Lnrpc::Client](https://github.com/bumi/lnrpc/blob/master/lib/lnrpc/client.rb)) makes\ninitializing the gRPC client easier and removes the need for some boilerplate code for calling RPC methods.\n\n#### Example\n```ruby\nlnd = Lnrpc::Client.new({credentials_path: '/path/to.cert.cls', macaroon_path: '/path/to/admin.macaroon'})\nlnd.lightning # =\u003e Lnrpc::Lightning::Stub\nlnd.router # =\u003e Lnrpc::Router::Stub\n\nlnd.lightning.get_info\n```\n\nAlso have a look at [examples.rb](https://github.com/bumi/lnrpc/blob/master/examples.rb)\n\n#### Initializing a new client\n\nThe Lnrpc::Client constructor allows the following options:\n\n* credentials:\n  - `credentials` : the credentials data as string (pass nil if a \"trusted\" cert (e.g. from letsencrypt is used)\n  - `credentials_path` : the path to a credentials file (tls.cert) as string (default: `\"#{LND_HOME_DIR}/tls.cert\"` )\n* macaroon:\n  - `macaroon` : the macaroon as hex string\n  - `macaroon_path` : the path to the macaroon file created by lnd as string (default: `\"#{LND_HOME_DIR}/data/chain/bitcoin/mainnet/admin.macaroon\"`)\n* address:\n  - `address` : lnd address as string. format: address:port, e.g. localhost:10009 (default)\n\nIf no credentials or no macaroon is provided default files are assumed in `ENV['LND_HOME'] || \"~/.lnd\"`.\nA macaroon is required.\n\n```ruby\nrequire 'lnrpc'\n\nlnd = Lnrpc::Client.new({\n  credentials_path: '/path/to.cert.cls',\n  macaroon_path: '/path/to/admin.macaroon',\n  address: 'host:port'\n})\n\n# the actual gRPC client is available through:\nlnd.lightning.grpc\nlnd.router.grpc\n```\n\n#### Calling RPC methods\n\nThe client wrapper passes any supported RPC method call to the gRPC client applying the following conventions:\n\nIf the first parameter is a hash or blank the corresponding gRPC request object will be instantiated.\n\nExample:\n\n```ruby\nclient.lightning.get_info\n# is the same as:\nclient.lightning.grpc.get_info(Lnrpc::GetInfoRequest.new)\n\nclient.lightning.list_channels(inactive_only: true)\n# is the same as:\nrequest = Lnrpc::ListChannelsRequest.new(inactive_only: true)\nclient.lightning.grpc.list_channels(request)\n\nclient.lightning.wallet_balance.total_balance\n# is the same as:\nrequest = Lnrpc::WalletBalanceRequest.new\nclient.lightning.grpc.wallet_balance(request).total_balance\n```\n\n## Using with BTC Pay Server\nIf you have a running BTC Pay Server with LND support, integrating with lnrpc is easy.\n\n- Navigate to the domain associated with your BTC Pay Server\n- Navigate to Services on the Server Settings page\n- Click \"see information\" for your gRPC Server\n- The link by \"More details...\" will expose the address and various macaroon hex strings\n- Initialize your client with the options detailed above. BTC Pay Server utilizes LetsEncrypt for trusted TLC Certificates so set that option to nil.\n\nDon't have a BTC Pay Server? [Setting one up is easy.](https://medium.com/@BtcpayServer/launch-btcpay-server-via-web-interface-and-deploy-full-bitcoin-node-lnd-in-less-than-a-minute-dc8bc6f06a3)\n\n\n## Versioning\n\nThis gem follows the LND versions and will update the gRPC service definitions accordingly.\ne.g. gem version 0.5.2 includes the gRPC service definitions from LND v0.5.2\n\nsee [rubygems](https://rubygems.org/gems/lnrpc) for all available releases.\n\n\n### Update service definitions\n\nThe script `generate-grpc-service-files.sh` can be used to generate the GRPC ruby files.\nThe files will be stored in `lib/grpc_services`\n\n    $ ./generate-grpc-service-files.sh\n\n+ Make sure you have the [grpc-tools](https://rubygems.org/gems/grpc-tools) installed\n+ Make sure you have the lnd source in your $GOPATH/src folder\n\n## Other resources\n\n* [LND gRPC API Reference](https://api.lightning.community)\n* [LND Developer Site](https://dev.lightning.community/)\n* [gRPC Ruby quick start](https://grpc.io/docs/quickstart/ruby.html)\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/bumi/lnrpc.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbumi%2Flnrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbumi%2Flnrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbumi%2Flnrpc/lists"}