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).
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
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
-
Ensure you have met the requirements from the previous section.
-
Clone the repo:
git clone https://github.com/mateuszmp/Perun.git
- Navigate to the cloned repo:
cd Perun
- Install the dependencies:
npm install
- Start Perun with:
npm start -- --network=<testnet or mainnet> --lnd_path=/home/<YOUR USERNAME>/.lnd
Perun accepts command line arguments provided they are preceded with --
.
npm start -- --network=testnet --lnd_path=/home/John/.lnd
npm start --network=testnet --lnd_path=/home/John/.lnd
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 |
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.
POST /ListPayments
Returns JSON of outgoing payments.
Name | Default value |
---|---|
include_incomplete | true |
index_offset | 0 |
max_payments | 0 |
offset | false |
Returns a JSON consisting of:
- payments - array of Payment objects as defined in LND API docs
- first_index_offset
- last_index_offset
unsupported
Returns simplified list of outgoing payments in CSV format.
Same as GET /payments
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.
POST /DeleteAllPayments
Deletes history of outgoing payments.
Name | Default value |
---|---|
failed_payments_only | true |
failed_htlcs_only | true |
{}
Perun (sometimes Grom) is the name of the god of lightning and thunder in Slavic mythology.