lightning-splice_init

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

SYNOPSIS

(WARNING: experimental-splicing only)

splice_init channel_id relative_amount [initialpsbt] [feerate_per_kw] [force_feerate]

DESCRIPTION

Command added in v23.08.

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

  • channel_id (hash): The channel id of the channel to be spliced.
  • relative_amount (integer): A positive or negative amount of satoshis to add or subtract from the channel. Note you may need to add a double dash (--) after splice_init if using a negative relative_amount so it is not interpretted as a command modifier. For example: shell lightning-cli splice_init -- $CHANNEL_ID -100000 .
  • initialpsbt (string, optional): The (optional) base 64 encoded PSBT to begin with. If not specified, one will be generated automatically.
  • feerate_per_kw (u32, optional): 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 (boolean, optional): 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.

USAGE

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 the PSBT with the splice_update command.

PSBT_SPLICE_UPDATE=$(echo $(lightning-cli splice_update $CHANNEL_ID $PSBT_SPLICE_INIT) | jq -r ".psbt")

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:

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

AUTHOR

Dusty <@dusty\_daemon> is mainly responsible.

SEE ALSO

lightning-splice_signed(7), lightning-splice_update(7)

RESOURCES

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

EXAMPLES

Example 1:

Request:

lightning-cli splice_init -k "channel_id"="f62126acb4e1a8113eb3ce40ed80e34a49d49b035cb9d36417b1c1333227112c" "relative_amount"=100000 "initialpsbt"="cHNidP8BAF4CAAAAAfYhJqy04agRPrPOQO2A40pJ1JsDXLnTZBexwTMyJxEsAQAAAAD9////Ac652gsAAAAAIlEgj47URidVfbzMQq4BipxUdKmRKFeSxMqJHB9ZxWZdNGCSAAAAAAEAiQIAAAAB+fmfTbLExUIRcwBZD0qxCoNAHIDe7sEfYHguS6nfkn4AAAAAAP3///8CQEIPAAAAAAAiACCT3t0MJlvKhoV20+4uWe67sg68KW5Y9+3Kk9XursCJloFs3AsAAAAAIlEgW7Q7f9oXFdDdAUFoJaGFIqLX7LFkdbiHgOj6/Bxz74mNAAAAAQErgWzcCwAAAAAiUSBbtDt/2hcV0N0BQWgloYUiotfssWR1uIeA6Pr8HHPviQAA"
{
  "id": "example:splice_init#1",
  "method": "splice_init",
  "params": {
    "channel_id": "f62126acb4e1a8113eb3ce40ed80e34a49d49b035cb9d36417b1c1333227112c",
    "relative_amount": 100000,
    "initialpsbt": "cHNidP8BAF4CAAAAAfYhJqy04agRPrPOQO2A40pJ1JsDXLnTZBexwTMyJxEsAQAAAAD9////Ac652gsAAAAAIlEgj47URidVfbzMQq4BipxUdKmRKFeSxMqJHB9ZxWZdNGCSAAAAAAEAiQIAAAAB+fmfTbLExUIRcwBZD0qxCoNAHIDe7sEfYHguS6nfkn4AAAAAAP3///8CQEIPAAAAAAAiACCT3t0MJlvKhoV20+4uWe67sg68KW5Y9+3Kk9XursCJloFs3AsAAAAAIlEgW7Q7f9oXFdDdAUFoJaGFIqLX7LFkdbiHgOj6/Bxz74mN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bmluZwEIreWkThWNrsoA"
}

Example 2:

Request:

lightning-cli splice_init "f62126acb4e1a8113eb3ce40ed80e34a49d49b035cb9d36417b1c1333227112c" "-105000" "cHNidP8BAgQCAAAAAQMElAAAAAEEAQABBQEBAQYBAwH7BAIAAAAAAQMIoIYBAAAAAAABBCJRIMTSgkFfmoHRjgi2GaGdEWuGVssb9JPl9UC797egWEzaAA=="
{
  "id": "example:splice_init#2",
  "method": "splice_init",
  "params": [
    "f62126acb4e1a8113eb3ce40ed80e34a49d49b035cb9d36417b1c1333227112c",
    -105000,
    "cHNidP8BAgQCAAAAAQMElAAAAAEEAQABBQEBAQYBAwH7BAIAAAAAAQMIoIYBAAAAAAABBCJRIMTSgkFfmoHRjgi2GaGdEWuGVssb9JPl9UC797egWEzaAA=="
  ]
}

Response:

{
  "psbt": "cHNidP8BAgQCAAAAAQMElAAAAAEEAQEBBQECAQYBAwH7BAIAAAAAAQCyAgAAAAL2ISastOGoET6zzkDtgONKSdSbA1y502QXscEzMicRLAEAAAAA/f////YhJqy04agRPrPOQO2A40pJ1JsDXLnTZBexwTMyJxEsAAAAAAAAAAAAAs652gsAAAAAIlEgj47URidVfbzMQq4BipxUdKmRKFeSxMqJHB9ZxWZdNGDgyBAAAAAAACIAIJPe3QwmW8qGhXbT7i5Z7ruyDrwpblj37cqT1e6uwImWkgAAAAEBK+DIEAAAAAAAIgAgk97dDCZbyoaFdtPuLlnuu7IOvCluWPftypPV7q7AiZYBBUdSIQJXDsC261RWYzAhg6YurHXQj97rZPMTUhkgZdYByMpSHSECZoZ8NCuCUKtrTtrG264v3lN4K2nNFxOZSfvU8ghIf/JSrgEOIJW7FYF67zRaxARLQco1KmOXtFQY8yFwpGexdGngFEX4AQ8EAQAAAAEQBAAAAAAM/AlsaWdodG5pbmcBCF4tdoSn7LwCAAEDCAAAAAAAAAAAAQQiACCT3t0MJlvKhoV20+4uWe67sg68KW5Y9+3Kk9XursCJlgz8CWxpZ2h0bmluZwEIGQ1Quuj5CvAAAQMIoIYBAAAAAAABBCJRIMTSgkFfmoHRjgi2GaGdEWuGVssb9JPl9UC797egWEzaDPwJbGlnaHRuaW5nAQi4FyJ2dePgEAA="
}