mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
479 lines
20 KiB
JSON
479 lines
20 KiB
JSON
{
|
|
"$schema": "../rpc-schema-draft.json",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"rpc": "multifundchannel",
|
|
"title": "Command for establishing many lightning channels",
|
|
"description": [
|
|
"The **multifundchannel** RPC command opens multiple payment channels with nodes by committing a single funding transaction to the blockchain that is shared by all channels.",
|
|
"",
|
|
"If not already connected, **multifundchannel** will automatically attempt to connect; you may provide a *@host:port* hint appended to the node ID so that Core Lightning can learn how to connect to the node; see lightning-connect(7).",
|
|
"",
|
|
"Once the transaction is confirmed, normal channel operations may begin. Readiness is indicated by **listpeers** reporting a *state* of `CHANNELD_NORMAL` for the channel."
|
|
],
|
|
"request": {
|
|
"required": [
|
|
"destinations"
|
|
],
|
|
"properties": {
|
|
"destinations": {
|
|
"type": "array",
|
|
"description": [
|
|
"There must be at least one entry in *destinations*; it cannot be an empty array."
|
|
],
|
|
"items": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"id",
|
|
"amount"
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": [
|
|
"Node ID, with an optional *@host:port* appended to it in a manner understood by **connect**; see lightning-connect(7). Each entry in the *destinations* array must have a unique node *id*. If not already connected, **multifundchannel** will automatically attempt to connect to the node."
|
|
]
|
|
},
|
|
"amount": {
|
|
"type": "sat_or_all",
|
|
"description": [
|
|
"Amount in satoshis taken from the internal wallet to fund the channel (but if we have any anchor channels, this will always leave at least `min-emergency-msat` as change). The string *all* can be used to specify all available funds (or 16,777,215 satoshi if more is available and large channels were not negotiated with the peer). Otherwise it is in satoshi precision; it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*. The value cannot be less than the dust limit, currently 546 satoshi as of this writing, nor more than 16,777,215 satoshi (unless large channels were negotiated with the peer)."
|
|
]
|
|
},
|
|
"announce": {
|
|
"type": "boolean",
|
|
"description": [
|
|
"Flag that indicates whether to announce the channel with this. If set to `False`, the channel is unpublished."
|
|
],
|
|
"default": "`True`"
|
|
},
|
|
"push_msat": {
|
|
"type": "msat",
|
|
"description": [
|
|
"Amount of millisatoshis to outright give to the node. This is a gift to the peer, and you do not get a proof-of-payment out of this."
|
|
]
|
|
},
|
|
"close_to": {
|
|
"type": "string",
|
|
"description": [
|
|
"Bitcoin address to which the channel funds should be sent to on close. Only valid if both peers have negotiated `option_upfront_shutdown_script` Returns `close_to` set to closing script iff is negotiated."
|
|
]
|
|
},
|
|
"request_amt": {
|
|
"type": "sat",
|
|
"description": [
|
|
"Amount of liquidity you'd like to lease from peer. If peer supports `option_will_fund`, indicates to them to include this much liquidity into the channel. Must also pass in *compact_lease*."
|
|
]
|
|
},
|
|
"compact_lease": {
|
|
"type": "string",
|
|
"description": [
|
|
"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 to this destination."
|
|
]
|
|
},
|
|
"mindepth": {
|
|
"type": "u32",
|
|
"description": [
|
|
"Number of confirmations before we consider the channel active."
|
|
]
|
|
},
|
|
"reserve": {
|
|
"type": "sat",
|
|
"description": [
|
|
"Amount we want the peer to maintain on its side of the channel. It can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
|
|
],
|
|
"default": "1% of the funding amount"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"feerate": {
|
|
"type": "feerate",
|
|
"description": [
|
|
"Feerate used for the opening transaction, and if *commitment_feerate* is not set, as initial feerate for commitment and HTLC transactions. See NOTES in lightning-feerates(7) for possible values."
|
|
],
|
|
"default": "*normal*"
|
|
},
|
|
"minconf": {
|
|
"type": "integer",
|
|
"description": [
|
|
"Minimum number of confirmations that used outputs should have."
|
|
],
|
|
"default": 1
|
|
},
|
|
"utxos": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "outpoint",
|
|
"description": [
|
|
"Utxos to be used to fund the channel, as an array of `txid:vout`."
|
|
]
|
|
}
|
|
},
|
|
"minchannels": {
|
|
"type": "integer",
|
|
"description": [
|
|
"Re-attempt funding as long as at least this many peers remain (must not be zero). The **multifundchannel** command will only fail if too many peers fail the funding process."
|
|
]
|
|
},
|
|
"commitment_feerate": {
|
|
"type": "feerate",
|
|
"description": [
|
|
"Initial feerate for commitment and HTLC transactions. See *feerate* for valid values."
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"response": {
|
|
"required": [
|
|
"tx",
|
|
"txid",
|
|
"channel_ids"
|
|
],
|
|
"properties": {
|
|
"tx": {
|
|
"type": "hex",
|
|
"description": [
|
|
"The raw transaction which funded the channel."
|
|
]
|
|
},
|
|
"txid": {
|
|
"type": "txid",
|
|
"description": [
|
|
"The txid of the transaction which funded the channel."
|
|
]
|
|
},
|
|
"channel_ids": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"id",
|
|
"channel_id",
|
|
"channel_type",
|
|
"outnum"
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "pubkey",
|
|
"description": [
|
|
"The peer we opened the channel with."
|
|
]
|
|
},
|
|
"outnum": {
|
|
"type": "u32",
|
|
"description": [
|
|
"The 0-based output index showing which output funded the channel."
|
|
]
|
|
},
|
|
"channel_id": {
|
|
"type": "hash",
|
|
"description": [
|
|
"The channel_id of the resulting channel."
|
|
]
|
|
},
|
|
"channel_type": {
|
|
"type": "object",
|
|
"description": [
|
|
"Channel_type as negotiated with peer."
|
|
],
|
|
"added": "v24.02",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"bits",
|
|
"names"
|
|
],
|
|
"properties": {
|
|
"bits": {
|
|
"type": "array",
|
|
"description": [
|
|
"Each bit set in this channel_type."
|
|
],
|
|
"added": "v24.02",
|
|
"items": {
|
|
"type": "u32",
|
|
"description": [
|
|
"Bit number."
|
|
]
|
|
}
|
|
},
|
|
"names": {
|
|
"type": "array",
|
|
"description": [
|
|
"Feature name for each bit set in this channel_type. Note that *anchors_zero_fee_htlc_tx* is a deprecated synonym for *anchors*."
|
|
],
|
|
"added": "v24.02",
|
|
"items": {
|
|
"type": "string",
|
|
"enum": [
|
|
"static_remotekey/even",
|
|
"anchor_outputs/even",
|
|
"anchors_zero_fee_htlc_tx/even",
|
|
"anchors/even",
|
|
"scid_alias/even",
|
|
"zeroconf/even"
|
|
],
|
|
"description": [
|
|
"Name of feature bit."
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"close_to": {
|
|
"type": "hex",
|
|
"description": [
|
|
"The raw scriptPubkey which mutual close will go to; only present if *close_to* parameter was specified and peer supports `option_upfront_shutdown_script`."
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"failed": {
|
|
"type": "array",
|
|
"description": [
|
|
"Any peers we failed to open with (if *minchannels* was specified less than the number of destinations)."
|
|
],
|
|
"items": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"id",
|
|
"method",
|
|
"error"
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "pubkey",
|
|
"description": [
|
|
"The peer we failed to open the channel with."
|
|
]
|
|
},
|
|
"method": {
|
|
"type": "string",
|
|
"enum": [
|
|
"connect",
|
|
"openchannel_init",
|
|
"fundchannel_start",
|
|
"fundchannel_complete"
|
|
],
|
|
"description": [
|
|
"What stage we failed at."
|
|
]
|
|
},
|
|
"error": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"code",
|
|
"message"
|
|
],
|
|
"properties": {
|
|
"code": {
|
|
"type": "integer",
|
|
"description": [
|
|
"JSON error code from failing stage."
|
|
]
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"description": [
|
|
"Message from stage."
|
|
]
|
|
},
|
|
"data": {
|
|
"untyped": true,
|
|
"description": [
|
|
"Additional error data."
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"pre_return_value_notes": [
|
|
"This command opens multiple channels with a single large transaction, thus only one transaction is returned.",
|
|
"",
|
|
"If *minchannels* was specified and is less than the number of destinations, then it is possible that one or more of the destinations do not have a channel even if **multifundchannel** succeeded."
|
|
],
|
|
"post_return_value_notes": [
|
|
"On failure, none of the channels are created."
|
|
]
|
|
},
|
|
"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 to bitcoin-cli returned with an error.",
|
|
"- 313: The `min-emergency-msat` reserve 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 lightning-fundchannel_start(7) and lightning-fundchannel_complete(7).",
|
|
"",
|
|
"There may be rare edge cases where a communications failure later in the channel funding process will cancel the funding locally, but the peer thinks the channel is already waiting for funding lockin. In that case, the next time we connect to the peer, our node will tell the peer to forget the channel, but some nodes (in particular, Core Lightning nodes) will disconnect when our node tells them to forget the channel. If you immediately **multifundchannel** with that peer, it could trigger this connect-forget-disconnect behavior, causing the second **multifundchannel** to fail as well due to disconnection. Doing a **connect** with the peers separately, and waiting for a few seconds, should help clear this hurdle; running **multifundchannel** a third time would also clear this."
|
|
],
|
|
"author": [
|
|
"ZmnSCPxj <<ZmnSCPxj@protonmail.com>> is mainly responsible."
|
|
],
|
|
"see_also": [
|
|
"lightning-connect(7)",
|
|
"lightning-listfunds()",
|
|
"lightning-listpeers(7)",
|
|
"lightning-fundchannel(7)"
|
|
],
|
|
"resources": [
|
|
"Main web site: <https://github.com/ElementsProject/lightning>"
|
|
],
|
|
"examples": [
|
|
{
|
|
"description": [
|
|
"This example opens three channels at once, with amounts 20,000 sats, 30,000 sats",
|
|
"and the final channel using all remaining funds (actually, capped at 16,777,215 sats",
|
|
"because large-channels is not enabled):"
|
|
],
|
|
"request": {
|
|
"id": "example:multifundchannel#1",
|
|
"method": "multifundchannel",
|
|
"params": {
|
|
"destinations": [
|
|
{
|
|
"id": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d@127.0.0.1:34785",
|
|
"amount": "20000sat"
|
|
},
|
|
{
|
|
"id": "0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199@127.0.0.1:46213",
|
|
"amount": "0.0003btc"
|
|
},
|
|
{
|
|
"id": "032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e@127.0.0.1:38251",
|
|
"amount": "all"
|
|
}
|
|
],
|
|
"feerate": "10000perkw",
|
|
"commitment_feerate": "2000perkw"
|
|
}
|
|
},
|
|
"response": {
|
|
"tx": "02000000000107feed56fc07fe7a3094f5f7c104f4ac8f3c96f6bf7c44df90619307d6f75c06850200000000fdffffff72819eb0ce9892c1025fd83e5e1a39fd30f79f843b489a32c20f45e67f37c5f30100000000fdffffff187f8d1b7292d57a46e23ae746c530741b8493dff74a7f62ca7e200204f6ec800000000000fdfffffffeed56fc07fe7a3094f5f7c104f4ac8f3c96f6bf7c44df90619307d6f75c06850100000000fdffffff07e45ab0c8dc4bc9a42d260c71f3a722bd104e28623693e84e302eb62b8554940000000000fdffffff187f8d1b7292d57a46e23ae746c530741b8493dff74a7f62ca7e200204f6ec800700000000fdffffff187f8d1b7292d57a46e23ae746c530741b8493dff74a7f62ca7e200204f6ec800400000000fdffffff040a8b250700000000220020f7bbe8f915381b4b9b1ca14cccbfd156eea19888550d01a5014f977e98c7fc8c204e000000000000220020369444aad3ac8c5452be625479f761587c42fbf66fecf644447daabc73c498223075000000000000220020d90c23ede7b77f89f4cae93da9326ba176d158a0b65faeaede5684c3c0f7c839a86100000000000022512018ece00b736f9ed77ed3a87426643c242223e3d6116a4cd6d90946f73de2ce71024730440220296f0d677ae2151a2fceb00c717483488f46aff309e28f36934ec3bcf914443f02204a7a20186d9b936e029c6b55df302386ad306f6738176945cf5d8607c18d16c7012102272a9a25f1ffed52fab04a2cc88aeab135b53723856a8f1481c26417f88a922e02473044022063c77ad73bd1993abc48b04b2f7b66ab7aa34f56f55c69b1c3e1868a4580554c0220466333d7e6e9163ec6ad6ef755be6e61a79a6a50ac8ad32d071b2819f2a113a60121029da47016812598be384212ce15793496c0ec2176a87e81c6432dae964f87c9870247304402205dfb4fcf67b12cf0fc3a1f3527bc37964c1604fb7ac11df2fd80b2bde605689d02203bbd1bcf5f92a6cd31c9459c9252d84fcd102fdfc8e367360e71ef047c704015012103d034f788f410c2ec2d89d161df3c3715f965248aa53eace463d10eca443eb1f20247304402203b12894f094c85c94bf7a898ddfe8d82359486aedb56b0891e5db83fee628dff0220478b954fd0514de5ff0d3273ed93d54f87e7d90e63f2d4b478a9a7669af2e1110121028a599168d3c97debc71bc66e6270ecf054f300d888309ba05471a482175dd9300140508f9706e9d6353d0a19a9128353fc8090948de09ee79afc35ae10c17ab0f894ec04eabf9187082bd31d3b63e9e52d99cbaef4c1f79dd6121024a7d3b4d994ec014054bdc1bab81661fd3ad8c0a65402abf2c2228da8f2150b6ce0cb8fddafd4c25a0318cc16cdbf72c5142dd6bbccb606cc7c2c39f91a218309dc5dadb7a74fe56b024730440220203ba0cc960cb70555e2096ecba5a5992b6b35ff621f736625360f836d208ce202207fa53d5ac33847fc166e03d888ef27c709dc65bfb79ece85d9d93bdda62c0ca501210267f4468ffafe6f919ae871f57f09690467f494e83e0358dc64d10472f9072f4c9b000000",
|
|
"txid": "9c3d4a6491eaa04c378101a7a7836f07409d04db8295b14930f89f7562744e18",
|
|
"channel_ids": [
|
|
{
|
|
"id": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
|
|
"channel_id": "a9c39915cfa357205e3597ec62d92c541a2be7f44b9c6292e126aeddb11bf97e",
|
|
"channel_type": {
|
|
"bits": [
|
|
12,
|
|
22
|
|
],
|
|
"names": [
|
|
"static_remotekey/even",
|
|
"anchors/even"
|
|
]
|
|
},
|
|
"outnum": 1
|
|
},
|
|
{
|
|
"id": "0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199",
|
|
"channel_id": "a4a379248e49d207cc984646e632e1a31105a85708b9d6d961a5018fdd489f5a",
|
|
"channel_type": {
|
|
"bits": [
|
|
12,
|
|
22
|
|
],
|
|
"names": [
|
|
"static_remotekey/even",
|
|
"anchors/even"
|
|
]
|
|
},
|
|
"outnum": 2
|
|
},
|
|
{
|
|
"id": "032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e",
|
|
"channel_id": "e13472d6512413eb1bf03b9a0bb391d0e4152fd337fa6d1014e3de5e131918d9",
|
|
"channel_type": {
|
|
"bits": [
|
|
12,
|
|
22
|
|
],
|
|
"names": [
|
|
"static_remotekey/even",
|
|
"anchors/even"
|
|
]
|
|
},
|
|
"outnum": 0
|
|
}
|
|
],
|
|
"failed": []
|
|
}
|
|
},
|
|
{
|
|
"request": {
|
|
"id": "example:multifundchannel#2",
|
|
"method": "multifundchannel",
|
|
"params": {
|
|
"destinations": [
|
|
{
|
|
"id": "03a389b3a2f7aa6f9f4ccc19f2bd7a2eba83596699e86b715caaaa147fc37f3144@127.0.0.1:34785",
|
|
"amount": 50000
|
|
},
|
|
{
|
|
"id": "0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199@127.0.0.1:46213",
|
|
"amount": 50000
|
|
},
|
|
{
|
|
"id": "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518@127.0.0.1:39877",
|
|
"amount": 50000
|
|
}
|
|
],
|
|
"minchannels": 1
|
|
}
|
|
},
|
|
"response": {
|
|
"tx": "0200000000010289da71f14f2e28c351f3f2cea6c9008fbf316cd353f6a084a17851afd37e5be70000000000fdffffffdcb684b96d9a2a37ef441c5eca75d15ef35ca8e16a6df21dca5fb6558400ca840000000000fdffffff022610250700000000225120def24e878a66b695c4d5b414b42b7ce94471dac985bb0afb0367e8bbb92c5a5250c30000000000002200209bd3269fda069b7ee0584622d458bb437635b3a179265dee3843ef18f42f35c601404a5e8638f6961d1c42609a5497346af9ba4cffb7f44cc8869c7e158627a8bb35884652fe1927d0b1917e9c22328339c33adedf93a7c86d90edba49eef4d949f301400373733215aeb64ca95e21b16be5772d3ad2ba7fa92faf842eeffab2c5741a66076cd1fb8af1c6c65456eeaf05f9ac80ce5502ae3ff88c40b632d8785bcd63799c000000",
|
|
"txid": "313dc9366eeab30a094fb85297673187cfb93aec0ec8610215f75d129d7c06e9",
|
|
"channel_ids": [
|
|
{
|
|
"id": "0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199",
|
|
"channel_id": "09eb55872cd9039ecd08281af756e23b15aad4129fd6a9bcd71b472114ebf43a",
|
|
"channel_type": {
|
|
"bits": [
|
|
12,
|
|
22
|
|
],
|
|
"names": [
|
|
"static_remotekey/even",
|
|
"anchors/even"
|
|
]
|
|
},
|
|
"outnum": 1
|
|
}
|
|
],
|
|
"failed": [
|
|
{
|
|
"id": "03a389b3a2f7aa6f9f4ccc19f2bd7a2eba83596699e86b715caaaa147fc37f3144",
|
|
"method": "connect",
|
|
"error": {
|
|
"code": 401,
|
|
"message": "All addresses failed: 127.0.0.1:34785: Cryptographic handshake: peer closed connection (wrong key?). "
|
|
}
|
|
},
|
|
{
|
|
"id": "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518",
|
|
"method": "connect",
|
|
"error": {
|
|
"code": 402,
|
|
"message": "disconnected during connection"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|