core-lightning/doc/lightning-splice_init.7.md
Dusty Daemon 4628e3ace8 channeld: Code to implement splicing
Update the lightningd <-> channeld interface with lots of new commands to needed to facilitate spicing.

Implement the channeld splicing protocol leveraging the interactivetx protocol.

Implement lightningd’s channel_control to support channeld in its splicing efforts.

Changelog-Added: Added the features to enable splicing & resizing of active channels.
2023-07-31 21:00:22 +09:30

2.4 KiB

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

SYNOPSIS

(WARNING: experimental-splicing only)

splice_init channel_id relative_amount [initalpsbt] [feerate_per_kw] [force_feerate]

DESCRIPTION

splice_init is a low level RPC command which initiates a channel splice for a given channel specified by channel_id.

channel_id is the channel id of the channel to be spliced.

relative_amount is a positive or negative amount of satoshis to add or subtract from the channel.

initalpsbt is the (optional) base 64 encoded PSBT to begin with. If not specified, one will be generated automatically.

feerate_per_kw is the miner fee we promise our peer to pay for our side of the splice transaction. It is calculated by feerate_per_kw * our_bytes_in_splice_tx / 1000.

force_feerate is a boolean flag. By default splices will fail if the fee provided looks too high. This is to protect against accidentally setting your fee higher than intended. Set force_feerate to true to skip this saftey check.

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.

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=$(lightning-cli splice_update $CHANNEL_ID $PSBT)
PSBT=$(echo $RESULT | jq -r ".psbt")
echo $RESULT

RESULT=$(lightning-cli signpsbt $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:

  • psbt (string): the (incomplete) PSBT of the splice transaction

SEE ALSO

AUTHOR

@dusty_daemon

RESOURCES

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