Main Menu
LNCLI Methods Overview
53 min
lncli command line interface reference info methods getinfo syntax lncli getinfo description returns basic information related to the active lnd daemon, including identity pubkey, alias, chains connected to, and information about open/pending channels key parameters no additional parameters required (uses global options like rpcserver, macaroonpath, tlscertpath) usage example lncli getinfo getnetworkinfo syntax lncli getnetworkinfo description get statistical information about the current state of the lightning network from the node's perspective, including number of nodes, channels, and network capacity key parameters no additional parameters required usage example lncli getnetworkinfo channelbalance syntax lncli channelbalance description returns the sum of the total available channel balance across all open channels, categorized in local/remote, pending local/remote and unsettled local/remote balances key parameters no additional parameters required usage example lncli channelbalance walletbalance syntax lncli walletbalance description compute and display the wallet's current on chain balance, showing total unspent outputs (confirmed and unconfirmed), all confirmed unspent outputs and all unconfirmed unspent outputs under control of the wallet key parameters \ account the name of the account to retrieve the balance for (optional) min confs the minimum number of confirmations each output should have (optional) usage example lncli walletbalance lncli walletbalance min confs=3 invoice methods addinvoice syntax lncli addinvoice \[command options] \[value] \[preimage] description add a new invoice, expressing intent for a future payment invoices without an amount can be created by not supplying any parameters or providing an amount of 0, allowing the payer to specify the amount key parameters \ memo a description of the payment to attach along with the invoice amt the amount of satoshis in this invoice (default 0) amt msat the amount of millisatoshis in this invoice expiry payment request expiry time in seconds (default 3600) amp generates an amp invoice which can be paid multiple times preimage the hex encoded preimage (32 byte) for the invoice description hash sha 256 hash of the description fallback addr fallback on chain address usage examples lncli addinvoice amt=6969 memo="a coffee for roger" lncli addinvoice memo="flexible payment" # zero amount invoice lncli addinvoice amt=100000 memo="product payment" expiry=7200 cancelinvoice syntax lncli cancelinvoice \[payment hash] description cancel an existing invoice by its payment hash note this command is available in newer versions of lnd (0 8 0+) and requires the payment hash in hexadecimal format key parameters payment hash the payment hash of the invoice to cancel (required, hex format) usage example lncli cancelinvoice 8c5e6ce3dbaa223cf86df3b381a82a8961eb32731bfd4be76e79eb2f5e5dd599 lookupinvoice syntax lncli lookupinvoice \[payment hash] description lookup an existing invoice by its payment hash the passed payment hash must be exactly 32 bytes in hexadecimal format key parameters payment hash the payment hash of the invoice to lookup (required, hex format) usage example lncli lookupinvoice 8c5e6ce3dbaa223cf86df3b381a82a8961eb32731bfd4be76e79eb2f5e5dd599 subscribeinvoices syntax lncli subscribeinvoices \[command options] description creates a uni directional stream from the server to the client for notifying the client of any newly created/settled invoices this is a streaming rpc that will continuously return invoice updates key parameters \ add index the add index starting point for streaming (optional) settle index the settle index starting point for streaming (optional) usage example lncli subscribeinvoices listinvoices syntax lncli listinvoices \[command options] description list all invoices currently stored within the database any active debug invoices are ignored it has full support for paginated responses with various filtering options key parameters \ pending only toggles if all invoices should be returned, or only unsettled ones index offset the index of an invoice to use as start/end of query (default 0) max invoices the max number of invoices to return (default 100) paginate forwards if set, invoices succeeding the index offset will be returned creation date start filter invoices with creation date >= this timestamp creation date end filter invoices with creation date <= this timestamp usage examples lncli listinvoices lncli listinvoices pending only lncli listinvoices max invoices=50 payment methods decodepayreq syntax lncli decodepayreq \<payment request> description decodepayreq takes an encoded payment request string and attempts to decode it, returning a full description of the conditions encoded within the payment request key parameters payment request the lightning network payment request (invoice) string to decode usage example lncli decodepayreq lnbc10u1p30rpd4pp5zuewvg8ltvet6exlm7r6jv3tqrgw4t6h deleteallpayments syntax lncli deletepayments all \[ include non failed] description deleteallpayments deletes all outgoing payments from the database note that it will not attempt to delete in flight payments, since that would be unsafe by default, only failed payments are deleted key parameters \ all delete all payments include non failed include successful payments in deletion (optional, false by default) usage examples lncli deletepayments all lncli deletepayments all include non failed deletepayment syntax lncli deletepayments \<payment hash> \[ include non failed] description deletepayment deletes a specific outgoing payment from the database by its payment hash note that it will not attempt to delete an in flight payment, since that would be unsafe key parameters payment hash the hex encoded payment hash of the payment to delete include non failed allow deletion of successful payments (optional, false by default) usage example lncli deletepayments 8d54fb2afe6e35f36f3e6055fa062b2f3fd11e67b0d287618471477fde80f3a2 listpayments syntax lncli listpayments \[ include incomplete] \[ index offset=\<offset>] \[ max payments=\<num>] \[ reversed] description listpayments returns a list of all outgoing payments made by the node key parameters \ include incomplete include incomplete (failed/pending) payments in the list index offset the index of a payment used as an offset point max payments the maximum number of payments to return reversed return payments in reverse chronological order usage examples lncli listpayments lncli listpayments include incomplete lncli listpayments max payments=10 reversed trackpayment syntax lncli trackpayment \[ json] \<payment hash> description track progress of an existing payment pick up monitoring the progression of a previously initiated payment specified by the hash argument key parameters payment hash the hex encoded payment hash to track json output payment updates as json messages usage example lncli trackpayment f0deb18409273472d7d2a6c36056af8e9f55fce77fa3f9f76d2a095f79bd58cb sendpayment syntax lncli sendpayment \[options] pay req=\<payment request> or lncli sendpayment \[options] \<dest> \<amt> \[payment hash] \[final cltv delta] description send a payment over lightning can either use a payment request (invoice) or manually specify payment parameters note this command is deprecated in favor of routerrpc sendpaymentv2 in newer versions key parameters \ pay req payment request (invoice) to pay dest destination public key (hex) amt amount in satoshis keysend send spontaneous payment without invoice amp use atomic multi path payments fee limit maximum fee in satoshis fee limit percent maximum fee as percentage of payment amount timeout payment timeout in seconds usage examples lncli sendpayment pay req=lnbc10u1p30rpd4pp5zuewvg8ltvet6exlm7r6jv3tqrgw4t6h lncli sendpayment dest 03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f amt 1000 keysend advanced methods channel management channelacceptor syntax lncli channelacceptor description dispatches a bi directional streaming rpc that allows node operators to accept or reject inbound channel open requests based on custom criteria creates a persistent connection where openchannel requests are sent to the client, and the client responds with acceptance/rejection decisions key features streaming rpc maintaining persistent connection for real time channel requests custom control over channel acceptance criteria can modify channel parameters like csv delay, reserve amounts, etc usage example lncli channelacceptor closechannel syntax lncli closechannel \[flags] funding txid output index or lncli closechannel \[flags] chan point=funding txid\ output index description closes an active channel identified by its channel outpoint (funding transaction id and output index) supports both cooperative and unilateral (force) closures with extensive fee control options key parameters \ force attempt unilateral (force) closure block wait for channel close confirmation conf target=\<blocks> target confirmation blocks for fee estimation sat per vbyte=\<amount> manual fee rate in sat/vbyte delivery addr=\<address> address to send funds on cooperative close usage examples lncli closechannel conf target=6 83b5a55b21255915dbc0d005230b2c026a004c839edaa716247b96b66490c66a 1 lncli closechannel force 83b5a55b21255915dbc0d005230b2c026a004c839edaa716247b96b66490c66a 1 closedchannels syntax lncli closedchannels \[flags] description returns a description of all closed channels that the node was a participant in only shows channels that are fully resolved on chain key parameters \ cooperative show only cooperatively closed channels local force show only locally force closed channels remote force show only remotely force closed channels breach show only breach remedy transactions funding canceled show only channels where funding was canceled abandoned show only abandoned channels usage example lncli closedchannels lncli closedchannels cooperative getchaninfo syntax lncli getchaninfo \[flags] \<chan id> or lncli getchaninfo chan point=\<txid\ index> description returns detailed authenticated network announcement information for a specific channel, identified by either its compact channel id or channel point key parameters chan id 8 byte compact channel id (uint64) chan point=\<txid\ index> channel point format (alternative to chan id) usage example lncli getchaninfo 1382286227238092801 lncli getchaninfo chan point=83b5a55b21255915dbc0d005230b2c026a004c839edaa716247b96b66490c66a 1 listchannels syntax lncli listchannels \[flags] description returns a description of all open channels that the node is a participant in provides comprehensive filtering options for channel states key parameters \ active only show only currently active channels inactive only show only currently inactive channels public only show only public channels (announced to network) private only show only private channels (not announced) peer=\<pubkey> show channels with specific peer usage examples lncli listchannels lncli listchannels active only lncli listchannels peer=026165850492521f4ac8abd9bd8088123446d126f648ca35e60f88177dc149ceb2 openchannel syntax lncli openchannel \[flags] \<node key> \<local amt> \[push amt] description opens a new lightning channel to an existing peer supports extensive customization of channel parameters, funding options, and fee policies key parameters \ connect=\<host\ port> connect to peer before opening channel private make channel private (not announced to network) conf target=\<blocks> target confirmation time sat per vbyte=\<amount> manual fee rate min htlc msat=\<amount> minimum htlc value (default 1000) base fee msat=\<amount> base fee for forwarding (default 1000) fee rate ppm=\<amount> fee rate in parts per million (default 1) zero conf attempt zero confirmation channel channel type=\<type> channel type ("tweakless", "anchors", "taproot") usage examples lncli openchannel 026165850492521f4ac8abd9bd8088123446d126f648ca35e60f88177dc149ceb2 1000000 lncli openchannel connect=node example com 9735 sat per vbyte=5 private 026165850492521f4ac8abd9bd8088123446d126f648ca35e60f88177dc149ceb2 1000000 pendingchannels syntax lncli pendingchannels \[flags] description displays information about channels in various pending states those waiting for confirmations, in the process of closing, or with time locked funds key parameters \ include raw tx include raw transaction hex for waiting close channels usage example lncli pendingchannels lncli pendingchannels include raw tx subscribechannelevents syntax lncli subscribechannelevents description creates a uni directional stream from server to client that sends real time updates about channel state changes essential for monitoring channel lifecycle events usage example lncli subscribechannelevents on chain methods estimatefee syntax lncli estimatefee \[command options] send json string \[ conf target=n] description get fee estimates for sending bitcoin on chain to multiple addresses estimatefee asks the chain backend to estimate the fee rate and total fees for a transaction that pays to multiple specified outputs key parameters send json string json string encoding addresses and amounts '{"exampleaddr" numcoinsinsatoshis}' conf target number of blocks that the transaction should confirm in (optional) coin selection strategy strategy for selecting coins ('largest', 'random', or 'global config') usage example lncli estimatefee '{"bc1q8wymjatcv5xpfm4uav2pwtw534t4u0tfup2xgg" 100000}' conf target 6 gettransactions (listchaintxns) syntax lncli listchaintxns \[command options] description returns a list describing all the known transactions relevant to the wallet lists transactions from the wallet including on chain transactions that pay to or are spends from lnd key parameters \ start height the block height from which to start listing transactions end height the block height up to which to list transactions (use 1 for unconfirmed only) account an optional filter to only include transactions relevant to an account usage examples lncli listchaintxns lncli listchaintxns start height 818181 end height 1 newaddress syntax lncli newaddress \[address type] description generates a new address under control of the local wallet creates a new address for receiving on chain bitcoin payments key parameters (address types) p2wkh pay to witness pubkeyhash (native segwit, bech32) np2wkh nested pay to witness pubkeyhash (legacy segwit) p2tr pay to taproot (taproot addresses, bech32m) usage examples lncli newaddress p2tr lncli newaddress p2wkh listunspent syntax lncli listunspent \[command options] description lists utxos available for spending returns a list of all unspent transaction outputs (utxos) that are under the control of the wallet key parameters \ min confs the minimum number of confirmations required for utxos (default 1) max confs the maximum number of confirmations for utxos account an optional filter to only include utxos from a specific account usage examples lncli listunspent lncli listunspent min confs 3 listaddresses note this command is not available in current lnd versions address generation is handled through newaddress and transaction history via listchaintxns sendcoins syntax lncli sendcoins \[command options] addr amt description sendcoins executes a request to send coins to a particular address unlike sendmany, this rpc call only allows creating a single output at a time key parameters \ addr the bitcoin address to send coins to amt the number of bitcoin denominated in satoshis to send conf target the number of blocks that the transaction should confirm in (optional) sat per vbyte manual fee rate in sat/vbyte (optional) send all send all wallet funds label a label for the transaction usage examples lncli sendcoins addr bc1q8wymjatcv5xpfm4uav2pwtw534t4u0tfup2xgg amt 100000 lncli sendcoins addr bc1q8wymjatcv5xpfm4uav2pwtw534t4u0tfup2xgg amt 100000 conf target 3 sendmany syntax lncli sendmany \[command options] send json string description sendmany handles a request for a transaction that creates multiple specified outputs in parallel allows creating a transaction with multiple outputs in a single transaction key parameters send json string json string encoding addresses and amounts '{"exampleaddr" numcoinsinsatoshis}' conf target number of blocks for confirmation (optional) sat per vbyte manual fee rate in sat/vbyte (optional) label a label for the transaction usage examples lncli sendmany '{"bc1q8wymjatcv5xpfm4uav2pwtw534t4u0tfup2xgg" 100000, "bc1qgxpuyfw8n7hrm8qkp3y9bqyqy1c7jf4h8c2s1v" 200000}' lncli sendmany '{"addr1" 50000, "addr2" 75000}' conf target 6 subscribetransactions note this is a streaming rpc with no direct cli command accessible via grpc/rest api for real time transaction notifications peer methods connect syntax lncli connect \[command options] \<pubkey>@host description connectpeer attempts to establish a connection to a remote peer this is at the networking level and is used for communication between nodes this is distinct from establishing a channel with a peer key parameters \<pubkey>@host target address in format "pubkey\@host\ port" perm if set, the daemon will attempt to persistently connect to the target peer usage examples lncli connect 026165850492521f4ac8abd9bd8088123446d126f648ca35e60f88177dc149ceb2\@34 239 230 56 9735 lncli connect perm 026165850492521f4ac8abd9bd8088123446d126f648ca35e60f88177dc149ceb2\@example onion 9735 disconnect syntax lncli disconnect \[command options] \<pubkey> description disconnectpeer attempts to disconnect one peer from another identified by a given pubkey in the case that there are pending or active channels with the target peer, this action will not be allowed key parameters \<pubkey> the hex encoded compressed public key of the peer to disconnect usage example lncli disconnect 026165850492521f4ac8abd9bd8088123446d126f648ca35e60f88177dc149ceb2 listpeers syntax lncli listpeers description listpeers returns a verbose listing of all currently active peers shows detailed information about currently connected peers including their connection status and features usage example lncli listpeers subscribepeerevents note this is a streaming rpc with no direct cli command accessible via grpc/rest api for real time peer online/offline events routing methods buildroute syntax lncli buildroute \[command options] \[arguments ] description builds a fully specified route based on a list of hop public keys retrieves relevant channel policies from the graph to calculate correct fees and time locks key parameters \ hops comma separated hex pubkeys defining the route path amt amount to send in satoshis final cltv delta blocks for last hop to reveal preimage outgoing chan id short channel id for first hop payment addr hex encoded payment address for last hop's mpp record usage examples lncli buildroute hops=03node1 ,03node2 ,03node3 amt=100000 lncli buildroute hops=03abc ,03def final cltv delta=144 payment addr=1a2b3c amt=50000 estimateroutefee syntax lncli estimateroutefee \[command options] dest amt description allows callers to obtain a lower bound estimate of how much it may cost to send an htlc to a target destination key parameters dest destination node public key (bytes) amt sat amount in satoshis (int64) usage example lncli estimateroutefee 03abc123 def456 100000 sendtoroute syntax lncli sendtoroute \[command options] \[arguments ] description ⚠️ deprecated sends a payment over lightning using a specific pre defined route must specify the route and payment hash key parameters \ payment hash hash to use within payment's htlc routes json array string in queryroutes/buildroute response format usage example lncli queryroutes 03abc123 def456 100000 | lncli sendtoroute payment hash=a1b2c3 queryroutes syntax lncli queryroutes \[command options] dest amt description queries the channel router for potential payment paths to a destination node that have sufficient flow for the specified amount, including fees key parameters dest 33 byte hex encoded public key of payment destination amt amount to send in satoshis fee limit maximum fee allowed in satoshis fee limit percent percentage of payment amount used as max fee final cltv delta number of blocks last hop has to reveal preimage use mc use mission control probabilities for pathfinding usage examples lncli queryroutes 03abc123 def456 100000 lncli queryroutes fee limit=1000 use mc 03abc123 def456 50000 describegraph syntax lncli describegraph \[command options] \[arguments ] description returns a description of the latest lightning network graph state from the node's perspective, including all nodes/vertices and edges (channels) connecting them key parameters \ include unannounced include unannounced channels (both private channels and unannounced public channels) include auth proof include announcement signatures in channeledge data usage examples lncli describegraph lncli describegraph include unannounced hodl invoices addhodlinvoice syntax lncli addhodlinvoice \[options] \<hash> \[amount] description add a new hold invoice creates a hold invoice that ties the invoice to a hash supplied in the request unlike regular invoices, hodl invoices allow the receiver to delay settlement until they manually settle or cancel the invoice key parameters hash 32 byte hex encoded hash for the hodl invoice amount amount in satoshis (positional argument) memo description of the payment (optional) amt amount in satoshis (alternative to positional) expiry invoice expiry time in seconds (default 86400 seconds/24 hours) private include routing hints for private channels usage examples lncli addhodlinvoice dd4344345192b48fc9d6359620d255b61559d62557f855f1bc5ff49a58543521 50000 lncli addhodlinvoice memo="escrow payment" expiry=7200 dd4344345192b48fc9d6359620d255b61559d62557f855f1bc5ff49a58543521 100000 settleinvoice syntax lncli settleinvoice \[ preimage=\<preimage>] \<preimage> description reveal a preimage and use it to settle the corresponding hodl invoice this releases the held htlc and completes the payment key parameters preimage the hex encoded preimage (32 bytes) which will allow settling an incoming htlc usage examples lncli settleinvoice 3132333435363738393031323334353637383930313233343536373839303332 lncli settleinvoice preimage=3132333435363738393031323334353637383930313233343536373839303332 global options all lncli commands support these global options \ rpcserver host\ port of ln daemon (default "localhost 10009") lnddir path to lnd's base directory (default " / lnd") tlscertpath path to tls certificate macaroonpath path to macaroon file no macaroons disable macaroon authentication network the network lnd is running on (mainnet/testnet/simnet) version compatibility notes commands documented are compatible with lnd versions 0 17 x and 0 18 x the cancelinvoice command was introduced in lnd v0 8 0 sendpayment is deprecated in favor of routerrpc sendpaymentv2 sendtoroute is deprecated and will be removed in future versions some parameter names and output formats may vary between versions always use lncli \<command> help to see version specific options