core-lightning/doc/lightning-splice_signed.7.md
Tony Aldon 8f6a02c182 doc: fix display of lists and code blocks in manpages.
The conversion from markdown to manpages does not display lists and
code blocks correctly if they are not preceded by an empty line.

Changelog-None
2023-10-14 17:55:51 +02:00

2.6 KiB

lightning-splice_signed -- Command to initiate a channel to a peer

SYNOPSIS

(WARNING: experimental-splicing only)

splice_signed channel_id psbt [sign_first]

DESCRIPTION

splice_signed is a low level RPC command which finishes the active channel splice associated with channel_id.

channel_id is the channel id of the channel being spliced.

psbt is the final version of the psbt to complete the splice with.

sign_first is 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.

The psbt must have all signatures attached to all inputs that you have added to it or it will fail.

In this example we funded the psbt from our lightning node, so we can use the lightning node to sign for its funds.

RESULT=$(lightning-cli signpsbt $PSBT)
PSBT=$(echo $RESULT | jq -r ".signed_psbt")
echo $RESULT

lightning-cli splice_signed $CHANNEL_ID $PSBT

Here is a full 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.

RESULT=$(lightning-cli listpeerchannels)
CHANNEL_ID=$(echo $RESULT| jq -r ".channels[0].channel_id")
echo $RESULT

RESULT=$(lightning-cli fundpsbt -k satoshi=100000sat feerate=urgent startweight=800 excess_as_change=true)
INITIALPSBT=$(echo $RESULT | jq -r ".psbt")
echo $RESULT

RESULT=$(lightning-cli splice_init $CHANNEL_ID 100000 $INITIALPSBT)
PSBT=$(echo $RESULT | jq -r ".psbt")
echo $RESULT

RESULT="{\"commitments_secured\":false}"
while [[ $(echo $RESULT | jq -r ".commitments_secured") == "false" ]]
do
	RESULT=$(lightning-cli splice_update $CHANNEL_ID $PSBT)
	PSBT=$(echo $RESULT | jq -r ".psbt")
	echo $RESULT
done

RESULT=$(lightning-cli signpsbt -k psbt="$PSBT")
PSBT=$(echo $RESULT | jq -r ".signed_psbt")
echo $RESULT

lightning-cli splice_signed $CHANNEL_ID $PSBT

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

SEE ALSO

AUTHOR

@dusty_daemon

RESOURCES

Main web site: https://github.com/ElementsProject/lightning