-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwallet.proto
343 lines (282 loc) · 9.77 KB
/
wallet.proto
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
/* CUSF mainchain wallet service */
syntax = "proto3";
package cusf.mainchain.v1;
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "cusf/common/v1/common.proto";
import "cusf/mainchain/v1/common.proto";
message WalletTransaction {
message Confirmation {
uint32 height = 1;
cusf.common.v1.ReverseHex block_hash = 2;
google.protobuf.Timestamp timestamp = 3;
}
cusf.common.v1.ReverseHex txid = 1;
uint64 fee_sats = 2;
uint64 received_sats = 3;
uint64 sent_sats = 4;
Confirmation confirmation_info = 5;
}
service WalletService {
rpc BroadcastWithdrawalBundle(BroadcastWithdrawalBundleRequest)
returns (BroadcastWithdrawalBundleResponse);
rpc CreateBmmCriticalDataTransaction(CreateBmmCriticalDataTransactionRequest)
returns (CreateBmmCriticalDataTransactionResponse);
rpc CreateDepositTransaction(CreateDepositTransactionRequest)
returns (CreateDepositTransactionResponse);
rpc CreateNewAddress(CreateNewAddressRequest)
returns (CreateNewAddressResponse);
// Create a new sidechain proposal (M1 in BIP300) and persist to the local
// database for further processing.
// Sidechain proposals must be included in the coinbase transaction of a
// newly mined block, so this proposal is not active until the wallet has
// been able to generate a new block.
// Returns a stream of (non-)confirmation events for the sidechain proposal.
rpc CreateSidechainProposal(CreateSidechainProposalRequest)
returns (stream CreateSidechainProposalResponse);
rpc CreateWallet(CreateWalletRequest)
returns (CreateWalletResponse);
rpc GetBalance(GetBalanceRequest)
returns (GetBalanceResponse);
rpc ListSidechainDepositTransactions(ListSidechainDepositTransactionsRequest)
returns (ListSidechainDepositTransactionsResponse);
rpc ListTransactions(ListTransactionsRequest)
returns (ListTransactionsResponse);
rpc ListUnspentOutputs(ListUnspentOutputsRequest)
returns (ListUnspentOutputsResponse);
rpc GetInfo(GetInfoRequest)
returns (GetInfoResponse);
rpc SendTransaction(SendTransactionRequest)
returns (SendTransactionResponse);
rpc UnlockWallet(UnlockWalletRequest)
returns (UnlockWalletResponse);
// Available on regtest and signet only.
rpc GenerateBlocks(GenerateBlocksRequest)
returns (stream GenerateBlocksResponse);
// Create multisig address with the given public keys and required signatures
rpc CreateMultisigAddress(CreateMultisigAddressRequest)
returns (CreateMultisigAddressResponse);
// Create an unsigned PSBT for a multisig address
rpc CreateMultisigTransaction(CreateMultisigTransactionRequest)
returns (CreateMultisigTransactionResponse);
}
message BroadcastWithdrawalBundleRequest {
google.protobuf.UInt32Value sidechain_id = 1;
google.protobuf.BytesValue transaction = 2;
}
message BroadcastWithdrawalBundleResponse {
}
message CreateBmmCriticalDataTransactionRequest {
google.protobuf.UInt32Value sidechain_id = 1;
google.protobuf.UInt64Value value_sats = 2;
google.protobuf.UInt32Value height = 3;
cusf.common.v1.ConsensusHex critical_hash = 4;
cusf.common.v1.ReverseHex prev_bytes = 5;
}
message CreateBmmCriticalDataTransactionResponse {
cusf.common.v1.ReverseHex txid = 1;
}
message CreateDepositTransactionRequest {
google.protobuf.UInt32Value sidechain_id = 1;
// Addresses are encoded in UTF8.
// *Sidechain deposit addresses* (not sidechain addresses) are typically
// formatted as `s<SLOT_NUMBER>_<ADDRESS>_<CHECKSUM>`,
// where `CHECKSUM` is a hex encoding of the first 6 bytes of the SHA256
// hash of `s<SLOT_NUMBER>_<ADDRESS>`.
// protolint:disable:next MAX_LINE_LENGTH
// https://github.com/LayerTwo-Labs/testchain-deprecated/blob/4b7bae3e1218e058f59a43caf6ccac2a4e9a91f6/src/sidechain.cpp#L219
// The address used here is a sidechain address, the middle component of a
// sidechain deposit address.
google.protobuf.StringValue address = 2;
google.protobuf.UInt64Value value_sats = 3;
google.protobuf.UInt64Value fee_sats = 4;
}
message CreateDepositTransactionResponse {
cusf.common.v1.ReverseHex txid = 1;
}
message CreateNewAddressRequest {
}
message CreateNewAddressResponse {
string address = 1;
}
message CreateSidechainProposalRequest {
google.protobuf.UInt32Value sidechain_id = 1;
SidechainDeclaration declaration = 2;
}
message CreateSidechainProposalResponse {
message Confirmed {
cusf.common.v1.ReverseHex block_hash = 1;
google.protobuf.UInt32Value confirmations = 2;
google.protobuf.UInt32Value height = 3;
OutPoint outpoint = 4;
cusf.common.v1.ReverseHex prev_block_hash = 5;
}
message NotConfirmed {
cusf.common.v1.ReverseHex block_hash = 1;
google.protobuf.UInt32Value height = 2;
cusf.common.v1.ReverseHex prev_block_hash = 3;
}
oneof event {
Confirmed confirmed = 1;
NotConfirmed not_confirmed = 2;
}
}
message CreateWalletRequest {
// BIP39 mnemonic. 12 or 24 words.
repeated string mnemonic_words = 1;
// Path to a file containing the mnemonic.
string mnemonic_path = 2;
// Password for the wallet. Used to encrypt the mnemonic in storage.
// NOT a BIP39 passphrase.
string password = 3;
}
message CreateWalletResponse {
}
message GetBalanceRequest {
}
message GetBalanceResponse {
uint64 confirmed_sats = 1;
uint64 pending_sats = 2;
}
message ListSidechainDepositTransactionsRequest {
}
message ListSidechainDepositTransactionsResponse {
message SidechainDepositTransaction {
google.protobuf.UInt32Value sidechain_number = 1;
WalletTransaction tx = 2;
}
repeated SidechainDepositTransaction transactions = 1;
}
message ListTransactionsRequest {
}
message ListTransactionsResponse {
repeated WalletTransaction transactions = 1;
}
message SendTransactionRequest {
message FeeRate {
oneof fee {
// Fee rate, measured in sat/vbyte.
uint64 sat_per_vbyte = 1;
// Fee amount, measured in sats.
uint64 sats = 2;
}
}
// A previous unspent transaction output that must be included in the
// transaction.
message RequiredUtxo {
cusf.common.v1.ReverseHex txid = 1;
uint32 vout = 2;
}
// Address -> satoshi amount
map<string, uint64> destinations = 1;
// If not set, a reasonable rate is used by asking Core for an estimate.
optional FeeRate fee_rate = 2;
// if set, the transaction will add a separate OP_RETURN output with this
// message.
optional cusf.common.v1.Hex op_return_message = 3;
// UTXOs that must be included in the transaction. Incompatible with
// specifying a draining address.
repeated RequiredUtxo required_utxos = 4;
// If set, the transaction will send all UTXOs in the wallet to this address.
// Incompatible with specifying required UTXOs.
optional string drain_wallet_to = 5;
}
message SendTransactionResponse {
cusf.common.v1.ReverseHex txid = 1;
}
message UnlockWalletRequest {
string password = 1;
}
message UnlockWalletResponse {
}
message GenerateBlocksRequest {
// Number of blocks to generate.
google.protobuf.UInt32Value blocks = 1;
// ACK all sidechain proposals, irregardless of if they are already
// in the wallet DB.
bool ack_all_proposals = 2;
}
message GenerateBlocksResponse {
cusf.common.v1.ReverseHex block_hash = 1;
}
message GetInfoRequest {
}
message GetInfoResponse {
// The network the wallet is on
string network = 1;
// Total number of transactions in the wallet
uint32 transaction_count = 2;
// Number of UTXOs in the wallet.
uint32 unspent_output_count = 3;
map<string, string> descriptors = 4;
}
message ListUnspentOutputsRequest {
}
message ListUnspentOutputsResponse {
message Output {
cusf.common.v1.ReverseHex txid = 1;
uint32 vout = 2;
uint64 value_sats = 3;
// An internal output is one that was created by the wallet itself
// as change output for a transaction.
bool is_internal = 4;
bool is_confirmed = 5;
uint32 confirmed_at_block = 6;
google.protobuf.Timestamp confirmed_at_time = 7;
cusf.common.v1.ReverseHex confirmed_transitively = 8;
google.protobuf.Timestamp unconfirmed_last_seen = 9;
}
repeated Output outputs = 1;
}
message CreateMultisigAddressRequest {
// Public keys of the multisig address
repeated string public_keys = 1;
// Number of required signatures
uint32 required_signatures = 2;
// Type of address to create: "p2sh", "p2wsh", or "p2sh-p2wsh"
// If not provided, defaults to "p2wsh"
google.protobuf.StringValue address_type = 3;
}
message CreateMultisigAddressResponse {
// The generated multisig address
string address = 1;
// The descriptor for the multisig address
string descriptor = 2;
// The redeem script for the multisig address
string redeem_script = 3;
}
message CreateMultisigTransactionRequest {
// The multisig address to spend from
string multisig_address = 1;
// The redeem script for the multisig address
string redeem_script = 2;
// Address -> satoshi amount
map<string, uint64> destinations = 3;
// Fee rate, similar to SendTransactionRequest
message FeeRate {
oneof fee {
// Fee rate, measured in sat/vbyte.
uint64 sat_per_vbyte = 1;
// Fee amount, measured in sats.
uint64 sats = 2;
}
}
// If not set, a reasonable rate is used by asking Core for an estimate.
optional FeeRate fee_rate = 4;
// If set, the transaction will add a separate OP_RETURN
optional cusf.common.v1.Hex op_return_message = 5;
// UTXOs from multisig address that should be included in transaction
message MultisigUtxo {
cusf.common.v1.ReverseHex txid = 1;
uint32 vout = 2;
uint64 amount = 3;
}
// UTXOs from the multisig address to spend
repeated MultisigUtxo utxos = 6;
}
message CreateMultisigTransactionResponse {
// The unsigned PSBT in base64 format
string psbt = 1;
// The transaction ID
cusf.common.v1.ReverseHex txid = 2;
}