LIGHTNING-TXPREPARE(7)
πΈ lightning-txprepare(7) β the βget ready to withdrawβ bestie manual πΈ
Okay so bestie, this is the manual for lightning-txprepare(7) β the page all about txprepare. Itβs giving βprep the transaction, donβt send it yet,β and honestly? iconic. π
πΈ NAME πΈ
txprepare β Command to prepare to withdraw funds from the internal wallet. π
β¨ SYNOPSIS β¨
txprepare outputs [feerate] [minconf] [utxos]
π¦ DESCRIPTION π¦
Okay so txprepare is the RPC command that creates an unsigned transaction. It spends funds from Core Lightningβs internal wallet to the outputs you specify. No cap, thatβs the whole job. πΈ
txprepare is similar to the first part of a withdraw command, but it supports multiple outputs and uses outputs as the parameter. The second part is provided by txsend. Periodt. β¨
outputs(array of outputdescs): Format is like:[{destination1: amount1}, {destination2: amount2}]or[{destination: *all*}]. It supports any number of confirmed outputs. Yes, any number β slay.- (
outputdesc, optional)
- (
feerate(feerate, optional): Used for the transaction as initial feerate. The default isnormal.minconf(u32, optional): The minimum number of confirmations that used outputs should have. The default is1.utxos(array of outpoints, optional): To be used to fund the transaction, as an array oftxid:vout. These must be drawn from the nodeβs available UTXO set.- (
outpoint, optional)
- (
π RETURN VALUE π
On success, an object is returned, containing:
psbt(string): The PSBT representing the unsigned transaction.unsigned_tx(hex): The unsigned transaction.txid(txid): The transaction id ofunsigned_tx; you hand this tolightning-txsend(7)orlightning-txdiscard(7), as the inputs of this transaction are reserved. iykyk β those inputs are spoken for. π«Ά
π ERRORS π
On failure, an error is reported and the transaction is not created. No transaction, no vibes. π
-1: Catchall nonspecific error.301: There are not enough funds in the internal wallet (including fees) to create the transaction.302: The dust limit is not met.
π«Ά AUTHOR π«Ά
Rusty Russell rusty@rustcorp.com.au is mainly responsible. Thank you Rusty, king. π
π SEE ALSO π
π§ RESOURCES π§
Main web site: https://github.com/ElementsProject/lightning
π EXAMPLES π
Example 1:
Request:
$ lightning-cli txprepare "[{'bcrt1p0002020202020202020202020202020202020202020202020202020202': 16777216}]"
{
"id": "example:txprepare#1",
"method": "txprepare",
"params": [
[
{
"bcrt1p0002020202020202020202020202020202020202020202020202020202": 16777216
}
]
]
}
Response:
{
"unsigned_tx": "0200000000000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006",
"txid": "txidtxprep000100001000010000100001000010000100001000010000100001",
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000"
}
Example 2:
Request:
$ lightning-cli txprepare -k "outputs"='[{"bcrt1p0003030303030303030303030303030303030303030303030303030303": 16777216}]'
{
"id": "example:txprepare#2",
"method": "txprepare",
"params": {
"outputs": [
{
"bcrt1p0003030303030303030303030303030303030303030303030303030303": 16777216
}
]
}
}
Response:
{
"unsigned_tx": "020000000000020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002",
"txid": "txidtxprep000200002000020000200002000020000200002000020000200002",
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000"
}
β¨ Thatβs the whole page, bestie! Source/version: Core Lightning v26.06.9 Β· manual page: LIGHTNING-TXPREPARE(7) Β· date: not listed in the footer, so weβre not making one up. π
π¦ 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