LIGHTNING-FUNDCHANNEL(7)
π NAME π
okay so bestie, welcome to LIGHTNING-FUNDCHANNEL(7) β the manual page for fundchannel, aka literally the command for establishing a lightning channel. main character energy fr fr. π
fundchannel β Command for establishing a lightning channel. no cap, that's the whole NAME vibe. β¨
β¨ SYNOPSIS β¨
fundchannel id amount [feerate] [announce] [minconf] [push_msat]
[close_to] [request_amt] [compact_lease] [utxos] [mindepth] [reserve]
[channel_type]
πΈ DESCRIPTION πΈ
The fundchannel RPC command opens a payment channel with a peer by committing a funding transaction to the blockchain as defined in BOLT #2. that's the whole plot, and it's giving iconic. π¦
If not already connected, fundchannel will automatically attempt to connect if Core Lightning knows a way to contact the node (either from normal gossip, or from a previous connect call).
This auto-connection can fail if Core Lightning does not know how to contact the target node; see lightning-connect(7). yes bestie, go read that one too. π
Once the transaction is confirmed, normal channel operations may begin. Readiness is indicated by listpeers reporting a state of CHANNELD_NORMAL for the channel. that's the vibe check: CHANNELD_NORMAL = we're so back. β¨
here are the parameters, glowing and labeled:
id(pubkey) β Theidis the peer id obtained fromconnect.amount(sat_or_all) β The amount in satoshis taken from the internal wallet to fund the channel (but if we have any anchor channels, this will always leave at leastmin-emergency- msatas change). The stringallcan be used to specify all available funds (may be restricted by theutxosparameter, and limited to16777215satoshi if large channels were not negotiated with the peer). Otherwise, it is in satoshi precision; it can be a whole number, a whole number ending insat, a whole number ending in000msat, or a number with 1 to 8 decimal places ending inbtc. The value cannot be less than the dust limit, currently set to546, nor more than16777215satoshi (unless large channels were negotiated with the peer).feerate(feerate, optional) β Used for the opening transaction and (unlessoption_anchorsis negotiated), as initial feerate for commitment and HTLC transactions (see NOTES inlightning-feerates(7)). The default isnormal.announce(boolean, optional) β Whether to announce this channel or not. An unannounced channel is considered private. The default isTrue.minconf(u32, optional) β The minimum number of confirmations that used outputs should have. The default is1.push_msat(msat, optional) β The amount of millisatoshis to push to the channel peer at open. Note that this is a gift to the peer -- these satoshis are added to the initial balance of the peer at channel start and are largely unrecoverable once pushed.close_to(string, optional) β A Bitcoin address to which the channel funds should be sent to on close. Only valid if both peers have negotiatedoption_upfront_shutdown_script. Returnsclose_toset to closing script iff is negotiated.request_amt(sat, optional) β An amount of liquidity you'd like to lease from the peer. If peer supportsoption_will_fund, indicates to them to include this much liquidity into the channel. Must also pass incompact_lease.compact_lease(string, optional) β A compact representation of the peer's expected channel lease terms. If the peer's terms don't match this set, we will fail to open the channel. πutxos(array of outpoints, optional) β The utxos to be used to fund the channel, as an array oftxid:vout.- (
outpoint, optional)
- (
mindepth(u32, optional) β Number of confirmations required before we consider the channel active.reserve(sat, optional) β The amount we want the peer to maintain on its side of the channel. It can be a whole number, a whole number ending insat, a whole number ending in000msat, or a number with 1 to 8 decimal places ending inbtc. The default is1%of the funding amount.channel_type(array of u32s, optional) (added v24.02):- (
u32, optional) β Represents the explicit channel type to request. There is currently no sanity checking on this value so if you use strange values and your channel breaks, you get to keep both pieces. BOLT 2 defines the following value types:
- (
The currently defined basic types are:
option_static_remotekey(bit 12).option_anchorsandoption_static_remotekey(bits 22 and 12).
Each basic type has the following variations allowed:
option_scid_alias(bit 46).option_zeroconf(bit 50).
β οΈ bestie warning:push_msatis a gift to the peer β these satoshis are added to the initial balance of the peer at channel start and are largely unrecoverable once pushed. π π also,channel_typehas no sanity checking on itsu32value: use strange values and your channel breaks, you get to keep both pieces.
π RETURN VALUE π
On success, an object is returned, containing:
tx(hex) β The raw transaction which funded the channel.txid(txid) β The txid of the transaction which funded the channel.outnum(u32) β The 0-based output index showing which output funded the channel.channel_id(hash) β Thechannel_idof the resulting channel.channel_type(object) βChannel_typeas negotiated with peer. (added v24.02):bits(array of u32s) β Each bit set in thischannel_type. (added v24.02):- (
u32, optional) β Bit number.
- (
names(array of strings) β Feature name for each bit set in thischannel_type. Note thatanchors_zero_fee_htlc_txis a deprecated synonym foranchors. (added v24.02):- (
string, optional) (one of"static_remotekey/even","anchor_outputs/even","anchors_zero_fee_htlc_tx/even","anchors/even","scid_alias/even","zeroconf/even") β Name of feature bit.
- (
close_to(hex, optional) β The rawscriptPubkeywhich mutual close will go to; only present ifclose_toparameter was specified and peer supportsoption_upfront_shutdown_script.mindepth(u32, optional) β Number of confirmations before we consider the channel active.
π ERRORS π
The following error codes may occur:
-1β Catchall nonspecific error.300β The maximum allowed funding amount is exceeded.301β There are not enough funds in the internal wallet (including fees) to create the transaction.302β The output amount is too small, and would be considered dust.303β Broadcasting of the funding transaction failed, the internal call tobitcoin-clireturned with an error.313β Themin-emergency-msatreserve not be preserved (and we have or are opening anchor channels).
Failure may also occur if lightningd and the peer cannot agree on channel parameters (funding limits, channel reserves, fees, etc.).
π¦ SEE ALSO π¦
lightning-connect(7), lightning-listfunds(), lightning-listpeers(7), lightning-feerates(7), lightning-multifundchannel(7)
π RESOURCES π
Main web site: https://github.com/ElementsProject/lightning
π EXAMPLES π
Example 1:
Request:
$ lightning-cli fundchannel -k "id"="nodeid050505050505050505050505050505050505050505050505050505050505" "amount"=1000000 "announce"=True
{
"id": "example:fundchannel#1",
"method": "fundchannel",
"params": {
"id": "nodeid050505050505050505050505050505050505050505050505050505050505",
"amount": 1000000,
"announce": true
}
}
Response:
{
"tx": "020000000000305fundchanneltx350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000350003500035000",
"txid": "channeltxid350000350000350000350000350000350000350000350000350000",
"channel_id": "channelid0350000350000350000350000350000350000350000350000350000",
"channel_type": {
"bits": [
12,
22
],
"names": [
"static_remotekey/even",
"anchors/even"
]
},
"outnum": 1
}
Example 2: This example shows how to to open new channel with peer 1 from one whole utxo (you can use listfunds command to get txid and vout):
Request:
$ lightning-cli fundchannel -k "id"="nodeid010101010101010101010101010101010101010101010101010101010101" "amount"="all" "feerate"="normal" "push_msat"=100000 "utxos"='["channeltxid350000350000350000350000350000350000350000350000350000:1"]'
{
"id": "example:fundchannel#2",
"method": "fundchannel",
"params": {
"id": "nodeid010101010101010101010101010101010101010101010101010101010101",
"amount": "all",
"feerate": "normal",
"push_msat": 100000,
"utxos": [
"channeltxid350000350000350000350000350000350000350000350000350000:1"
]
}
}
Response:
{
"tx": "020000000000401fundchanneltx410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000410004100041000",
"txid": "channeltxid410000410000410000410000410000410000410000410000410000",
"channel_id": "channelid0410000410000410000410000410000410000410000410000410000",
"channel_type": {
"bits": [
12,
22
],
"names": [
"static_remotekey/even",
"anchors/even"
]
},
"outnum": 1
}
okay bestie, that's the whole LIGHTNING-FUNDCHANNEL(7) glow-up π footer vibes: Core Lightning v26.06.9 + LIGHTNING-FUNDCHANNEL(7) β no invented date, because the footer didn't give us one, and we don't make things up. periodt. π π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: clightning 26.06.9
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms