{"id":27946003,"url":"https://github.com/azuchi/c-lightningrb","last_synced_at":"2026-02-17T13:04:11.311Z","repository":{"id":59152119,"uuid":"188332536","full_name":"azuchi/c-lightningrb","owner":"azuchi","description":"The library for c-lighting Plugin with Ruby.","archived":false,"fork":false,"pushed_at":"2020-06-26T01:37:32.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-14T10:53:46.112Z","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":null,"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":"2019-05-24T01:39:16.000Z","updated_at":"2025-03-03T07:17:12.000Z","dependencies_parsed_at":"2022-09-13T11:00:56.067Z","dependency_job_id":null,"html_url":"https://github.com/azuchi/c-lightningrb","commit_stats":null,"previous_names":["azuchi/c-lightningrb","chaintope/c-lightningrb"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/azuchi/c-lightningrb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuchi%2Fc-lightningrb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuchi%2Fc-lightningrb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuchi%2Fc-lightningrb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuchi%2Fc-lightningrb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azuchi","download_url":"https://codeload.github.com/azuchi/c-lightningrb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuchi%2Fc-lightningrb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29545295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T13:00:00.370Z","status":"ssl_error","status_checked_at":"2026-02-17T12:57:14.072Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-05-07T13:45:21.216Z","updated_at":"2026-02-17T13:04:11.288Z","avatar_url":"https://github.com/azuchi.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# c-lightningrb: A ruby client library for lightningd [![Build Status](https://travis-ci.org/chaintope/c-lightningrb.svg?branch=master)](https://travis-ci.org/chaintope/c-lightningrb) [![Gem Version](https://badge.fury.io/rb/c-lightningrb.svg)](https://badge.fury.io/rb/c-lightningrb) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)\n\nThis library is for writing c-lightning plugins in Ruby.\nYou can write your own RPC, event notifications, and Hooks in DSL.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'c-lightningrb', require: 'lightning'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install c-lightningrb\n\n## Examples\n\n### Using the JSON-RPC client\n\n```ruby\nrequire 'lightning'\n\n# initialize RPC interface using unix socket file.\nrpc = Lightning::RPC.new('/home/azuchi/.lightning/lightning-rpc')\n\nputs rpc.getinfo\n\n=\u003e {\n  \"id\": \"02a7581f5aafd3ed01a6664ad5108ce1601435d9e9e47c57f1c40cff152cd59307\",\n  \"alias\": \"GREENPHOTO\",\n  \"color\": \"02a758\",\n  \"num_peers\": 0,\n  \"num_pending_channels\": 0,\n  \"num_active_channels\": 0,\n  \"num_inactive_channels\": 0,\n  \"address\": [\n\n  ],\n  \"binding\": [\n    {\n      \"type\": \"ipv6\",\n      \"address\": \"::\",\n      \"port\": 9735\n    },\n    {\n      \"type\": \"ipv4\",\n      \"address\": \"0.0.0.0\",\n      \"port\": 9735\n    }\n  ],\n  \"version\": \"v0.7.0\",\n  \"blockheight\": 1518441,\n  \"network\": \"testnet\",\n  \"msatoshi_fees_collected\": 0,\n  \"fees_collected_msat\": \"0msat\"\n}\n\nputs rpc.invoice(1000, 'example', 'test payment')\n\n=\u003e {\n     \"payment_hash\": \"76b2f5d6791a2e0be44071543c71d27238e2153fd832ac23d8c027b33e024fb8\",\n     \"expires_at\": 1558856940,\n     \"bolt11\": \"lntb10n1pww5dkupp5w6e0t4nerghqhezqw92rcuwjwguwy9flmqe2cg7ccqnmx0szf7uqdq5w3jhxapqwpshjmt9de6qcqp2phn9mgplxj2mxg59zjrlhwh2p66h2r3p4f7kyk8w4s3zcma5htn807r8lgfmg75hwcvhse8sqtgcyakgezdzjc0zyd87uahe3wsz3qcp4nv6f0\",\n     \"warning_capacity\": \"No channels have sufficient incoming capacity\"\n   }\n```\n\n### Writing a plugin\n\nYou can write your own Plugin by inheriting `Lightning::Plugin`.\n\n```ruby\n#!/usr/bin/env ruby\nrequire 'lightning'\n\nclass HelloPlugin \u003c Lightning::Plugin\n  \n  # Command line option pass-through\n  option 'greeting', 'World', \"What name should I call you?\"\n\n  # define new rpc. Usage and description are required only for the definition of RPC.\n  desc '[name]', 'Returns a personalized greeting for {greeting} (set via options).'\n  define_rpc :hello, -\u003e (name) do\n    log.info \"log = #{log}\"\n    \"hello #{name}\"\n  end\n\n  # add subscription for event notification\n  subscribe :connect, -\u003e(id, address) do\n    log.info \"received connect notification. id = #{id}, address = #{address}\"\n  end\n\n  subscribe :disconnect, -\u003e(id) do\n    log.info \"received disconnect notification. id = #{id}\"\n  end\n\n  # add Hook\n  hook :peer_connected, -\u003e(peer) do\n    log.info \"peer_connected. peer = #{peer}\"\n    {result: 'continue'}\n  end\n\nend\n\np = HelloPlugin.new\np.run\n```\n\nWrite all RPC, notification, and hook handlers in Lambda. \nThese Lambdas are implemented as methods, so you can access any of the fields and methods of the Plugin.\nFor example, `Lightning::Plugin` instance has `rpc` field which can access `lightningd` via `Lightning::RPC`.\n\nAnd it works if you specify Plugin as the parameter when c-lightning launches.\n\n```\n$ lightningd --plugin=\u003cabove file path\u003e\n```\n\nNote: Plugin file needs execute permission.\n\nNote: If you write logs to stdout with puts etc., it will be sent as a response to lightningd. \nTherefore, if you want to output the log, please use Plugin#log logger. \nThis log is output to under /tmp/ruby-lightnig directory.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuchi%2Fc-lightningrb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazuchi%2Fc-lightningrb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuchi%2Fc-lightningrb/lists"}