bitcoin core: 0.21.0
core lightning: 0.11.1
joinmarket: 0.9.6
Start the open channel negotiation with a peer node, and get the funding address
lightning-cli fundchannel_start 036g....(target_node_public_key) 1000000(amount in satoshis) fee_rate true(public channel) return_address(pick an external address of joinmarket)
In joinmarket, create a PSBT that is funded by the joinmarket fund. Do Not Broadcast this transaction yet!
python sendpayment.py wallet.jmdat [-m 3](optional, the target mixdepth) -N 0 --psbt 0.01 (The amount to send in Bitcoin, must be equal to the amount of step 1) bc1qypf....(The funding address returned in step 1)
Complete the open channel negotiation with the peer node, get them to sign the commitment transaction, so that the funding transaction would then be safe to be broadcasted.
lightning-cli fundchannel_complete 036g....(target_node_public_key) "cHNidAbC...."(The signed PSBT returned in Step 2)
Finalize the PSBT to a raw transaction so that it can be broadcasted.
bitcoin-cli finalizepsbt "cHNidAbC...."(The signed PSBT returned in Step 2)
Decode the raw transaction, make sure the txid
is consistent with the funding_txid
that lightningd is expecting.
bitcoin-cli decoderawtransaction "020000000001018....." (The raw transaction returned in Step 4)
lightning-cli listpeers
All preparations are done, broadcast the transaction, wait for 3 confirmations, and the channel will be open. When the channel is closed, your own balance would be returned to the JoinMarket address you specified in Step 1. Using this process, all your on-chain balances can be kept inside JoinMarket, and you don't need to worry about transfering fund between your lightning node and your JoinMarket wallet.
bitcoin-cli sendrawtransaction "020000000001018....." (The raw transaction returned in Step 4)