A Core Lightning plugin to create CPFP (Child Pays For Parent) transactions for opening lightning channels.
- Python 3.7+
- Core Lightning 24.11+
- Bitcoin Core
- txindex in Bitcoin Core
Note: This plugin does not work with lightning version 24.08 because it uses the listaddresses rpc call, which was introduced in version 24.11.
- Clone the repository:
git clone https://github.com/ca-ruz/bumpit.git
cd bumpit
- Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate
- Install dependencies:
# Install plugin dependencies
pip install -r requirements.txt
# Install test dependencies
pip install -r requirements-dev.txt
-
Make sure you are running Bitcoin Core and Core Lightning
-
Start the plugin:
lightning-cli plugin start $PWD/bumpit.py
-
Find a peer ID you want to open a channel with
-
Open a channel:
lightning-cli fundchannel <peer_id> <amount_in_sats> [feerate]
- Get the funding transaction txid and change vout:
l1-cli listfunds | jq '
[ .channels[] | select(.state | test("AWAITING")) | .funding_txid ] as $target_txids
| [ .outputs[] | select(.txid as $output_txid | $target_txids | index($output_txid)) ]
'
- Create a CPFP transaction:
lightning-cli bumpchannelopen <txid> <vout> <amount> [yolo]
Note: amount
is the fee/feerate, should be specified in either sat/vB, e.g.'5satvb' or sats e.g. '1000sats'
Optional: Type the word yolo
as an argument after the amount
or use -k
with yolo=yolo
if you want the plugin to broadcast the transaction for you.
The test suite uses Core Lightning's test framework and requires a regtest environment. You need to run the following commands inside of the plugin directory.
- To run all tests:
pytest -vs
- To run an individual test:
pytest -vs <name_of_the_test_file.py>
Note: By default, the fund_nodes
command in regtest will automatically mine a block, this will confirm the funding transaction. We need to change this in the config, otherwise we wouldn't be able to test the plugin.
- Navigate to Core Lightning's contrib directory:
cd ~/code/lightning/contrib
- Open the config:
nano startup_regtest.sh
- Look for the fund_nodes function and comment out this lines:
# "$BCLI" -datadir="$BITCOIN_DIR" -regtest generatetoaddress 6 "$ADDRESS" > /dev/null
#
# printf "%s" "Waiting for confirmation... "
#
# while ! "$LCLI" -F --lightning-dir=$LIGHTNING_DIR/l"$node1" listchannels | grep -q "channels"
# do
# sleep 1
# done
- Save & exit
- Start the regtest environment:
source startup_regtest.sh
start_ln
- Fund the nodes:
fund_nodes
- Start the plugin (from the plugin directory):
l1-cli plugin start $PWD/bumpit.py
- Get the funding transaction txid and change vout:
l1-cli listfunds | jq '
[ .channels[] | select(.state | test("AWAITING")) | .funding_txid ] as $target_txids
| [ .outputs[] | select(.txid as $output_txid | $target_txids | index($output_txid)) ]
'
- Create a CPFP transaction:
l1-cli bumpchannelopen <txid> <vout> <amount> [yolo]
Note: amount
is the fee/feerate, should be specified in either sat/vB e.g.'5satvb' or sats e.g. '1000sats'
Optional: Type the word yolo
as an argument after the amount
or use -k
with yolo=yolo
if you want the plugin to broadcast the transaction.
The plugin accepts the following configuration options:
bump_brpc_user
: Bitcoin RPC usernamebump_brpc_pass
: Bitcoin RPC passwordbump_brpc_port
: Bitcoin RPC port (default: 18443)yolo
: Set to'yolo'
to broadcast the transaction automatically.
- Fork the repository
- Create a new branch for your feature
- Make your changes
- Run the test suite to ensure everything works
- Submit a pull request