-
Notifications
You must be signed in to change notification settings - Fork 155
/
Copy pathmobilecoind_api.proto
1197 lines (952 loc) · 38.7 KB
/
mobilecoind_api.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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2018-2022 The MobileCoin Foundation
// MUST BE KEPT IN SYNC WITH RUST CODE!
// mobilecoind client data types and service descriptors.
syntax = "proto3";
import "google/protobuf/empty.proto";
import "external.proto";
import "blockchain.proto";
import "watcher.proto";
import "ledger.proto";
package mobilecoind_api;
option java_package = "com.mobilecoin.mobilecoind";
option java_outer_classname = "MobileCoinDAPI";
service MobilecoindAPI {
// Monitors
rpc AddMonitor (AddMonitorRequest) returns (AddMonitorResponse) {}
rpc RemoveMonitor (RemoveMonitorRequest) returns (google.protobuf.Empty) {}
rpc GetMonitorList (google.protobuf.Empty) returns (GetMonitorListResponse) {}
rpc GetMonitorStatus (GetMonitorStatusRequest) returns (GetMonitorStatusResponse) {}
rpc GetUnspentTxOutList (GetUnspentTxOutListRequest) returns (GetUnspentTxOutListResponse) {}
rpc GetAllUnspentTxOut (GetAllUnspentTxOutRequest) returns (GetAllUnspentTxOutResponse) {}
// Utilities
rpc GenerateRootEntropy (google.protobuf.Empty) returns (GenerateRootEntropyResponse) {}
rpc GenerateMnemonic (google.protobuf.Empty) returns (GenerateMnemonicResponse) {}
rpc GetAccountKeyFromRootEntropy (GetAccountKeyFromRootEntropyRequest) returns (GetAccountKeyResponse) {}
rpc GetAccountKeyFromMnemonic (GetAccountKeyFromMnemonicRequest) returns (GetAccountKeyResponse) {}
rpc GetPublicAddress (GetPublicAddressRequest) returns (GetPublicAddressResponse) {}
rpc GetShortAddressHash (GetShortAddressHashRequest) returns (GetShortAddressHashResponse) {}
rpc ValidateAuthenticatedSenderMemo (ValidateAuthenticatedSenderMemoRequest) returns (ValidateAuthenticatedSenderMemoResponse) {}
rpc TxOutViewKeyMatch (TxOutViewKeyMatchRequest) returns (TxOutViewKeyMatchResponse) {}
// b58 Codes
rpc ParseRequestCode (ParseRequestCodeRequest) returns (ParseRequestCodeResponse) {}
rpc CreateRequestCode (CreateRequestCodeRequest) returns (CreateRequestCodeResponse) {}
rpc ParseTransferCode (ParseTransferCodeRequest) returns (ParseTransferCodeResponse) {}
rpc CreateTransferCode (CreateTransferCodeRequest) returns (CreateTransferCodeResponse) {}
rpc ParseAddressCode (ParseAddressCodeRequest) returns (ParseAddressCodeResponse) {}
rpc CreateAddressCode (CreateAddressCodeRequest) returns (CreateAddressCodeResponse) {}
// Txs
rpc GetMixins (GetMixinsRequest) returns (GetMixinsResponse) {}
rpc GetMembershipProofs (GetMembershipProofsRequest) returns (GetMembershipProofsResponse) {}
rpc GenerateTx (GenerateTxRequest) returns (GenerateTxResponse) {}
rpc GenerateOptimizationTx (GenerateOptimizationTxRequest) returns (GenerateOptimizationTxResponse) {}
rpc GenerateTransferCodeTx (GenerateTransferCodeTxRequest) returns (GenerateTransferCodeTxResponse) {}
rpc GenerateTxFromTxOutList (GenerateTxFromTxOutListRequest) returns (GenerateTxFromTxOutListResponse) {}
rpc GenerateBurnRedemptionTx (GenerateBurnRedemptionTxRequest) returns (GenerateBurnRedemptionTxResponse) {}
rpc SubmitTx (SubmitTxRequest) returns (SubmitTxResponse) {}
// Swaps
rpc GenerateSwap (GenerateSwapRequest) returns (GenerateSwapResponse) {}
rpc GenerateMixedTx (GenerateMixedTxRequest) returns (GenerateMixedTxResponse) {}
// Databases
rpc GetLedgerInfo (google.protobuf.Empty) returns (GetLedgerInfoResponse) {}
rpc GetBlockInfo (GetBlockInfoRequest) returns (GetBlockInfoResponse) {}
rpc GetBlock (GetBlockRequest) returns (GetBlockResponse) {}
rpc GetLatestBlock (google.protobuf.Empty) returns (GetBlockResponse) {}
rpc GetBlocksData (GetBlocksDataRequest) returns (GetBlocksDataResponse) {}
rpc GetTxStatusAsSender (SubmitTxResponse) returns (GetTxStatusAsSenderResponse) {}
rpc GetTxStatusAsReceiver (GetTxStatusAsReceiverRequest) returns (GetTxStatusAsReceiverResponse) {}
rpc GetProcessedBlock (GetProcessedBlockRequest) returns (GetProcessedBlockResponse) {}
rpc GetBlockIndexByTxPubKey (GetBlockIndexByTxPubKeyRequest) returns (GetBlockIndexByTxPubKeyResponse) {}
rpc GetTxOutResultsByPubKey (GetTxOutResultsByPubKeyRequest) returns (GetTxOutResultsByPubKeyResponse) {}
// Convenience calls
rpc GetBalance (GetBalanceRequest) returns (GetBalanceResponse) {}
rpc SendPayment (SendPaymentRequest) returns (SendPaymentResponse) {}
rpc PayAddressCode (PayAddressCodeRequest) returns (SendPaymentResponse) {}
// Network status
rpc GetNetworkStatus (google.protobuf.Empty) returns (GetNetworkStatusResponse) {}
// Database encryption
rpc SetDbPassword (SetDbPasswordRequest) returns (google.protobuf.Empty) {}
rpc UnlockDb (UnlockDbRequest) returns (google.protobuf.Empty) {}
// Versioning
rpc GetVersion(google.protobuf.Empty) returns (MobilecoindVersionResponse) {}
}
//*********************************
//*
//* Structures
//*
//*********************************
// Possible transaction status values. Senders check with key images and tx public keys. Receivers check with tx public keys.
enum TxStatus {
// The transaction is not in the public ledger.
Unknown = 0;
// The transaction is in the public ledger.
Verified = 1;
// Error: The transaction is not in the public ledger, and the tombstone block has been exceeded.
TombstoneBlockExceeded = 2;
// The transaction was found in the ledger but the confirmation number is incorrect.
InvalidConfirmationNumber = 3;
// The tx public keys are in different blocks. This indicates the receipt is possibly malformed.
PublicKeysInDifferentBlocks = 4;
// Not all key_images in the same block as the tx_public_keys, indicating the transaction for this receipt failed.
TransactionFailureKeyImageBlockMismatch = 5;
// Some key_images are spent elsewhere in the ledger, despite the tx_public_keys not appearing in the ledger.
TransactionFailureKeyImageAlreadySpent = 6;
}
// Structure used in specifying the list of outputs when generating a transaction.
// Here the token id is implied from context, and matches the fee token id.
message Outlay {
uint64 value = 1;
external.PublicAddress receiver = 2;
// Optional tx private key to use for this tx out. This can be chosen explicitly as a mechanism for idempotence.
// Must be 32 pseudorandom bytes or none. Will be reduced to curve25519 scalar mod order.
bytes tx_private_key = 3;
}
// Structure used in specifying the list of outputs in a transaction.
// Here the token id is explicit.
message OutlayV2 {
uint64 value = 1;
external.PublicAddress receiver = 2;
uint64 token_id = 3;
// Optional tx private key to use for this tx out. This can be chosen explicitly as a mechanism for idempotence.
// Must be 32 pseudorandom bytes or none. Will be reduced to curve25519 scalar mod order.
bytes tx_private_key = 4;
}
// Structure used to refer to a TxOut in the ledger that is presumed to be spendable.
// The structure is annotated with extra information needed to spend the TxOut in a payment, calculated using the private keys that control the TxOut.
message UnspentTxOut {
// The actual TxOut object found in the ledger.
external.TxOut tx_out = 1;
// The subaddress the TxOut was sent to.
uint64 subaddress_index = 2;
// The key image of the TxOut.
external.KeyImage key_image = 3;
// The value of the TxOut.
uint64 value = 4;
// The block height at which this UnspentTxOut was last attempted to be spent.
uint64 attempted_spend_height = 5;
// The tombstone block used when we attempted to spend the UTXO.
uint64 attempted_spend_tombstone = 6;
// The token id of the TxOut
uint64 token_id = 7;
// The (decrypted) MemoPayload of this TxOut
bytes memo_payload = 8;
// The monitor id this UnspentTxOut belongs to.
// Note that this field is not included in the Rust `utxo_store::UnspentTxOut` struct.
bytes monitor_id = 10;
// The decoded memo info, if any
DecodedMemo decoded_memo = 11;
}
message DecodedMemo {
// Details of the decoded memo payload.
// Omitted if the empty memo was found.
oneof decoded_memo {
UnknownMemo unknown_memo = 1;
AuthenticatedSenderMemo authenticated_sender_memo = 2;
}
}
// Structure used to represent the decoded MCIP #4 Authenticated sender memo and its variants.
// Note that the sender can write whatever they want in a memo, and to rely on the data.
// You must validate the memo by checking the hmac, see the ValidateAuthenticatedSenderMemo rpc call.
message AuthenticatedSenderMemo {
/// The standard short address hash (MCIP #4)
bytes sender_hash = 1;
// Payment request ID if present
optional uint64 payment_request_id = 2;
// Payment intent ID if present
optional uint64 payment_intent_id = 3;
}
// Details returned when this version of mobilecoind couldn't interpret a memo payload.
message UnknownMemo {
// The type bytes of this memo, which couldn't be interpreted by mobilecoind.
bytes type_bytes = 1;
}
// Structure used to refer to an SCI that we want to add to a transaction.
// The structure has additional information -- if it's a partial fill SCI, we need to know the partial fill amount.
message SciForTx {
/// The signed input we want to add
external.SignedContingentInput sci = 1;
/// If it's a partial fill SCI, the value we wish to fill it for
/// This is the amount that, we, the counter-party, take from the SCI originator,
/// in exchange for a corresponding fraction of the partial fill outputs in the SCI.
///
/// This is a u64 value corresponding to an amount less or equal to the partial_fill_change amount
/// in the SCI.
///
/// In case of a non partial fill SCI (without partial_fill_change output),
/// this must be zero.
uint64 partial_fill_value = 2;
}
// Structure used to refer to a prepared transaction
message TxProposal {
// List of inputs being spent.
repeated UnspentTxOut input_list = 1;
// List of outputs being created.
// This excludes the fee output.
repeated OutlayV2 outlay_list = 2;
// The actual transaction object.
// Together with the private view/spend keys, this structure contains all information in existence about the transaction.
external.Tx tx = 3;
// The transaction fee. This is equal to `tx.prefix.fee`.
// Note that changing this fee will have no effect on the transaction. Changing the fee
// inside `tx` will invalidate the ring signature.
uint64 fee = 4;
/// A map of outlay index -> TxOut index in the Tx object.
/// This is needed to map recipients to their respective TxOuts.
map<uint64, uint64> outlay_index_to_tx_out_index = 5;
/// A list of the confirmation numbers, in the same order
/// as the outlays.
repeated bytes outlay_confirmation_numbers = 6;
/// A list of the scis that were incorporated into this transaction, if any
repeated SciForTx scis = 7;
}
// Structure used to check transaction status as a Sender.
message SenderTxReceipt {
// Key images that are going to be added to the ledger once the transaction goes through.
repeated external.KeyImage key_image_list = 1;
// Tombstone block set in the transaction.
uint64 tombstone = 2;
}
// Structure used to check transaction status as a recipient.
// There exists one receipt per output, so a transaction having multiple outputs would have
// multiple ReceiverTxReceipts.
message ReceiverTxReceipt {
// The recipient this receipt refers to
external.PublicAddress recipient = 1;
// The public key of the TxOut sent to this recipient.
external.CompressedRistretto tx_public_key = 2;
// The hash of the TxOut sent to this recipient.
bytes tx_out_hash = 3;
// Tombstone block set in the transaction.
uint64 tombstone = 4;
// Confirmation number for this TxOut
bytes confirmation_number = 5;
}
// Structure used to report monitor status
message MonitorStatus {
// The account key the monitor is monitoring.
external.AccountKey account_key = 1;
// The first subaddress being monitored.
uint64 first_subaddress = 2;
// The number of subaddresses being monitored, starting at first_subaddress.
uint64 num_subaddresses = 3;
// Block index we started scanning from.
uint64 first_block = 4;
// Next block we are waiting to sync.
uint64 next_block = 5;
// Optional monitor name.
string name = 6;
}
// Enum used to indicate whether a ProcessedTxOut is a sent one or a received one.
enum ProcessedTxOutDirection {
// This should never happen, but is available here as an option to catch uninitialized data.
// The name "Unknown" cannot be used because, quoting the protobuf compiler:
// Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it. Therefore, "Unknown" must be unique within "mobilecoind_api", not just within "ProcessedTxOutDirection".
Invalid = 0;
// The ProcessedTxOut has been received at the block queried for.
Received = 1;
// The ProcessedTxOut has been spent at the block queried for.
Spent = 2;
}
// Structure used to report processed information for TxOuts discovered in a given processed block.
message ProcessedTxOut {
// The monitor id that owns the TxOut.
bytes monitor_id = 1;
// The subaddress that owns the TxOut.
uint64 subaddress_index = 2;
// The public key of the TxOut.
external.CompressedRistretto public_key = 3;
// The key image of the TxOut.
external.KeyImage key_image = 4;
// The value of the TxOut.
uint64 value = 5;
// Whether the TxOut was received (deposit to subaddress) or spent (withdrawal from subaddress).
ProcessedTxOutDirection direction = 6;
// The b58-encoded Address Code for the subaddress that owns the TxOut.
string address_code = 7;
// The token id of the TxOut.
uint64 token_id = 8;
}
// Recoverable Transaction History memo with an optional u64 specifying the
// subaddress index to generate the sender memo credential from.
// Defaults to the default subaddress of the monitor.
// Allows optinally speciying a payment intent id or payment request id.
message TransactionMemo_RTH {
optional uint64 subaddress_index = 1;
oneof payment_id {
uint64 payment_intent_id = 2;
uint64 payment_request_id = 3;
}
}
// Empty transaction memo.
message TransactionMemo_Empty {
}
// Burn redemption memo
message TransactionMemo_BurnRedemption {
// The burn redemption memo data (64 bytes).
bytes memo_data = 1;
}
// Memo type to use when building a transaction.
// We will default to RTH from the default subaddress if nothing else is explicitly specified.
message TransactionMemo {
oneof transaction_memo {
TransactionMemo_RTH rth = 1;
TransactionMemo_Empty empty = 2;
TransactionMemo_BurnRedemption burn_redemption = 3;
}
}
//*********************************
//*
//* Requests and Responses for API
//*
//*********************************
//
// Monitors
//
// Add a new monitor.
message AddMonitorRequest {
// Account key to monitor.
external.AccountKey account_key = 1;
// The first subaddress being monitored.
uint64 first_subaddress = 2;
// The number of subaddresses being monitored, starting at first_subaddress.
uint64 num_subaddresses = 3;
// Block index to start monitoring from.
uint64 first_block = 4;
// Optional name.
string name = 5;
}
message AddMonitorResponse {
bytes monitor_id = 1;
bool is_new = 2;
}
// Remove a monitor and all associated data.
message RemoveMonitorRequest {
bytes monitor_id = 1;
}
// - empty response
// List all known monitor ids.
// - empty request
message GetMonitorListResponse {
repeated bytes monitor_id_list = 1;
}
// Get the status of a specific monitor.
message GetMonitorStatusRequest {
bytes monitor_id = 1;
}
message GetMonitorStatusResponse {
MonitorStatus status = 1;
}
// Get a list of UnspentTxOuts for a given monitor and subadddress index,
// filtered to a specific token id.
message GetUnspentTxOutListRequest {
bytes monitor_id = 1;
uint64 subaddress_index = 2;
uint64 token_id = 3;
}
message GetUnspentTxOutListResponse {
repeated UnspentTxOut output_list = 1;
}
// Get a list of all UnspentTxOuts for a given monitor, without any filtering
message GetAllUnspentTxOutRequest {
bytes monitor_id = 1;
}
message GetAllUnspentTxOutResponse {
repeated UnspentTxOut output_list = 1;
}
//
// Utilities
//
// Generate a new random root entropy value.
// - empty request
message GenerateRootEntropyResponse {
// 32 bytes generated using a cryptographically secure RNG.
bytes root_entropy = 1;
}
// Generate a new random mnemomic.
// - empty request
message GenerateMnemonicResponse {
// mnemonic generated using a cryptographically secure RNG.
string mnemonic = 1;
// The mnemonic represented as 32 bytes entropy.
bytes bip39_entropy = 2;
}
// Generate an AccountKey from a 32 byte root entropy value.
message GetAccountKeyFromRootEntropyRequest {
bytes root_entropy = 1;
}
// Generate an AccountKey from a mnemonic.
message GetAccountKeyFromMnemonicRequest {
string mnemonic = 1;
uint32 account_index = 2;
}
message GetAccountKeyResponse {
external.AccountKey account_key = 1;
}
// Get the public address for a given monitor and subadddress index.
message GetPublicAddressRequest {
bytes monitor_id = 1;
uint64 subaddress_index = 2;
}
message GetPublicAddressResponse {
external.PublicAddress public_address = 1;
string b58_code = 2;
}
//
// Memos
//
message GetShortAddressHashRequest {
external.PublicAddress public_address = 1;
}
message GetShortAddressHashResponse {
bytes hash = 1;
}
message ValidateAuthenticatedSenderMemoRequest {
bytes monitor_id = 1;
UnspentTxOut utxo = 2;
external.PublicAddress sender = 3;
}
message ValidateAuthenticatedSenderMemoResponse {
bool success = 1;
}
message TxOutViewKeyMatchRequest {
external.TxOut txo = 1;
external.RistrettoPrivate view_private_key = 2;
}
message TxOutViewKeyMatchResponse {
// Whether the tx out belongs to the provided view private key.
bool matched = 1;
// The value of the tx out, only valid if matched is true.
uint64 value = 2;
// The token_id of the tx out, only valid if matched is true.
uint64 token_id = 3;
// The tx out shared secret, only valid if matched is true.
external.CompressedRistretto shared_secret = 4;
}
//
// b58 Codes
//
// Decode a base-58 encoded "MobileCoin Request Code" into receiver's public address, value, and memo.
message ParseRequestCodeRequest {
string b58_code = 1;
}
message ParseRequestCodeResponse {
external.PublicAddress receiver = 1;
uint64 value = 2;
string memo = 3;
uint64 token_id = 4;
}
// Encode receiver's public address, value, and memo into a base-58 "MobileCoin Request Code".
message CreateRequestCodeRequest {
external.PublicAddress receiver = 1;
uint64 value = 2;
string memo = 3;
uint64 token_id = 4;
}
message CreateRequestCodeResponse {
string b58_code = 1;
}
// Decode a base-58 encoded "MobileCoin Transfer Code" into entropy/tx_public_key/memo.
// This code provides a mobile client with everything required to construct a self-payment, allowing funds to be withdrawn from a gift card.
message ParseTransferCodeRequest {
string b58_code = 1;
}
message ParseTransferCodeResponse {
bytes root_entropy = 1 [deprecated=true];
external.CompressedRistretto tx_public_key = 2;
string memo = 3;
UnspentTxOut utxo = 4;
bytes bip39_entropy = 5;
}
// Encode entropy/tx_public_key/memo into a base-58 "MobileCoin Transfer Code".
message CreateTransferCodeRequest {
bytes root_entropy = 1 [deprecated=true];
external.CompressedRistretto tx_public_key = 2;
string memo = 3;
bytes bip39_entropy = 4;
}
message CreateTransferCodeResponse {
string b58_code = 1;
}
// Decode a base-58 encoded "MobileCoin Address Code" into the receiver's public address.
message ParseAddressCodeRequest {
string b58_code = 1;
}
message ParseAddressCodeResponse {
external.PublicAddress receiver = 1;
}
// Encode receiver's public address into a base-58 "MobileCoin Address Code".
message CreateAddressCodeRequest {
external.PublicAddress receiver = 1;
}
message CreateAddressCodeResponse {
string b58_code = 1;
}
//
// Transactions
//
message TxOutWithProof {
external.TxOut output = 1;
external.TxOutMembershipProof proof = 2;
}
message GetMixinsRequest {
uint64 num_mixins = 1;
repeated external.TxOut excluded = 2;
}
message GetMixinsResponse {
repeated TxOutWithProof mixins = 1;
}
// Get membership proofs either by TxOuts or by TxOut indices.
message GetMembershipProofsRequest {
repeated external.TxOut outputs = 1;
repeated uint64 indices = 2;
}
message GetMembershipProofsResponse {
repeated TxOutWithProof output_list = 1;
}
// Generate a transaction proposal object.
// Notes:
// - Sum of inputs needs to be greater than sum of outlays and fee.
// - The set of inputs to use would be chosen automatically by mobilecoind.
// - The fee field could be set to zero, in which case mobilecoind would choose a fee.
// Right now that fee is the network-reported minimum fee for the given token id.
message GenerateTxRequest {
// Monitor id sending the funds.
bytes sender_monitor_id = 1;
// Subaddress to return change to.
uint64 change_subaddress = 2;
// List of UnspentTxOuts to be spent by the transaction.
// All UnspentTxOuts must belong to the same sender_monitor_id.
// mobilecoind would choose a subset of these inputs to construct the transaction.
// Total input amount must be >= sum of outlays + fees.
repeated UnspentTxOut input_list = 3;
// Outputs to be generated by the transaction. This excludes change and fee.
repeated Outlay outlay_list = 4;
// Fee value, in smallest representable units (u64).
// (For MOB this is picoMOB.)
// Setting to 0 causes mobilecoind to choose a value.
// The value used can be checked (but not changed) in tx_proposal.tx.prefix.fee
uint64 fee = 5;
// Tombstone block (setting to 0 causes mobilecoind to choose a value).
// The value used can be checked (but not changed) in tx_proposal.tx.prefix.tombstone_block
uint64 tombstone = 6;
// Token id to use for the transaction.
uint64 token_id = 7;
// List of SCIs to be added to the transaction
repeated SciForTx scis = 8;
// TxOut memo to use for the transaction.
// This defaults to RTH authenticated sender from the default subaddress of the sender monitor.
TransactionMemo memo = 9;
}
message GenerateTxResponse {
TxProposal tx_proposal = 1;
}
// Generate a transaction proposal object with mixed token types.
// Notes:
// - Sum of inputs needs to be greater than or equal to the sum of outlays and fee.
// - The set of inputs to use would be chosen automatically by mobilecoind.
// - The fee field could be set to zero, in which case mobilecoind would choose a fee.
// Right now that fee is the network-reported minimum fee for the fee token id.
message GenerateMixedTxRequest {
// Monitor id sending the funds.
bytes sender_monitor_id = 1;
// Subaddress to return change to.
uint64 change_subaddress = 2;
// List of UnspentTxOuts to be spent by the transaction.
// All UnspentTxOuts must belong to the same sender_monitor_id.
// mobilecoind would choose a subset of these inputs to construct the transaction.
// Total input amount must be >= sum of outlays + fees, for each token id involved.
repeated UnspentTxOut input_list = 3;
// List of SCIs to be added to the transaction
repeated SciForTx scis = 4;
// Outputs to be generated by the transaction. This excludes change and fee.
repeated OutlayV2 outlay_list = 5;
// Fee value, in smallest representable units (u64).
// (For MOB this is picoMOB.)
// Setting to 0 causes mobilecoind to choose a value.
// The value used can be checked (but not changed) in tx_proposal.tx.prefix.fee
uint64 fee = 6;
// Token id to use for the transaction fee.
uint64 fee_token_id = 7;
// Tombstone block (setting to 0 causes mobilecoind to choose a value).
// The value used can be checked (but not changed) in tx_proposal.tx.prefix.tombstone_block
uint64 tombstone = 8;
}
message GenerateMixedTxResponse {
TxProposal tx_proposal = 1;
}
// Generate a transaction that merges a few UnspentTxOuts into one, in order to reduce wallet fragmentation.
message GenerateOptimizationTxRequest {
// Monitor Id to operate on.
bytes monitor_id = 1;
// Subaddress to operate on.
uint64 subaddress = 2;
// Add an optional fee
uint64 fee = 3;
// Token id to use for the transaction.
uint64 token_id = 4;
}
message GenerateOptimizationTxResponse {
TxProposal tx_proposal = 1;
}
// Generate a transaction that can be used for a "MobileCoin Transfer Code"
message GenerateTransferCodeTxRequest {
bytes sender_monitor_id = 1;
uint64 change_subaddress = 2;
repeated UnspentTxOut input_list = 3;
uint64 value = 4;
uint64 fee = 5;
uint64 tombstone = 6;
string memo = 7;
uint64 token_id = 8;
}
message GenerateTransferCodeTxResponse {
// The tx proposal to submit to the network.
TxProposal tx_proposal = 1;
// Deprecated - left here as an explanation to why we skip tag 2: bytes root_entropy = 2;
// The TxOut public key that has the funds.
external.CompressedRistretto tx_public_key = 3;
// The memo (simply copied from the request).
string memo = 4;
// The b58-encoded Transfer Code
string b58_code = 5;
// The entropy for constructing the AccountKey that can access the funds.
bytes bip39_entropy = 6;
}
// Generate a transaction without a monitor, requires an account key and
// a list of UnspentTxOuts. All coins (minus the fee) are transferred to
// a single recipient. Used for temporary accounts like gift codes.
// All inputs must be of the same token id.
message GenerateTxFromTxOutListRequest {
// Account key that owns the transactions
external.AccountKey account_key = 1;
// List of TxOuts to spend
repeated UnspentTxOut input_list = 2;
// Address to transfer coins to
external.PublicAddress receiver = 3;
// Fee
uint64 fee = 4;
// Token id
uint64 token_id = 5;
}
message GenerateTxFromTxOutListResponse {
TxProposal tx_proposal = 1;
}
// Generate a burn redemption transaction proposal object.
// Notes:
// - Sum of inputs needs to be greater than or equal to the burn amount and fee.
// - The set of inputs to use would be chosen automatically by mobilecoind.
// - The fee field could be set to zero, in which case mobilecoind would try and choose a fee.
message GenerateBurnRedemptionTxRequest {
// Monitor id sending the funds.
bytes sender_monitor_id = 1;
// Subaddress to return change to.
uint64 change_subaddress = 2;
// List of UnspentTxOuts to be spent by the transaction.
// All UnspentTxOuts must belong to the same sender_monitor_id.
// mobilecoind would choose a subset of these inputs to construct the transaction.
// Total input amount must be >= burn amount + fee.
repeated UnspentTxOut input_list = 3;
// Amount to be burnt. This excludes change and fee.
uint64 burn_amount = 4;
// Fee (setting to 0 causes mobilecoind to choose a value).
// The value used can be checked (but not changed) in tx_proposal.tx.prefix.fee
uint64 fee = 5;
// Tombstone block (setting to 0 causes mobilecoind to choose a value).
// The value used can be checked (but not changed) in tx_proposal.tx.prefix.tombstone_block
uint64 tombstone = 6;
// Token id to use for the transaction.
uint64 token_id = 7;
// Optional 64 bytes of data to include in the burn redemption memo that is attached to the burn TxOut.
// If not provided zeros will be used.
bytes redemption_memo = 8;
// Enable RTH destination memo.
bool enable_destination_memo = 9;
}
message GenerateBurnRedemptionTxResponse {
TxProposal tx_proposal = 1;
}
// Generate a simple swap proposal. The result is a signed contingent input
// which trades one currency for another and is suitable for use with the deqs.
// (This API is restrictive and doesn't let you build more complex SCIs.)
message GenerateSwapRequest {
// Monitor id sending the funds.
bytes sender_monitor_id = 1;
// Subaddress to return change to.
uint64 change_subaddress = 2;
// A specific input, whose value will be offered in full by the swap.
//
// This becomes the "base token" amount from the point of view of a quoting service.
//
// You may need to conduct a self-spend first to make an input of exactly
// the correct value before using this API if none of your inputs match
// the volume of the quote you want to make.
UnspentTxOut input = 3;
// The u64 value we are asking for in exchange for our input
//
// This becomes the "counter token" value from the point of view of a quoting service.
uint64 counter_value = 4;
// The token_id we are asking for in exchange for our input
//
// This becomes the "counter token" token id from the point of view of a quoting service.
uint64 counter_token_id = 5;
// If set to false, the offer is "all or nothing", the entire counter token value must be supplied,
// in exchange for the entire value of the input we are signing over.
// Otherwise, it is a "partial-fill" SCI, and can be filled at less than the maximum volume for
// proportionally more of the input value.
bool allow_partial_fill = 6;
// The smallest u64 value that we will accept to conduct the swap.
// This can be set to avoid receiving "dust" amounts when allow_partial_fill is true.
// This is ignored if allow_partial_fill is false.
uint64 minimum_fill_value = 7;
// Tombstone block (setting to 0 means this offer does not expire).
uint64 tombstone = 8;
}
message GenerateSwapResponse {
external.SignedContingentInput sci = 1;
}
// Submits a transaction to the network.
message SubmitTxRequest {
TxProposal tx_proposal = 1;
}
message SubmitTxResponse {
SenderTxReceipt sender_tx_receipt = 1;
repeated ReceiverTxReceipt receiver_tx_receipt_list = 2;
}
//
// Databases
//
// Get information about the downloaded ledger.
// - empty request
message GetLedgerInfoResponse {
// Total number of blocks in the ledger.
uint64 block_count = 1;
// Total number of TxOuts in the ledger.
uint64 txo_count = 2;
}
// Get information about a downloaded block.
message GetBlockInfoRequest {
uint64 block = 1;
}
message GetBlockInfoResponse {
// Number of key images in the block.
uint64 key_image_count = 1;
// Number of TxOuts in the block.
uint64 txo_count = 2;
}
message ArchiveBlockSignatureData {
// The origin of the Archive Block.
string src_url = 1;
// The archive filename.
string filename = 2;
// The block signature.
blockchain.BlockSignature signature = 3;
}
// Get more detailed information about a downloaded block
message GetBlockRequest {
uint64 block = 1;
}
message GetBlockResponse {
// The block
blockchain.Block block = 1;
// Signatures for this block
repeated ArchiveBlockSignatureData signatures = 2;
// Key images in the block
repeated external.KeyImage key_images = 3;
// TxOuts in the block.
repeated external.TxOut txos = 4;
// Timestamp result code
watcher.TimestampResultCode timestamp_result_code = 5;
// Timestamp (only valid if timestamp_result_code is TimestampFound)
uint64 timestamp = 6;
}
// Get multiple block datas coupled with timestamps
message GetBlocksDataRequest {
// List of block numbers to query
repeated uint64 blocks = 1;
}
message BlockDataWithTimestamp {
/// The block index that was requested.
uint64 block_index = 1;
/// Whether we found a block for the provided index.
bool found = 2;
/// The block data
blockchain.ArchiveBlock block_data = 3;
// Timestamp result code
watcher.TimestampResultCode timestamp_result_code = 4;
// Timestamp (only valid if timestamp_result_code is TimestampFound)
uint64 timestamp = 5;
}
message GetBlocksDataResponse {
/// Result (one for each index in the request)
repeated BlockDataWithTimestamp results = 1;
/// Latest block in the ledger.
blockchain.Block latest_block = 2;
}
// Get the status of a submitted transaction as the Sender.
message GetTxStatusAsSenderResponse {
TxStatus status = 1;
}
// Get the status of a submitted transaction as the Recipient (using the tx public key).
message GetTxStatusAsReceiverRequest {
ReceiverTxReceipt receipt = 1;
// Optionally pass in a monitor ID to validate confirmation number
bytes monitor_id = 2;
}
message GetTxStatusAsReceiverResponse {
TxStatus status = 1;
}
// Get the contents of a processed block.
message GetProcessedBlockRequest {
// Monitor id to query data for.
bytes monitor_id = 1;