forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlightning-utxopsbt.json
274 lines (274 loc) · 9.09 KB
/
lightning-utxopsbt.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"rpc": "utxopsbt",
"title": "Command to populate PSBT inputs from given UTXOs",
"description": [
"*utxopsbt* is a low-level RPC command which creates a PSBT using unreserved inputs in the wallet, optionally reserving them as well.",
"",
"It deliberately mirrors the parameters and output of lightning-fundpsbt(7) except instead of an optional *minconf* parameter to select unreserved outputs from the wallet, it takes a compulsory list of outputs to use."
],
"request": {
"required": [
"satoshi",
"feerate",
"startweight",
"utxos"
],
"additionalProperties": false,
"properties": {
"satoshi": {
"type": "sat_or_all",
"description": [
"The minimum satoshi value of the output(s) needed (or the string `all` meaning use all unreserved inputs). If a value, 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 transaction as initial feerate."
],
"default": "*normal*"
},
"startweight": {
"type": "u32",
"description": [
"The weight of the transaction before *fundpsbt* has added any inputs."
]
},
"utxos": {
"type": "array",
"description": [
"An array of `txid:vout`, each of which must be reserved or available."
],
"items": {
"type": "outpoint"
}
},
"reserve": {
"type": "u32",
"description": [
"If not zero, then *reserveinputs* is called (successfully, with *exclusive* true) on the returned PSBT for this number of blocks."
],
"default": "72 blocks"
},
"reservedok": {
"type": "boolean",
"description": [
"If set to true, it will also fail if any of the *utxos* are already reserved."
],
"default": "false"
},
"locktime": {
"type": "u32",
"description": [
"If not set, it is set to a recent block height."
]
},
"min_witness_weight": {
"type": "u32",
"description": [
"Minimum weight to use for a UTXO's witness. If the actual witness weight is greater than the provided minimum, the actual witness weight will be used."
]
},
"excess_as_change": {
"type": "boolean",
"description": [
"Flag to add a change output for the excess sats."
]
},
"opening_anchor_channel": {
"added": "v23.08",
"type": "boolean",
"description": [
"To signel that it needs emergency reserve for anchors so that we can lowball our commitment tx fees, and min-emergency-msat for reserving some sats for closing anchor channels."
]
}
}
},
"response": {
"required": [
"psbt",
"feerate_per_kw",
"estimated_final_weight",
"excess_msat"
],
"additionalProperties": false,
"properties": {
"psbt": {
"type": "string",
"description": [
"Unsigned PSBT which fulfills the parameters given."
]
},
"feerate_per_kw": {
"type": "u32",
"description": [
"The feerate used to create the PSBT, in satoshis-per-kiloweight."
]
},
"estimated_final_weight": {
"type": "u32",
"description": [
"The estimated weight of the transaction once fully signed."
]
},
"excess_msat": {
"type": "msat",
"description": [
"The amount above *satoshi* which is available. This could be zero, or dust; it will be zero if *change_outnum* is also returned."
]
},
"change_outnum": {
"type": "u32",
"description": [
"The 0-based output number where change was placed (only if parameter *excess_as_change* was true and there was sufficient funds)."
]
},
"reservations": {
"type": "array",
"description": [
"If *reserve* was true or a non-zero number, just as per lightning- reserveinputs(7)."
],
"items": {
"type": "object",
"required": [
"txid",
"vout",
"was_reserved",
"reserved",
"reserved_to_block"
],
"additionalProperties": false,
"properties": {
"txid": {
"type": "txid",
"description": [
"The txid of the transaction."
]
},
"vout": {
"type": "u32",
"description": [
"The 0-based output number."
]
},
"was_reserved": {
"type": "boolean",
"description": [
"Whether this output was previously reserved."
]
},
"reserved": {
"type": "boolean",
"enum": [
true
],
"description": [
"Whether this output is now reserved."
]
},
"reserved_to_block": {
"type": "u32",
"description": [
"The blockheight the reservation will expire."
]
}
}
}
}
},
"post_return_value_notes": [
"On success, returns the *psbt* it created, containing the inputs, *feerate_per_kw* showing the exact numeric feerate it used, *estimated_final_weight* for the estimated weight of the transaction once fully signed, and *excess_msat* containing the amount above *satoshi* which is available. This could be zero, or dust. If *satoshi* was `all`, then *excess_msat* is the entire amount once fees are subtracted for the weights of the inputs and *startweight*.",
"",
"If *reserve* was *true* or a non-zero number, then a *reservations* array is returned, exactly like *reserveinputs*.",
"",
"If *excess_as_change* is true and the excess is enough to cover an additional output above the `dust_limit`, then an output is added to the PSBT for the excess amount. The *excess_msat* will be zero. A *change_outnum* will be returned with the index of the change output."
]
},
"errors": [
"On error the returned object will contain `code` and `message` properties, with `code` being one of the following:",
"",
"- -32602: If the given parameters are wrong.",
"- -1: Catchall nonspecific error.",
"- 301: Insufficient UTXOs to meet *satoshi* value."
],
"author": [
"Rusty Russell <<[email protected]>> is mainly responsible."
],
"see_also": [
"lightning-fundpsbt(7)"
],
"resources": [
"Main web site: <https://github.com/ElementsProject/lightning>"
],
"examples": [
{
"request": {
"id": "example:utxopsbt#1",
"method": "utxopsbt",
"params": [
1000000,
"15000perkw",
214,
[
"utxo010101010101010101010101010101010101010101010101010101010101:1"
],
null,
true,
null,
null,
true
]
},
"response": {
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000510000",
"feerate_per_kw": 15000,
"estimated_final_weight": 657,
"excess_msat": 0,
"change_outnum": 0,
"reservations": [
{
"txid": "utxo010101010101010101010101010101010101010101010101010101010101",
"vout": 1,
"was_reserved": true,
"reserved": true,
"reserved_to_block": 2240
}
]
}
},
{
"request": {
"id": "example:utxopsbt#2",
"method": "utxopsbt",
"params": {
"satoshi": 2000000,
"feerate": "18750perkw",
"startweight": 214,
"utxos": [
"utxo010101010101010101010101010101010101010101010101010101010101:1"
],
"reservedok": true,
"excess_as_change": true
}
},
"response": {
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000520000",
"feerate_per_kw": 18750,
"estimated_final_weight": 657,
"excess_msat": 0,
"change_outnum": 0,
"reservations": [
{
"txid": "utxo010101010101010101010101010101010101010101010101010101010101",
"vout": 1,
"was_reserved": true,
"reserved": true,
"reserved_to_block": 2312
}
]
}
}
]
}