LIGHTNING-DEV-SPLICE(7)
okay bestie, welcome to the LIGHTNING-DEV-SPLICE(7) page π
this one is lowkey iconic and highkey about making splices do exactly what you want, so letβs get into it. π«Ά
πΈ NAME πΈ
dev-splice β Command to initiate a channel to a peer β¨
β¨ SYNOPSIS β¨
dev-splice script_or_json [dryrun] [force_feerate] [debug_log] [dev-wetrun]
π DESCRIPTION π
okay so this command was added in v24.11 β noted. π
splice is the command that moves funds into or out of a channel. Multiple actions can be combined together into one single onchain transaction. Funds may be moved out of a channel and into another in a single batch, which enables cross-channel movement. slay. π
script_or_json(string) β the splice script you want to execute, or the json equivalent. πdryrun(boolean, optional) β donβt execute any actions; just output a transcript of what would have been done. πforce_feerate(boolean, optional) β by default splices fail if the fee provided looks too high, because the command is protecting you from accidentally setting your fee higher than intended. Setforce_feeratetotrueto skip this safety check. β οΈdebug_log(boolean, optional) β adds a verbose log of each splice calculation step to the result. πdev-wetrun(boolean, optional) β executes the splice up until the point signatures would be sent, then aborts. π
π RETURN VALUE π
on success, an object is returned, containing:
dryrun(array of strings, optional) β the transcript of what the script would have done:- (string, optional) β one action line of the splice script result. β¨
psbt(string, optional) β the final psbt. π¦tx(string, optional) β the final transaction in hex. π₯txid(string, optional) β the txid of the final transaction. πlog(array of strings, optional) β a verbose log of each step of the splice calculations:- (string, optional) β a line of detail about the splice calculations. π
π AUTHOR π
Dusty @dusty_daemon is mainly responsible. periodt. π
π SEE ALSO π
lightning-splice_signed(7), lightning-splice_update(7)
β RESOURCES β
Main web site: https://github.com/ElementsProject/lightning
π§ USAGE π§
the primary method is to make a script containing one or more splice actions that get merged into a single transaction. If possible, the entire operation will be completed and broadcast to the mempool. no cap. π
but if you specify your own inputs using psbt, then the command returns a psbt that you must sign and then pass to splice_signed. okay bestie? π«Ά
It is required to pass script_or_json.
It is recommended that you first do a dryrun to confirm your script does what you expect it to do. yes, vibe check your splice first. π
scriptβ the splice script to execute.dryrunβ donβt execute any actions and output a transcript of what would have been done.psbtβ an initial psbt to begin the splice with.user_provided_satsβ the amount of sats being contributed by the initial psbt.force_feerateβ by default splices fail if the fee provided looks too high. This is to protect against accidentally setting your fee higher than intended. Set it totrueto skip this safety check.jsonβ a json payload of instructions can be passed instead ofscript.debug_logβ adds a verbose log of each splice calculation step to the result.dev-wetrunβ executes the splice up until the point signatures would be sent, then aborts.
the primary purpose of splice script is to execute all types of splices using a single command. You can perform all these actions manually using the lower level api (see splice_init), but this splice command interface is much simpler to use and it provides some security against signing maliciously inserted inputs. π
π SCRIPT π
okay bestie, a splice script is literally just a series of segments separated by newlines or semicolons β¨ Each segment = one splice action, usually adding to or removing from a channel. The funds go into or out of the channel depending on which side of the arrow -> the channel identifier is on. The amount goes on the other side. Iconic.
Like this:
8338aef0 -> 10000sat
That's how we take 10,000 sats out of channel 8338aef0 π
To put 10,000 sats into the channel, we point the arrow into the channel:
10000sat -> 8338aef0
In those last two examples we used the first 8 digits of the channel identifier. You can specify as few as 4 digits of the beginning of the channel identifier and it will be autocompleted to the matching channel. But if the code matches more than one channel or node id, the script will fail with an error π
vibe check: short prefixes are cute until they're ambiguous. then it's a whole error moment.
To put funds into a channel, we need to get the funds from somewhere. The simplest place is the built-in onchain wallet. The wallet operator can be placed just like channel identifiers π«Ά
Take funds out of the wallet:
wallet -> 10000sat
Put funds back into the wallet:
10000sat -> wallet
Now combine them into one script:
wallet -> 10000sat
10000sat -> 8338aef0
The first line withdraws 10,000 sats from the wallet and puts them in the script's βgeneral script funds.β The second line takes 10,000 sats from the βgeneral script fundsβ and places them into channel 8338aef0. This example is called a βsplice in.β slay.
But bestie, onchain fees have to be funded from somewhere too. The simplest way is to pay the fee from the βgeneral script funds.β If we change the amount going into the channel to a percentage, the fee gets taken automatically from the βgeneral script fundsβ like so:
wallet -> 10000sat
100% -> 8338aef0
When you specify a percentage instead of an amount, it means take that percentage out of the βgeneral script fund.β
This will take 10,000 sats from the onchain wallet and put that amount less any onchain fees into channel 8338aef0. The feerate used will be the node's standard opening feerate. To use your own feerate you must use the fee operator πΈ
The fee operator is attached to an amount. If you want to take out extra to cover the fee, use +fee; if you want to reduce the amount being sent somewhere, use the -fee suffix. Example:
wallet -> 10000sat+fee
10000sat -> 8338aef0
Here we add precisely 10,000 sats to channel 8338aef0 and withdraw enough from the wallet to cover the 10,000 sats and the onchain fee. periodt.
To control the amount of fee, you can specify a fee-rate with the at @ symbol after fee. After the at symbol, specify a number of sats to pay per kiloweight (aka. perkw) like so:
wallet -> 10000sat+fee@300
10000sat -> 8338aef0
This example pays a fee rate of 300 sats per thousand weight units. To view this amount in other units (ie. sats/vbyte) execute a dryrun of the script π
Instead of withdrawing extra from the wallet, we can reduce the amount going to channel 8338aef0 using the -fee operator like so:
wallet -> 10000sat
10000sat-fee -> 8338aef0
This example withdraws 10,000 sats from the onchain wallet, pays the onchain fee from that amount, and puts the rest into channel 8338aef0.
You can also specify the feerate here like so:
wallet -> 10000sat
10000sat-fee@300 -> 8338aef0
Now let's build a script that takes funds out of a channel and puts them into the onchain wallet:
8338aef0 -> 10000sat
100% -> wallet
But by default, scripts that leave sats in the βgeneral script fundβ will be automatically sent to the wallet. So the second line isn't needed β we can simplify the script to:
8338aef0 -> 10000sat
We can also move sats to a specific bitcoin address like so:
8338aef0 -> 10000sat+fee
100% -> 1JfbZRwdDHKZmuiZgYArJZhcuuzuw2HuMu
This example pays 10,000 sats to the address 1JfbZRwdDHKZmuiZgYArJZhcuuzuw2HuMu out of your channel balance in 8338aef0 π
Percentages on the right side take out that amount of available funds from a channel. For example:
8338aef0 -> 100%
This takes all available funds out of channel 8338aef0 and puts them into the onchain wallet. Note that available funds is restricted by pending HTLCs and the 1% reserve requirement. To get all the funds you need to close the channel π
More useful would be something like this:
8338aef0 -> 50%
100% -> 07bfddea
This example takes half the available funds from channel 8338aef0 and puts them into channel 07bfddea.
We can also split this amount like so:
8338aef0 -> 50%
50% -> 07bfddea
50% -> 09ad6278
This example takes half the funds in 8338aef0 and splits them between channels 07bfddea and 09ad6278 π¦
If we want to send funds to more channels, calculating percentages can get unwieldy, so we can use the asterisk operator * which divides the βgeneral script fundsβ amongst all destinations using it, like so:
8338aef0 -> 50%
* -> 07bfddea
* -> 09ad6278
* -> efc2a7ff
This example takes half the available funds in 8338aef0 and splits them evenly among three achannels π
Sats can be specified with multiple suffixes including sat, msat, btc, M, or K. The M suffix is shorthand for a million satoshis and the K suffix is shorthand for a thousand satoshis. These can be combined with a decimal point like so:
07bfddea -> 1.23M
09ad6278 -> 900K
efc2a7ff -> 0.01btc
This example takes 1,230,000 sats from 07bfddea, 900,000 sats from 09ad6278, and 1,000,000 sats from efc2a7ff and puts them in the onchain wallet. math ate π
Another way to specify channel ids is a channel query. These take the form of a node id, a colon, and a number or symbol (ie. "034645dc:0") which results in your first channel with the peer whose node id starts with 034645dc. Change the number after the colon to get a different index like so:
034645dc:0 -> 10K
034645dc:1 -> 10K
034645dc:2 -> 10K
This example takes 10,000 sats out of the first three channels with peer 034645dc and puts the total minus fees into the onchain wallet.
In addition to index numbers, the symbol after the colon can be a question mark ? or an asterisk * which mean match the first unused channel or all the remaining channels respectively like so:
* -> 034645dc:?
* -> 03e3d03e:0
03e3d03e:* -> 100%
This example takes 100% of available funds from all of 03e3d03e's channels except the first one and splits them between 03e3d03e's first channel and 034645dc's first channel β¨
The node id prefix can also be replaced with the asterisk * which means match all nodes. This can be combined with the asterisk * that matches all unused channels like so:
wallet -> 10000sat
100% -> *:*
This example takes 10,000 sats from the onchain wallet and divides them between all channels π
It is possible to request a peer to add funds to a channel with a lease request. This is done using the pipe | symbol and optionally specifying the maximum fee you authorize using the at @ symbol. After the pipe you specify the amount of sats you would like to lease, followed by the at symbol and a percentage value like so:
wallet -> 10M+fee
100%|10M@1% -> 8338aef0
This example splices 10,000,000 sats into channel and requests your peer also add 10,000,000 sats to the channel. If the fee they demand is over 1% or the lease amount is too small the operation will be aborted. Whatever lease fee they do charge will come out of the 10,000,000 sats going into the channel balance. The onchain fee will be paid by taking extra funds out of the onchain wallet.
lease request = peer funds join the party, but there are limits bestie. fee too high or lease too small = abort.
Lease requests do not need to be combined with splicing in funds but you must pay the onchain fee from somewhere. One simple location to take the fees from is your existing channel balance. Doing so requires using two arrows since funds are going into and out of the channel at the same time, like so:
|10M@1% -> 8338aef0 -> 0+fee
This example makes a lease request from your peer on 8338aef0 for 10,000,000 sats and pays the onchain fee using the channel balance. This is a particularly elegant way to pay the onchain fee without adding any inputs or outputs beyond the channel funding itself π§
When passing via the command line, using semicolons can be simpler instead of newlines. Here are some command line examples:
Splice out 10 million satoshis to the onchain wallet
$ lightning-cli splice "8338aef0 -> 10M"
Splice in 10 thousand satoshis from the onchain wallet
$ lightning-cli splice "wallet -> 10K; 100% -> 8338aef0"
Send 900 thousand satoshis from a channel to an onchain address
$ lightning-cli splice "8338aef0 -> 0.9M+fee; 0.9M -> 1JfbZRwdDHKZmuiZgYArJZhcuuzuw2HuMu"
Move 1 bitcoin between two channels
$ lightning-cli splice "8338aef0 -> 1btc; 100% -> 07bfddea"
Splice in 100 thousand sats to the first channel with peer id 034645dc
$ lightning-cli splice "wallet -> 0.1M; 100% -> 034645dc:?"
Splice in 100 thousand sats split across all channels with peer id 034645dc
$ lightning-cli splice "wallet -> 100000; 100% -> 034645dc:*"
Take the maximum out of one chanel and split the value across peer 034645dc's channel plus one more channel
$ lightning-cli splice "8338aef0 -> 100%; * -> 034645dc:*; * -> 07bfddea"
and that's the whole script language, bestie β no cap, every arrow, fee, lease, wildcard, and command-line semicolon accounted for π
Core Lightning v26.06.9 Β· LIGHTNING-DEV-SPLICE(7) Β· date says hi from the footer π«Ά mwah π
π¦ where this page comes from
- nixpkgs unstable: clightning 26.06.9
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms