I'm running a local Lightning Network setup (regtest) with two nodes.
I want to open a 1,000,000 sat capacity channel, and I use the following command:
lncli2 openchannel --node_key "02abb632deeb44eeac2eab7b22eedc72f4cec102d69cc536262ab6bf706a8e6322" \ --local_amt 1000000 \ --utxo "0e9e974441b6559238907ee225ad7b0fbc6d08fb4cadcd61738a829a23a2914e:0" \ --sat_per_vbyte 0 \ --private
However, I get this error:
[lncli] rpc error: code = Unknown desc = not enough witness outputs to create funding transaction, need 0.00106087 BTC only have 0.00100000 BTC available
If I increase the funding amount to 0.00106087 BTC, it works. But where do these extra 6,087 sats come from?
At this point, the channel is successfully opened, and the details are as follows:
{ "capacity": "1000000", "local_chan_reserve_sat": "10000", "remote_chan_reserve_sat": "10000", "commit_fee": "3140", "local_balance": "996530", "remote_balance": "0" }
Breaking this down:
capacity - 3140 (commit_fee) = 996860 996860 - 330 (anchor) = 996530
Everything checks out so far.
Next, I pay a 100,000 sat invoice, and the balances update correctly:
{ "capacity": "1000000", "local_balance": "896530", "remote_balance": "100000" }
So I close the channel:
lncli2 closechannel --chan_point "644a50bc8a60976510467e6 c0bb860bf8221d9d1abb918ffeb33ed0055ff9517:0" --sat_per_vbyte 0
After closing the channel, I inspect the transaction outputs:
"vout": [ { "value": 0.00100000, "n": 0, "scriptPubKey": { "address": "bcrt1p7n9x5efymsfsjt0c74zkckcve9y7sh3vxms4wxzgqk47m992lt7sd2djyc" } }, { "value": 0.00890350, "n": 1, "scriptPubKey": { "address": "bcrt1pr49yedmky48lcze5a3u458nh8m0mnlvuwekvxhxurqpwncx9mjpqx93qut" } } ]
Here’s the second problem: 6,000 sats have disappeared.
Questions:
- Why do I need an extra 6,087 sats to open the channel?
- Where do the 6,000 sats go when closing the channel?
--sat_per_vbyte 0
is like not setting it at all. The parameter is ignored when set to 0. Hence it chooses a fee rate on its own. The lowest you can go with LND is--sat_per_vbyte 1
--sat_per_vbyte 50
I get the same 6087 sats. Thank you very much!!!