2024-01-15 13:35:14 -08:00
{
"$schema" : "../rpc-schema-draft.json" ,
"type" : "object" ,
"rpc" : "txprepare" ,
"title" : "Command to prepare to withdraw funds from the internal wallet" ,
"description" : [
"The **txprepare** RPC command creates an unsigned transaction which spends funds from Core Lightning's internal wallet to the outputs specified in *outputs*." ,
"" ,
"**txprepare** is similar to the first part of a **withdraw** command, but supports multiple outputs and uses *outputs* as parameter. The second part is provided by **txsend**."
] ,
"request" : {
"required" : [
"outputs"
] ,
2024-10-30 09:38:42 +10:30
"additionalProperties" : false ,
2024-01-15 13:35:14 -08:00
"properties" : {
"outputs" : {
"type" : "array" ,
"description" : [
"Format is like: [{destination1: amount1}, {destination2: amount2}] or [{destination: *all*}]. It supports any number of **confirmed** outputs."
] ,
"items" : {
"type" : "outputdesc"
}
} ,
"feerate" : {
"type" : "feerate" ,
"description" : [
"Used for the transaction as initial feerate."
] ,
"default" : "*normal*"
} ,
"minconf" : {
"type" : "u32" ,
"description" : [
"The minimum number of confirmations that used outputs should have."
] ,
"default" : 1
} ,
"utxos" : {
"type" : "array" ,
"description" : [
"To be used to fund the transaction, as an array of `txid:vout`. These must be drawn from the node's available UTXO set."
] ,
"items" : {
"type" : "outpoint"
}
}
}
} ,
"response" : {
"required" : [
"psbt" ,
"unsigned_tx" ,
"txid"
] ,
2024-10-30 09:38:42 +10:30
"additionalProperties" : false ,
2024-01-15 13:35:14 -08:00
"properties" : {
"psbt" : {
"type" : "string" ,
"description" : [
"The PSBT representing the unsigned transaction."
]
} ,
"unsigned_tx" : {
"type" : "hex" ,
"description" : [
"The unsigned transaction."
]
} ,
"txid" : {
"type" : "txid" ,
"description" : [
"The transaction id of *unsigned_tx*; you hand this to lightning-txsend(7) or lightning-txdiscard(7), as the inputs of this transaction are reserved."
]
}
}
} ,
"errors" : [
"On failure, an error is reported and the transaction is not created." ,
"" ,
"- -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."
] ,
2024-06-20 14:57:02 -07:00
"author" : [
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
] ,
"see_also" : [
"lightning-withdraw(7)" ,
"lightning-txsend(7)" ,
"lightning-txdiscard(7)" ,
"lightning-feerates(7)"
] ,
"resources" : [
"Main web site: <https://github.com/ElementsProject/lightning>"
] ,
"examples" : [
2024-01-15 13:35:14 -08:00
{
2024-03-27 18:45:18 -07:00
"request" : {
"id" : "example:txprepare#1" ,
"method" : "txprepare" ,
2024-07-18 00:28:22 -07:00
"params" : [
[
2024-03-27 18:45:18 -07:00
{
2024-07-18 00:28:22 -07:00
"bcrt1q5ptrvwlgcldm2ygf3nzsl09zfpp7dmtduqlczer97xvc4x5z5zwsc2ulv4" : 16777216
2024-03-27 18:45:18 -07:00
}
2024-06-18 14:49:51 -07:00
]
2024-07-18 00:28:22 -07:00
]
2024-03-27 18:45:18 -07:00
} ,
"response" : {
2024-07-18 00:28:22 -07:00
"unsigned_tx" : "0200000001974bc23173b7bca9b060dac12abd1bb158e8ed69a3e74d4f6af5919b15f5772c0100000000fdffffff020000000100000000220020a056363be8c7dbb511098cc50fbca24843e6ed6de03f816465f1998a9a82a09d4183980000000000225120f1393467c717cd50de2760167d4311141a8f750c89f54fd2c900601a7da8434c95000000" ,
"txid" : "cafef1e6936d05584c8406e9ec5e9631b03513fe8b2a0444c5824e1a1f3d7c67" ,
"psbt" : "cHNidP8BAgQCAAAAAQMElQAAAAEEAQEBBQECAQYBAwH7BAIAAAAAAQBxAgAAAAFpz79e9wou5mbmtaiB+6WfRTf8SpZxmrd6n+rIFcWewQAAAAAA/f///wLS79/eAAAAABYAFE35CMxYA4yQx9XLuFj0/q5uNmligJaYAQAAAAAWABT/hTPq8LE5vAc9KiJjjmygoIN81UsAAAABAR+AlpgBAAAAABYAFP+FM+rwsTm8Bz0qImOObKCgg3zVAQ4gl0vCMXO3vKmwYNrBKr0bsVjo7Wmj501PavWRmxX1dywBDwQBAAAAARAE/f///wABAwgAAAABAAAAAAEEIgAgoFY2O+jH27URCYzFD7yiSEPm7W3gP4FkZfGZipqCoJ0AAQMIQYOYAAAAAAABBCJRIPE5NGfHF81Q3idgFn1DERQaj3UMifVP0skAYBp9qENMAA=="
2024-01-15 13:35:14 -08:00
}
} ,
{
2024-03-27 18:45:18 -07:00
"request" : {
"id" : "example:txprepare#2" ,
"method" : "txprepare" ,
"params" : {
"outputs" : [
{
2024-07-18 00:28:22 -07:00
"bcrt1q4hz6a4gtecfmy8z870cwkq2gzc0t7n9u9pu23689u55ghwewemqsv4v2zs" : 16777216
2024-03-27 18:45:18 -07:00
}
2024-06-18 14:49:51 -07:00
]
2024-03-27 18:45:18 -07:00
}
} ,
"response" : {
2024-07-18 00:28:22 -07:00
"unsigned_tx" : "0200000001974bc23173b7bca9b060dac12abd1bb158e8ed69a3e74d4f6af5919b15f5772c0100000000fdffffff020000000100000000220020adc5aed50bce13b21c47f3f0eb0148161ebf4cbc2878a8e8e5e5288bbb2ecec1418398000000000022512081da0d3e3051135a89e2f9d85e2eadf661f959bfb05e671097854672cfd0ac7d95000000" ,
"txid" : "ed6c309a10273aa036d29b71cf70202291d4d4b72be353ac410e1678ecfbf74e" ,
"psbt" : "cHNidP8BAgQCAAAAAQMElQAAAAEEAQEBBQECAQYBAwH7BAIAAAAAAQBxAgAAAAFpz79e9wou5mbmtaiB+6WfRTf8SpZxmrd6n+rIFcWewQAAAAAA/f///wLS79/eAAAAABYAFE35CMxYA4yQx9XLuFj0/q5uNmligJaYAQAAAAAWABT/hTPq8LE5vAc9KiJjjmygoIN81UsAAAABAR+AlpgBAAAAABYAFP+FM+rwsTm8Bz0qImOObKCgg3zVAQ4gl0vCMXO3vKmwYNrBKr0bsVjo7Wmj501PavWRmxX1dywBDwQBAAAAARAE/f///wABAwgAAAABAAAAAAEEIgAgrcWu1QvOE7IcR/Pw6wFIFh6/TLwoeKjo5eUoi7suzsEAAQMIQYOYAAAAAAABBCJRIIHaDT4wURNaieL52F4urfZh+Vm/sF5nEJeFRnLP0Kx9AA=="
2024-01-15 13:35:14 -08:00
}
}
]
}