forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsplice_signed.json
More file actions
167 lines (167 loc) · 8.94 KB
/
splice_signed.json
File metadata and controls
167 lines (167 loc) · 8.94 KB
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
{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"added": "v23.08",
"rpc": "splice_signed",
"title": "Command to initiate a channel to a peer",
"description": [
"`splice_signed` is a low level RPC command which finishes the active channel splice associated with `channel_id`.",
"",
"The *psbt* must have all signatures attached to all inputs that you have added to it or it will fail."
],
"request": {
"required": [
"channel_id",
"psbt"
],
"additionalProperties": false,
"properties": {
"channel_id": {
"type": "hash",
"description": [
"The channel id of the channel to be spliced."
]
},
"psbt": {
"type": "string",
"description": [
"The psbt of the resulting transaction after splice negotiation(s)"
]
},
"sign_first": {
"type": "boolean",
"description": [
"A flag that makes our node offer the final splice signature first (defaults to false). When false, the node will calculate who should sign first based off who is adding inputting the least sats to the splice as per spec."
]
}
}
},
"response": {
"required": [
"tx",
"txid",
"psbt"
],
"additionalProperties": false,
"properties": {
"tx": {
"type": "hex",
"description": [
"The hex representation of the final transaction that is published."
]
},
"txid": {
"type": "txid",
"description": [
"The txid is of the final transaction."
]
},
"psbt": {
"type": "string",
"description": [
"The psbt of the resulting transaction after splice negotiation(s)"
]
},
"outnum": {
"added": "v24.08",
"type": "u32",
"description": [
"The index of the new funding output."
]
}
}
},
"usage": [
"In this example we funded the psbt from our lightning node, so we can use the lightning node to sign for its funds.",
"",
"```shell",
"SIGNPSBT=$(echo $(lightning-cli signpsbt $PSBT_SPLICE_UPDATE) | jq -r \".signed_psbt\")",
"",
"lightning-cli splice_signed $CHANNEL_ID $SIGNPSBT",
"```",
"",
"Here is an example set of splice commands that will splice in 100,000 sats to the first channel that comes out of `listpeerchannels`.",
"",
"The example assumes you already have at least one confirmed channel.",
"",
"1: Get the channel id of the first channel.",
"",
"```shell",
"CHANNEL_ID=$(echo $(lightning-cli listpeerchannels) | jq -r \".channels[0].channel_id\")",
"```",
"2: Get the PSBT from fundpsbt.",
"",
"```shell",
"INITIALPSBT=$(echo $(lightning-cli fundpsbt -k satoshi=100000sat feerate=urgent startweight=800 excess_as_change=true) | jq -r \".psbt\")",
"```",
"3: Initiate the splice by passing channel id and initialpsbt received from above steps.",
"",
"```shell",
"PSBT_SPLICE_INIT=$(echo $(lightning-cli splice_init $CHANNEL_ID 100000 $INITIALPSBT) | jq -r \".psbt\")",
"```",
"4: Update PSBTs with the splice_update command.",
"",
"```shell",
"RESULT={\"commitments_secured\":false}",
"while [[ $(echo $RESULT | jq -r \".commitments_secured\") == \"false\" ]]",
"do",
" PSBT_SPLICE_UPDATE=$(echo $(lightning-cli splice_update $CHANNEL_ID $PSBT_SPLICE_INIT) | jq -r \".psbt\")",
" echo $PSBT_SPLICE_UPDATE",
"done",
"```",
"5: Sign the updated PSBT.",
"",
"```shell",
"SIGNPSBT=$(echo $(lightning-cli signpsbt -k psbt=\"$PSBT_SPLICE_UPDATE\") | jq -r \".signed_psbt\")",
"```",
"6: Finally, call splice_signed with channel id and signed PSBT parameters.",
"",
"```shell",
"lightning-cli splice_signed $CHANNEL_ID $SIGNPSBT",
"```"
],
"author": [
"Dusty [@dusty_daemon](mailto:@dustydaemon) is mainly responsible."
],
"see_also": [
"lightning-splice_init(7)",
"lightning-splice_update(7)"
],
"resources": [
"Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
],
"examples": [
{
"request": {
"id": "example:splice_signed#1",
"method": "splice_signed",
"params": {
"channel_id": "channelid0780000780000780000780000780000780000780000780000780000",
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000718000"
}
},
"response": {
"tx": "02000000000101sendpt64000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000640006400064000",
"txid": "txid6400064000640006400064000640006400064000640006400064000",
"outnum": 1,
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000711000"
}
},
{
"request": {
"id": "example:splice_signed#2",
"method": "splice_signed",
"params": {
"channel_id": "channelid0780000780000780000780000780000780000780000780000780000",
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000"
}
},
"response": {
"tx": "02000000000102sendpt65000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000650006500065000",
"txid": "txid6500065000650006500065000650006500065000650006500065000",
"outnum": 1,
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000712000"
}
}
]
}