Git Product home page Git Product logo

perun's Introduction

Perun


Warning!

Perun does NOT currently offer ANY authentication.

All API calls, irrespective of where they originate from, will be treated as valid so long as they are valid per the API spec.

It is thus recommended to block incoming traffic on the Perun port (3000 by default).


Description

A nodejs module to interact with an LND node using a REST API.


Initial project functionality requirements:

  • Create a REST API which allows to:
    • Export transactions to CSV
    • Delete old transactions

Requirements

Perun requires your system to already have the following installed:

  • LND (developed with v0.12.1)
  • npm (developed with v6.14.13)
  • nodejs (developed with v14.17.3)

By default, Perun will try to connect to LND at localhost:10009


Installation and usage

  1. Ensure you have met the requirements from the previous section.

  2. Clone the repo:

git clone https://github.com/mateuszmp/Perun.git

  1. Navigate to the cloned repo:

cd Perun

  1. Install the dependencies:

npm install

  1. Start Perun with:

npm start -- --network=<testnet or mainnet> --lnd_path=/home/<YOUR USERNAME>/.lnd


Arguments

Perun accepts command line arguments provided they are preceded with --.

Example

Correct

npm start -- --network=testnet --lnd_path=/home/John/.lnd

Incorrect

npm start --network=testnet --lnd_path=/home/John/.lnd

Supported arguments

Argument Description Default
--network= mainnet or testnet. Used to pick the right macaroon.
--lnd_path= The path of the .lnd directory. Used to get the credentials for the connection with LND.
--lnd_hostname= Address or hostname to reach LND. localhost
--lnd_port= Port on which to reach LND. 10009
--port= Port on which to listen for incoming connections. 3000

API overview

RESTful call LND call Action
GET /payments POST /ListPayments Returns JSON of outgoing payments
GET /payments/csv unsupported Returns simplified list of outgoing payments in CSV format
DELETE /payments POST /DeleteAllPayments Deletes history of outgoing payments
  • Parameters should only be sent in the request body.
  • Parameters not matching an API call spec will be ignored.

API detailed specs

GET /payments

LND API equivalent:

POST /ListPayments

Action:

Returns JSON of outgoing payments.

Parameters

Name Default value
include_incomplete true
index_offset 0
max_payments 0
offset false

Response

Returns a JSON consisting of:

  • payments - array of Payment objects as defined in LND API docs
  • first_index_offset
  • last_index_offset

GET /payments/csv

LND API equivalent:

unsupported

Action:

Returns simplified list of outgoing payments in CSV format.

Parameters

Same as GET /payments

Response

The following fields in CSV format:

  • payment_hash
  • payment_preimage
  • value_sat
  • value_msat
  • payment_request
  • fee_sat
  • fee_msat
  • creation_time_ns
  • payment_index

Notice: Basically returns serializable, non-deprecated, fields.


DELETE /payments

LND API equivalent:

POST /DeleteAllPayments

Action:

Deletes history of outgoing payments.

Parameters

Name Default value
failed_payments_only true
failed_htlcs_only true

Response

{}


Repo name origins

Perun (sometimes Grom) is the name of the god of lightning and thunder in Slavic mythology.

Perun the Thunderer by Andrey Shishkin

perun's People

Contributors

mateuszmp avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.