Bitcoin Forum
May 05, 2024, 11:34:06 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Can we call a lightning node with JSON-RPC like we can do for a Bitcoin node?  (Read 168 times)
100bitcoin (OP)
Sr. Member
****
Offline Offline

Activity: 860
Merit: 423


View Profile WWW
June 17, 2019, 11:44:15 PM
 #1

If yes, where do I get the reference doc?

Bitcoin addresses contain a checksum, so it is very unlikely that mistyping an address will cause you to lose money.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
pereira4
Legendary
*
Offline Offline

Activity: 1610
Merit: 1183


View Profile
June 18, 2019, 12:59:42 AM
Merited by HeRetiK (1)
 #2

If yes, where do I get the reference doc?


Eclair besides a nice GUI has an API with JSON-RPC features. Documentation is here:


https://acinq.github.io/eclair/#introduction

Run core with these settings on .conf file:
Code:
server=1
rpcuser=foo
rpcpassword=bar
txindex=1
zmqpubrawblock=tcp://127.0.0.1:29000
zmqpubrawtx=tcp://127.0.0.1:29000


To install:


    with GUI:

Code:
java -jar eclair-node-gui-<version>-<commit_id>.jar

    without GUI:

Code:
java -jar eclair-node-<version>-<commit_id>.jar

Note that the node must be segwit ready, so enable segwit addresses (some people only accept Legacy addresses)
danda
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
June 26, 2019, 03:27:33 PM
Merited by HeRetiK (1)
 #3

c-lightning (lightningd) has a json-rpc api.  The client is lightning-cli.   For available commands:

Code:
lightning-cli help

Some (rough) docs are available here:

https://github.com/ElementsProject/lightning/tree/master/doc

It would be nice if they would be published on a wiki someplace, but google doesn't turn it up...

Output of lightning-cli help:

Code:
feerates style
    Return feerate estimates, either satoshi-per-kw ({style} perkw) or satoshi-per-kb ({style} perkb).

connect id [host] [port]
    Connect to {id} at {host} (which can end in ':port' if not default). {id} can also be of the form id@host

listnodes [id]
    Show node {id} (or all, if no {id}), in our local network view

getroute id msatoshi riskfactor [cltv] [fromid] [fuzzpercent] [exclude] [maxhops]
    Show route to {id} for {msatoshi}, using {riskfactor} and optional {cltv} (default 9). If specified search from {fromid} otherwise use this node as source. Randomize the route with up to {fuzzpercent} (default 5.0). {exclude} an array of short-channel-id/direction (e.g. [ '564334x877x1/0', '564195x1292x0/1' ]) from consideration. Set the {maxhops} the route can take (default 20).

listchannels [short_channel_id] [source]
    Show channel {short_channel_id} or {source} (or all known channels, if not specified)

invoice msatoshi label description [expiry] [fallbacks] [preimage] [exposeprivatechannels]
    Create an invoice for {msatoshi} with {label} and {description} with optional {expiry} seconds (default 1 hour), optional {fallbacks} address list(default empty list) and optional {preimage} (default autogenerated)

listinvoices [label]
    Show invoice {label} (or all, if no {label})

delinvoice label status
    Delete unpaid invoice {label} with {status}

delexpiredinvoice [maxexpirytime]
    Delete all expired invoices that expired as of given {maxexpirytime} (a UNIX epoch time), or all expired invoices if not specified

autocleaninvoice [cycle_seconds] [expired_by]
    Set up autoclean of expired invoices. Perform cleanup every {cycle_seconds} (default 3600), or disable autoclean if 0. Clean up expired invoices that have expired for {expired_by} seconds (default 86400).

waitanyinvoice [lastpay_index]
    Wait for the next invoice to be paid, after {lastpay_index} (if supplied)

waitinvoice label
    Wait for an incoming payment matching the invoice with {label}, or if the invoice expires

decodepay bolt11 [description]
    Decode {bolt11}, using {description} if necessary

help [command]
    List available commands, or give verbose help on one {command}.

stop
    Shut down the lightningd process

check command_to_check
    Don't run {command_to_check}, just verify parameters.

getlog [level]
    Show logs, with optional log {level} (info|unusual|debug|io)

fundchannel id satoshi [feerate] [announce] [minconf]
    Fund channel with {id} using {satoshi} (or 'all') satoshis, at optional {feerate}. Only use outputs that have {minconf} confirmations.

listconfigs [config]
    List all configuration options, or with [config], just that one.

sendpay route payment_hash [label] [msatoshi] [bolt11]
    Send along {route} in return for preimage of {payment_hash}

waitsendpay payment_hash [timeout]
    Wait for payment attempt on {payment_hash} to succeed or fail, but only up to {timeout} seconds.

listpayments [bolt11] [payment_hash]
    Show outgoing payments

listsendpays [bolt11] [payment_hash]
    Show sendpay, old and current, optionally limiting to {bolt11} or {payment_hash}.

listpeers [id] [level]
    Show current peers, if {level} is set, include logs for {id}

close id [force] [timeout]
    Close the channel with {id} (either peer ID, channel ID, or short channel ID). If {force} (default false) is true, force a unilateral close after {timeout} seconds (default 30), otherwise just schedule a mutual close later and fail after timing out.

disconnect id [force]
    Disconnect from {id} that has previously been connected to using connect; with {force} set, even if it has a current channel

getinfo
    Show information about this node

setchannelfee id [base] [ppm]
    Sets specific routing fees for channel with {id} (either peer ID, channel ID, short channel ID or 'all'). Routing fees are defined by a fixed {base} (msat) and a {ppm} (proportional per millionth) value. If values for {base} or {ppm} are left out, defaults will be used. {base} can also be defined in other units, for example '1sat'. If {id} is 'all', the fees will be applied for all channels.

listforwards
    List all forwarded payments and their information

ping id [len] [pongbytes]
    Send peer {id} a ping of length {len} (default 128) asking for {pongbytes} (default 128)

withdraw destination satoshi [feerate] [minconf]
    Send to {destination} address {satoshi} (or 'all') amount via Bitcoin transaction, at optional {feerate}

newaddr [addresstype]
    Get a new {bech32, p2sh-segwit} (or all) address to fund a channel (default is bech32)

dev-listaddrs [bip32_max_index]
    Show addresses list up to derivation {index} (default is the last bip32 index)

listfunds
    Show available funds from the internal wallet

dev-rescan-outputs
    Synchronize the state of our funds with bitcoind

pay bolt11 [msatoshi] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee]
    Send payment specified by {bolt11} with {amount}

paystatus [bolt11]
    Detail status of attempts to pay {bolt11}, or all

listpays [bolt11]
    List result of payment {bolt11}, or all

---
run `lightning-cli help <command>` for more information on a specific command

mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
ReckLess.6
Jr. Member
*
Offline Offline

Activity: 44
Merit: 16


View Profile
July 07, 2019, 06:47:12 PM
 #4

API documentation for Lightning Network Daemon (LND) - https://api.lightning.community/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!