lightning-splice_signed -- Command to initiate a channel to a peer
SYNOPSIS
(WARNING: experimental-splicing only)
splice_signed channel_id psbt [sign_first]
DESCRIPTION
Command added in v23.08.
splice_signed
is a low level RPC command which finishes the active channel splice associated with channel_id
.
The psbt must have all signatures attached to all inputs that you have added to it or it will fail.
- channel_id (hash): The channel id of the channel to be spliced.
- psbt (string): The psbt of the resulting transaction after splice negotiation(s)
- sign_first (boolean, optional): A flag that makes our node offer the final splice signature first (defaults to false). When false, the node will calculate who should sign first based off who is adding inputting the least sats to the splice as per spec.
USAGE
In this example we funded the psbt from our lightning node, so we can use the lightning node to sign for its funds.
SIGNPSBT=$(echo $(lightning-cli signpsbt $PSBT_SPLICE_UPDATE) | jq -r ".signed_psbt")
lightning-cli splice_signed $CHANNEL_ID $SIGNPSBT
Here is an example set of splice commands that will splice in 100,000 sats to the first channel that comes out of listpeerchannels
.
The example assumes you already have at least one confirmed channel.
1: Get the channel id of the first channel.
CHANNEL_ID=$(echo $(lightning-cli listpeerchannels) | jq -r ".channels[0].channel_id")
2: Get the PSBT from fundpsbt.
INITIALPSBT=$(echo $(lightning-cli fundpsbt -k satoshi=100000sat feerate=urgent startweight=800 excess_as_change=true) | jq -r ".psbt")
3: Initiate the splice by passing channel id and initialpsbt received from above steps.
PSBT_SPLICE_INIT=$(echo $(lightning-cli splice_init $CHANNEL_ID 100000 $INITIALPSBT) | jq -r ".psbt")
4: Update PSBTs with the splice_update command.
RESULT={"commitments_secured":false}
while [[ $(echo $RESULT | jq -r ".commitments_secured") == "false" ]]
do
PSBT_SPLICE_UPDATE=$(echo $(lightning-cli splice_update $CHANNEL_ID $PSBT_SPLICE_INIT) | jq -r ".psbt")
echo $PSBT_SPLICE_UPDATE
done
5: Sign the updated PSBT.
SIGNPSBT=$(echo $(lightning-cli signpsbt -k psbt="$PSBT_SPLICE_UPDATE") | jq -r ".signed_psbt")
6: Finally, call splice_signed with channel id and signed PSBT parameters.
lightning-cli splice_signed $CHANNEL_ID $SIGNPSBT
RETURN VALUE
On success, an object is returned, containing:
- tx (hex): The hex representation of the final transaction that is published.
- txid (txid): The txid is of the final transaction.
- psbt (string): The psbt of the resulting transaction after splice negotiation(s)
- outnum (u32, optional): The index of the new funding output. (added v24.08)
AUTHOR
Dusty <@dusty\_daemon> is mainly responsible.
SEE ALSO
lightning-splice_init(7), lightning-splice_update(7)
RESOURCES
Main web site: https://github.com/ElementsProject/lightning
EXAMPLES
Example 1:
Request:
lightning-cli splice_signed -k "channel_id"="channelid0780000780000780000780000780000780000780000780000780000" "psbt"="cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000"
{
"id": "example:splice_signed#1",
"method": "splice_signed",
"params": {
"channel_id": "channelid0780000780000780000780000780000780000780000780000780000",
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000"
}
}
Response:
{
"tx": "02000000000101sendpt64000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000",
"txid": "txid6400064000640006400064000640006400064000640006400064000",
"outnum": 1,
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000"
}
Example 2:
Request:
lightning-cli splice_signed -k "channel_id"="channelid0780000780000780000780000780000780000780000780000780000" "psbt"="cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000"
{
"id": "example:splice_signed#2",
"method": "splice_signed",
"params": {
"channel_id": "channelid0780000780000780000780000780000780000780000780000780000",
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000"
}
}
Response:
{
"tx": "02000000000102sendpt65000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000",
"txid": "txid6500065000650006500065000650006500065000650006500065000",
"outnum": 1,
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000"
}