ShahanaFarooqui / clnrest

clnrest
MIT License
3 stars 0 forks source link

CLNRest

CLNRest is a lightweight Python-based core lightning plugin that transforms RPC calls into a REST service. By generating REST API endpoints, it enables the execution of Core Lightning's RPC methods behind the scenes and provides responses in JSON format.

Installation

Install required packages with pip install json5 flask flask_restx gunicorn pyln-client or pip install -r requirements.txt.

Configuration

Plugin

Server

With the default configurations, the Swagger user interface will be available at https://127.0.0.1:3010/. The POST method requires rune and nodeid headers for authorization.

cURL

Example curl command for GET: curl -k https://127.0.0.1:3010/v1/notifications

Example curl command for POST will also require rune and nodeid headers like below: curl -k -X POST 'https://127.0.0.1:3010/v1/getinfo' -H 'Rune: <node-rune>' -H 'Nodeid: <node-id>'

With -k or --insecure option curl proceeds with the connection even if the SSL certificate cannot be verified. This option should be used only when testing with self signed certificate.

Swagger

Swagger Dashboard Swagger Authorize Swagger GET List Methods Swagger POST RPC Method

Postman

Postman Headers Postman with JSON body Postman bkpr plugin RPC