2024-01-15 13:35:14 -08:00
{
"$schema" : "../rpc-schema-draft.json" ,
"type" : "object" ,
"rpc" : "withdraw" ,
"title" : "Command for withdrawing funds from the internal wallet" ,
"description" : [
"The **withdraw** RPC command sends funds from Core Lightning's internal wallet to the address specified in *destination*."
] ,
"request" : {
"required" : [
"destination" ,
"satoshi"
] ,
2024-10-30 09:38:42 +10:30
"additionalProperties" : false ,
2024-01-15 13:35:14 -08:00
"properties" : {
"destination" : {
"type" : "string" ,
"description" : [
"Any Bitcoin accepted type, including bech32."
]
} ,
"satoshi" : {
2024-05-24 12:50:20 +02:00
"type" : "sat_or_all" ,
2024-01-15 13:35:14 -08:00
"description" : [
"The amount to be withdrawn from the internal wallet (expressed, as name suggests, in satoshi). The string *all* can be used to specify withdrawal of all available funds (but if we have any anchor channels, this will always leave at least `min-emergency-msat` as change). 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*."
]
} ,
"feerate" : {
"type" : "feerate" ,
"description" : [
"Used for the withdrawal as initial feerate."
] ,
"default" : "*normal*"
} ,
"minconf" : {
"type" : "u16" ,
"description" : [
"Minimum number of confirmations that used outputs should have."
] ,
"default" : 1
} ,
"utxos" : {
"type" : "array" ,
"description" : [
"Specifies the utxos to be used to be withdrawn from, as an array of `txid:vout`. These must be drawn from the node's available UTXO set."
] ,
"items" : {
"type" : "outpoint"
}
}
}
} ,
"response" : {
"required" : [
"psbt" ,
"tx" ,
"txid"
] ,
2024-10-30 09:38:42 +10:30
"additionalProperties" : false ,
2024-01-15 13:35:14 -08:00
"properties" : {
"tx" : {
"type" : "hex" ,
"description" : [
"The fully signed bitcoin transaction."
]
} ,
"txid" : {
"type" : "txid" ,
"description" : [
"The transaction id of *tx*."
]
} ,
"psbt" : {
"type" : "string" ,
"description" : [
"The PSBT representing the unsigned transaction."
]
}
}
} ,
"errors" : [
"On failure, an error is reported and the withdrawal 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." ,
"- 313: The `min-emergency-msat` reserve not be preserved (and we have anchor channels)."
] ,
2024-06-20 14:57:02 -07:00
"author" : [
"Felix <<fixone@gmail.com>> is mainly responsible."
] ,
"see_also" : [
"lightning-listfunds(7)" ,
"lightning-fundchannel(7)" ,
"lightning-newaddr(7)" ,
"lightning-txprepare(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:withdraw#1" ,
"method" : "withdraw" ,
"params" : {
2024-08-09 22:44:53 -07:00
"destination" : "bcrt1qcqqv0101010101010101010101010101010101" ,
2024-06-18 14:49:51 -07:00
"satoshi" : 555555
2024-03-27 18:45:18 -07:00
}
} ,
"response" : {
2024-08-09 22:44:53 -07:00
"tx" : "020000000001wthdrw91000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000910009100091000" ,
"txid" : "txidwithdraw2191000910009100091000910009100091000910009100091000" ,
"psbt" : "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000911000"
2024-01-15 13:35:14 -08:00
}
} ,
{
2024-03-27 18:45:18 -07:00
"request" : {
"id" : "example:withdraw#2" ,
"method" : "withdraw" ,
"params" : {
2024-08-09 22:44:53 -07:00
"destination" : "bcrt1phtprcvhz02020202020202020202020202020202020202020202020202" ,
2024-03-27 18:45:18 -07:00
"satoshi" : "all" ,
"feerate" : "20000perkb" ,
"minconf" : 0 ,
"utxos" : [
2024-08-09 22:44:53 -07:00
"utxo020202020202020202020202020202020202020202020202020202020202:1"
2024-03-27 18:45:18 -07:00
]
}
} ,
"response" : {
2024-08-09 22:44:53 -07:00
"tx" : "020000000002wthdrw92000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000920009200092000" ,
"txid" : "txidwithdraw2292000920009200092000920009200092000920009200092000" ,
"psbt" : "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000922000"
2024-01-15 13:35:14 -08:00
}
}
]
}