2024-01-15 13:35:14 -08:00
{
"$schema" : "../rpc-schema-draft.json" ,
"type" : "object" ,
"rpc" : "listfunds" ,
"title" : "Command showing all funds currently managed by the Core Lightning node" ,
"description" : [
"The **listfunds** RPC command displays all funds available, either in unspent outputs (UTXOs) in the internal wallet or funds locked in currently open channels."
] ,
2024-07-22 19:21:49 -07:00
"categories" : [
"readonly"
] ,
2024-01-15 13:35:14 -08:00
"request" : {
"required" : [ ] ,
2024-10-30 09:38:42 +10:30
"additionalProperties" : false ,
2024-01-15 13:35:14 -08:00
"properties" : {
"spent" : {
"type" : "boolean" ,
"description" : [
"If True, then the *outputs* will include spent outputs in addition to the unspent ones."
] ,
"default" : "False"
}
}
} ,
"response" : {
"required" : [
"outputs" ,
"channels"
] ,
2024-10-30 09:38:42 +10:30
"additionalProperties" : false ,
2024-01-15 13:35:14 -08:00
"properties" : {
"outputs" : {
"type" : "array" ,
"items" : {
"type" : "object" ,
"additionalProperties" : true ,
"required" : [
"txid" ,
"output" ,
"amount_msat" ,
"scriptpubkey" ,
"status" ,
"reserved"
] ,
"properties" : {
"txid" : {
"type" : "txid" ,
"description" : [
"The ID of the spendable transaction."
]
} ,
"output" : {
"type" : "u32" ,
"description" : [
"The index within *txid*."
]
} ,
"amount_msat" : {
"type" : "msat" ,
"description" : [
"The amount of the output."
]
} ,
"scriptpubkey" : {
"type" : "hex" ,
"description" : [
"The scriptPubkey of the output."
]
} ,
"address" : {
"type" : "string" ,
"description" : [
"The bitcoin address of the output."
]
} ,
"redeemscript" : {
"type" : "hex" ,
"description" : [
"The redeemscript, only if it's p2sh-wrapped."
]
} ,
"status" : {
"type" : "string" ,
"enum" : [
"unconfirmed" ,
"confirmed" ,
"spent" ,
"immature"
]
} ,
"reserved" : {
"type" : "boolean" ,
"description" : [
"Whether this UTXO is currently reserved for an in-flight tx."
]
}
} ,
"allOf" : [
{
"if" : {
2024-10-30 09:38:42 +10:30
"additionalProperties" : true ,
2024-01-15 13:35:14 -08:00
"properties" : {
"status" : {
"type" : "string" ,
"enum" : [
"confirmed"
]
}
}
} ,
"then" : {
"additionalProperties" : false ,
"required" : [
"blockheight"
] ,
"properties" : {
"txid" : { } ,
"output" : { } ,
"amount_msat" : { } ,
"scriptpubkey" : { } ,
"address" : { } ,
"value" : { } ,
"redeemscript" : { } ,
"status" : { } ,
"reserved" : { } ,
"reserved_to_block" : { } ,
"blockheight" : {
"type" : "u32" ,
"description" : [
"Block height where it was confirmed."
]
}
}
}
} ,
{
"if" : {
2024-10-30 09:38:42 +10:30
"additionalProperties" : true ,
2024-01-15 13:35:14 -08:00
"properties" : {
"reserved" : {
"type" : "boolean" ,
"enum" : [
"true"
]
}
}
} ,
"then" : {
"additionalProperties" : false ,
"required" : [
"reserved_to_block"
] ,
"properties" : {
"txid" : { } ,
"output" : { } ,
"amount_msat" : { } ,
"scriptpubkey" : { } ,
"address" : { } ,
"value" : { } ,
"redeemscript" : { } ,
"status" : { } ,
"blockheight" : { } ,
"reserved" : { } ,
"reserved_to_block" : {
"type" : "u32" ,
"description" : [
"Block height where reservation will expire."
]
}
}
}
}
]
}
} ,
"channels" : {
"type" : "array" ,
"items" : {
"type" : "object" ,
"additionalProperties" : true ,
"required" : [
"peer_id" ,
"our_amount_msat" ,
"amount_msat" ,
"funding_txid" ,
"funding_output" ,
"connected" ,
"state" ,
"channel_id"
] ,
"properties" : {
"peer_id" : {
"type" : "pubkey" ,
"description" : [
"The peer with which the channel is opened."
]
} ,
"our_amount_msat" : {
"type" : "msat" ,
"description" : [
"Available satoshis on our node's end of the channel."
]
} ,
"amount_msat" : {
"type" : "msat" ,
"description" : [
"Total channel value."
]
} ,
"funding_txid" : {
"type" : "txid" ,
"description" : [
"Funding transaction id."
]
} ,
"funding_output" : {
"type" : "u32" ,
"description" : [
"The 0-based index of the output in the funding transaction."
]
} ,
"connected" : {
"type" : "boolean" ,
"description" : [
"Whether the channel peer is connected."
]
} ,
"state" : {
"type" : "string" ,
"enum" : [
"OPENINGD" ,
"CHANNELD_AWAITING_LOCKIN" ,
"CHANNELD_NORMAL" ,
"CHANNELD_SHUTTING_DOWN" ,
"CLOSINGD_SIGEXCHANGE" ,
"CLOSINGD_COMPLETE" ,
"AWAITING_UNILATERAL" ,
"FUNDING_SPEND_SEEN" ,
"ONCHAIN" ,
"DUALOPEND_OPEN_INIT" ,
"DUALOPEND_AWAITING_LOCKIN" ,
2025-02-26 18:41:17 +01:00
"CHANNELD_AWAITING_SPLICE" ,
2024-01-15 13:35:14 -08:00
"DUALOPEND_OPEN_COMMITTED" ,
"DUALOPEND_OPEN_COMMIT_READY"
] ,
"description" : [
"The channel state, in particular `CHANNELD_NORMAL` means the channel can be used normally."
]
} ,
"channel_id" : {
"type" : "hash" ,
"description" : [
"The full channel_id (funding txid Xored with output number)."
] ,
"added" : "v23.05"
}
} ,
"allOf" : [
{
"if" : {
2024-10-30 09:38:42 +10:30
"additionalProperties" : true ,
2024-01-15 13:35:14 -08:00
"properties" : {
"state" : {
"type" : "string" ,
"enum" : [
"CHANNELD_NORMAL"
]
}
}
} ,
"then" : {
"additionalProperties" : false ,
"required" : [
"short_channel_id"
] ,
"properties" : {
"peer_id" : { } ,
"our_amount_msat" : { } ,
"channel_sat" : { } ,
"amount_msat" : { } ,
"channel_total_sat" : { } ,
"funding_txid" : { } ,
"funding_output" : { } ,
"connected" : { } ,
"state" : { } ,
"channel_id" : { } ,
"short_channel_id" : {
"type" : "short_channel_id" ,
"description" : [
"Short channel id of channel."
]
}
}
}
} ,
{
"if" : {
2024-10-30 09:38:42 +10:30
"additionalProperties" : true ,
2024-01-15 13:35:14 -08:00
"properties" : {
"state" : {
"type" : "string" ,
"enum" : [
"CHANNELD_SHUTTING_DOWN" ,
"CLOSINGD_SIGEXCHANGE" ,
"CLOSINGD_COMPLETE" ,
"AWAITING_UNILATERAL" ,
"FUNDING_SPEND_SEEN" ,
"ONCHAIN"
]
}
}
} ,
"then" : {
"additionalProperties" : false ,
"required" : [ ] ,
"properties" : {
"peer_id" : { } ,
"our_amount_msat" : { } ,
"channel_sat" : { } ,
"amount_msat" : { } ,
"channel_total_sat" : { } ,
"funding_txid" : { } ,
"funding_output" : { } ,
"connected" : { } ,
"state" : { } ,
"channel_id" : { } ,
"short_channel_id" : {
"type" : "short_channel_id" ,
"description" : [
"Short channel id of channel (only if funding reached lockin depth before closing)."
]
}
}
}
}
]
}
}
}
} ,
2024-06-20 14:57:02 -07:00
"author" : [
2025-12-17 11:30:56 -08:00
"Felix [fixone@gmail.com](mailto:fixone@gmail.com) is mainly responsible."
2024-06-20 14:57:02 -07:00
] ,
"see_also" : [
"lightning-newaddr(7)" ,
"lightning-fundchannel(7)" ,
"lightning-withdraw(7)" ,
"lightning-listtransactions(7)"
] ,
"resources" : [
2025-12-17 11:30:56 -08:00
"Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
2024-06-20 14:57:02 -07:00
] ,
"examples" : [
2024-01-15 13:35:14 -08:00
{
2024-03-27 18:45:18 -07:00
"request" : {
"id" : "example:listfunds#1" ,
"method" : "listfunds" ,
2024-06-18 14:49:51 -07:00
"params" : { }
2024-03-27 18:45:18 -07:00
} ,
"response" : {
"outputs" : [
{
2024-08-09 22:44:53 -07:00
"txid" : "txid000010000100001000010000100001000010000100001000010000100001" ,
"output" : 2 ,
"amount_msat" : 26000000 ,
"scriptpubkey" : "scriptpubkey01010101010101010101010101010101010101010101010101010101" ,
"address" : "bcrt1p0004040404040404040404040404040404040404040404040404040404" ,
2024-03-27 18:45:18 -07:00
"status" : "confirmed" ,
2024-08-09 22:44:53 -07:00
"blockheight" : 160 ,
2024-03-27 18:45:18 -07:00
"reserved" : false
} ,
{
2024-08-09 22:44:53 -07:00
"txid" : "txid000020000200002000020000200002000020000200002000020000200002" ,
"output" : 3 ,
"amount_msat" : 27000000 ,
"scriptpubkey" : "scriptpubkey02020202020202020202020202020202020202020202020202020202" ,
"address" : "bcrt1p0004040404040404040404040404040404040404040404040404040404" ,
2024-03-27 18:45:18 -07:00
"status" : "confirmed" ,
2024-08-09 22:44:53 -07:00
"blockheight" : 160 ,
2024-07-18 00:28:22 -07:00
"reserved" : false
} ,
{
2024-08-09 22:44:53 -07:00
"txid" : "txid000030000300003000030000300003000030000300003000030000300003" ,
"output" : 4 ,
"amount_msat" : 28000000 ,
"scriptpubkey" : "scriptpubkey03030303030303030303030303030303030303030303030303030303" ,
"address" : "bcrt1p0004040404040404040404040404040404040404040404040404040404" ,
2024-07-18 00:28:22 -07:00
"status" : "confirmed" ,
2024-08-09 22:44:53 -07:00
"blockheight" : 160 ,
2024-03-27 18:45:18 -07:00
"reserved" : false
}
] ,
2024-07-18 00:28:22 -07:00
"channels" : [
{
2024-08-09 22:44:53 -07:00
"peer_id" : "nodeid020202020202020202020202020202020202020202020202020202020202" ,
2024-07-18 00:28:22 -07:00
"connected" : true ,
"state" : "CHANNELD_NORMAL" ,
2024-08-09 22:44:53 -07:00
"channel_id" : "channelid0120000120000120000120000120000120000120000120000120000" ,
2024-07-18 00:28:22 -07:00
"short_channel_id" : "109x1x1" ,
2024-08-09 22:44:53 -07:00
"our_amount_msat" : 36000000 ,
"amount_msat" : 11000000 ,
"funding_txid" : "txid010010100101001010010100101001010010100101001010010100101001" ,
2024-07-18 00:28:22 -07:00
"funding_output" : 1
2024-08-09 22:44:53 -07:00
} ,
{
"peer_id" : "nodeid050505050505050505050505050505050505050505050505050505050505" ,
"connected" : false ,
"state" : "ONCHAIN" ,
"channel_id" : "channelid1300013000130001300013000130001300013000130001300013000" ,
"our_amount_msat" : 37000000 ,
"amount_msat" : 12000000 ,
"funding_txid" : "txid010020100201002010020100201002010020100201002010020100201002" ,
"funding_output" : 2
} ,
{
"peer_id" : "nodeid030303030303030303030303030303030303030303030303030303030303" ,
"connected" : false ,
"state" : "ONCHAIN" ,
"channel_id" : "channelid1100011000110001100011000110001100011000110001100011000" ,
"our_amount_msat" : 38000000 ,
"amount_msat" : 13000000 ,
"funding_txid" : "txid010030100301003010030100301003010030100301003010030100301003" ,
"funding_output" : 3
2024-07-18 00:28:22 -07:00
}
]
2024-03-27 18:45:18 -07:00
}
2024-01-15 13:35:14 -08:00
}
]
}