| 1 |
syntax = "proto2"; |
| 2 |
package hw.trezor.messages.monero; |
| 3 |
|
| 4 |
// Sugar for easier handling in Java |
| 5 |
option java_package = "com.satoshilabs.trezor.lib.protobuf"; |
| 6 |
option java_outer_classname = "TrezorMessageMonero"; |
| 7 |
|
| 8 |
/** |
| 9 |
* Structure representing Monero transaction source entry, UTXO |
| 10 |
* @embed |
| 11 |
*/ |
| 12 |
message MoneroTransactionSourceEntry { |
| 13 |
repeated MoneroOutputEntry outputs = 1; // all outputs including decoys (forms the ring) |
| 14 |
optional uint64 real_output = 2; // index denoting which item in `outputs` is our real output (not a decoy) |
| 15 |
optional bytes real_out_tx_key = 3; // tx key located in the real output's tx |
| 16 |
repeated bytes real_out_additional_tx_keys = 4; // additional tx keys if applicable |
| 17 |
optional uint64 real_output_in_tx_index = 5; // index of our real output in the tx (aka which output was it in the transaction) |
| 18 |
optional uint64 amount = 6; |
| 19 |
optional bool rct = 7; // is RingCT used (true for newer UTXOs) |
| 20 |
optional bytes mask = 8; |
| 21 |
optional MoneroMultisigKLRki multisig_kLRki = 9; |
| 22 |
optional uint32 subaddr_minor = 10; // minor subaddr index UTXO was sent to |
| 23 |
message MoneroOutputEntry { |
| 24 |
optional uint64 idx = 1; |
| 25 |
optional MoneroRctKeyPublic key = 2; |
| 26 |
message MoneroRctKeyPublic { |
| 27 |
optional bytes dest = 1; |
| 28 |
optional bytes commitment = 2; |
| 29 |
} |
| 30 |
} |
| 31 |
message MoneroMultisigKLRki { |
| 32 |
optional bytes K = 1; |
| 33 |
optional bytes L = 2; |
| 34 |
optional bytes R = 3; |
| 35 |
optional bytes ki = 4; |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Structure representing Monero transaction destination entry |
| 41 |
* @embed |
| 42 |
*/ |
| 43 |
message MoneroTransactionDestinationEntry { |
| 44 |
optional uint64 amount = 1; |
| 45 |
optional MoneroAccountPublicAddress addr = 2; |
| 46 |
optional bool is_subaddress = 3; |
| 47 |
optional bytes original = 4; |
| 48 |
optional bool is_integrated = 5; |
| 49 |
/** |
| 50 |
* Structure representing Monero public address |
| 51 |
*/ |
| 52 |
message MoneroAccountPublicAddress { |
| 53 |
optional bytes spend_public_key = 1; |
| 54 |
optional bytes view_public_key = 2; |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* Range sig parameters / data. |
| 60 |
* @embed |
| 61 |
*/ |
| 62 |
message MoneroTransactionRsigData { |
| 63 |
optional uint32 rsig_type = 1; // range signature (aka proof) type |
| 64 |
optional uint32 offload_type = 2; |
| 65 |
repeated uint64 grouping = 3; // aggregation scheme for BP |
| 66 |
|
| 67 |
optional bytes mask = 4; // mask vector |
| 68 |
optional bytes rsig = 5; // range sig data, all of it or partial (based on rsig_parts) |
| 69 |
repeated bytes rsig_parts = 6; |
| 70 |
optional uint32 bp_version = 7; // Bulletproof version |
| 71 |
} |
| 72 |
|
| 73 |
/** |
| 74 |
* Request: Ask device for public address derived from seed and address_n |
| 75 |
* @start |
| 76 |
* @next MoneroAddress |
| 77 |
* @next Failure |
| 78 |
*/ |
| 79 |
message MoneroGetAddress { |
| 80 |
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node |
| 81 |
optional bool show_display = 2; // Optionally show on display before sending the result |
| 82 |
optional uint32 network_type = 3; // Main-net / testnet / stagenet |
| 83 |
optional uint32 account = 4; // Major subaddr index |
| 84 |
optional uint32 minor = 5; // Minor subaddr index |
| 85 |
optional bytes payment_id = 6; // Payment ID for integrated address |
| 86 |
} |
| 87 |
|
| 88 |
/** |
| 89 |
* Response: Contains Monero watch-only credentials derived from device private seed |
| 90 |
* @end |
| 91 |
*/ |
| 92 |
message MoneroAddress { |
| 93 |
optional bytes address = 1; |
| 94 |
} |
| 95 |
|
| 96 |
/** |
| 97 |
* Request: Ask device for watch only credentials |
| 98 |
* @start |
| 99 |
* @next MoneroWatchKey |
| 100 |
* @next Failure |
| 101 |
*/ |
| 102 |
message MoneroGetWatchKey { |
| 103 |
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node |
| 104 |
optional uint32 network_type = 2; // Main-net / testnet / stagenet |
| 105 |
} |
| 106 |
|
| 107 |
/** |
| 108 |
* Response: Contains Monero watch-only credentials derived from device private seed |
| 109 |
* @end |
| 110 |
*/ |
| 111 |
message MoneroWatchKey { |
| 112 |
optional bytes watch_key = 1; |
| 113 |
optional bytes address = 2; |
| 114 |
} |
| 115 |
|
| 116 |
/** |
| 117 |
* Request: Sub request of MoneroTransactionSign. Initializes transaction signing. |
| 118 |
* @start |
| 119 |
* @next MoneroTransactionInitAck |
| 120 |
*/ |
| 121 |
message MoneroTransactionInitRequest { |
| 122 |
optional uint32 version = 1; |
| 123 |
repeated uint32 address_n = 2; |
| 124 |
optional uint32 network_type = 3; // Main-net / testnet / stagenet |
| 125 |
optional MoneroTransactionData tsx_data = 4; |
| 126 |
/** |
| 127 |
* Structure representing Monero initial transaction information |
| 128 |
*/ |
| 129 |
message MoneroTransactionData { |
| 130 |
optional uint32 version = 1; |
| 131 |
optional bytes payment_id = 2; |
| 132 |
optional uint64 unlock_time = 3; |
| 133 |
repeated MoneroTransactionDestinationEntry outputs = 4; |
| 134 |
optional MoneroTransactionDestinationEntry change_dts = 5; |
| 135 |
optional uint32 num_inputs = 6; |
| 136 |
optional uint32 mixin = 7; |
| 137 |
optional uint64 fee = 8; |
| 138 |
optional uint32 account = 9; |
| 139 |
repeated uint32 minor_indices = 10; |
| 140 |
optional MoneroTransactionRsigData rsig_data = 11; |
| 141 |
repeated uint32 integrated_indices = 12; |
| 142 |
optional uint32 client_version = 13; // connected client version |
| 143 |
optional uint32 hard_fork = 14; // transaction hard fork number |
| 144 |
optional bytes monero_version = 15; // monero software version |
| 145 |
} |
| 146 |
} |
| 147 |
|
| 148 |
/** |
| 149 |
* Response: Response to transaction signing initialization. |
| 150 |
* @next MoneroTransactionSetInputRequest |
| 151 |
*/ |
| 152 |
message MoneroTransactionInitAck { |
| 153 |
repeated bytes hmacs = 1; |
| 154 |
optional MoneroTransactionRsigData rsig_data = 2; |
| 155 |
} |
| 156 |
|
| 157 |
/** |
| 158 |
* Request: Sub request of MoneroTransactionSign. Sends one UTXO to device |
| 159 |
* @next MoneroTransactionSetInputAck |
| 160 |
*/ |
| 161 |
message MoneroTransactionSetInputRequest { |
| 162 |
optional MoneroTransactionSourceEntry src_entr = 1; |
| 163 |
} |
| 164 |
|
| 165 |
/** |
| 166 |
* Response: Response to setting UTXO for signature. Contains sealed values needed for further protocol steps. |
| 167 |
* @next MoneroTransactionSetInputAck |
| 168 |
* @next MoneroTransactionInputsPermutationRequest |
| 169 |
*/ |
| 170 |
message MoneroTransactionSetInputAck { |
| 171 |
optional bytes vini = 1; // xmrtypes.TxinToKey |
| 172 |
optional bytes vini_hmac = 2; |
| 173 |
optional bytes pseudo_out = 3; |
| 174 |
optional bytes pseudo_out_hmac = 4; |
| 175 |
optional bytes pseudo_out_alpha = 5; |
| 176 |
optional bytes spend_key = 6; |
| 177 |
} |
| 178 |
|
| 179 |
/** |
| 180 |
* Request: Sub request of MoneroTransactionSign. Permutation on key images. |
| 181 |
* @next MoneroTransactionInputsPermutationAck |
| 182 |
*/ |
| 183 |
message MoneroTransactionInputsPermutationRequest { |
| 184 |
repeated uint32 perm = 1; |
| 185 |
} |
| 186 |
|
| 187 |
/** |
| 188 |
* Response: Response to setting permutation on key images |
| 189 |
* @next MoneroTransactionInputViniRequest |
| 190 |
*/ |
| 191 |
message MoneroTransactionInputsPermutationAck { |
| 192 |
} |
| 193 |
|
| 194 |
/** |
| 195 |
* Request: Sub request of MoneroTransactionSign. Sends one UTXO to device together with sealed values. |
| 196 |
* @next MoneroTransactionInputViniAck |
| 197 |
*/ |
| 198 |
message MoneroTransactionInputViniRequest { |
| 199 |
optional MoneroTransactionSourceEntry src_entr = 1; |
| 200 |
optional bytes vini = 2; // xmrtypes.TxinToKey |
| 201 |
optional bytes vini_hmac = 3; |
| 202 |
optional bytes pseudo_out = 4; |
| 203 |
optional bytes pseudo_out_hmac = 5; |
| 204 |
optional uint32 orig_idx = 6; // original sort index, before sorting by key-images |
| 205 |
} |
| 206 |
|
| 207 |
/** |
| 208 |
* Response: Response to setting UTXO to the device |
| 209 |
* @next MoneroTransactionInputViniRequest |
| 210 |
* @next MoneroTransactionAllInputsSetRequest |
| 211 |
*/ |
| 212 |
message MoneroTransactionInputViniAck { |
| 213 |
} |
| 214 |
|
| 215 |
/** |
| 216 |
* Request: Sub request of MoneroTransactionSign. Sent after all inputs have been sent. Useful for rangeisg offloading. |
| 217 |
* @next MoneroTransactionAllInputsSetAck |
| 218 |
*/ |
| 219 |
message MoneroTransactionAllInputsSetRequest { |
| 220 |
} |
| 221 |
|
| 222 |
/** |
| 223 |
* Response: Response to after all inputs have been set. |
| 224 |
* @next MoneroTransactionSetOutputRequest |
| 225 |
*/ |
| 226 |
message MoneroTransactionAllInputsSetAck { |
| 227 |
optional MoneroTransactionRsigData rsig_data = 1; |
| 228 |
} |
| 229 |
|
| 230 |
/** |
| 231 |
* Request: Sub request of MoneroTransactionSign. Sends one transaction destination to device (HMACed) |
| 232 |
* @next MoneroTransactionSetOutputAck |
| 233 |
*/ |
| 234 |
message MoneroTransactionSetOutputRequest { |
| 235 |
optional MoneroTransactionDestinationEntry dst_entr = 1; |
| 236 |
optional bytes dst_entr_hmac = 2; |
| 237 |
optional MoneroTransactionRsigData rsig_data = 3; |
| 238 |
optional bool is_offloaded_bp = 4; // Extra message, with offloaded BP. |
| 239 |
} |
| 240 |
|
| 241 |
/** |
| 242 |
* Response: Response to setting transaction destination. Contains sealed values needed for further protocol steps. |
| 243 |
* @next MoneroTransactionSetOutputRequest |
| 244 |
* @next MoneroTransactionAllOutSetRequest |
| 245 |
*/ |
| 246 |
message MoneroTransactionSetOutputAck { |
| 247 |
optional bytes tx_out = 1; // xmrtypes.TxOut |
| 248 |
optional bytes vouti_hmac = 2; |
| 249 |
optional MoneroTransactionRsigData rsig_data = 3; |
| 250 |
optional bytes out_pk = 4; |
| 251 |
optional bytes ecdh_info = 5; |
| 252 |
} |
| 253 |
|
| 254 |
/** |
| 255 |
* Request: Sub request of MoneroTransactionSign. Sent after all outputs are sent. |
| 256 |
* @next MoneroTransactionAllOutSetAck |
| 257 |
*/ |
| 258 |
message MoneroTransactionAllOutSetRequest { |
| 259 |
optional MoneroTransactionRsigData rsig_data = 1; |
| 260 |
} |
| 261 |
|
| 262 |
/** |
| 263 |
* Response: After all outputs are sent the initial RCT signature fields are sent. |
| 264 |
* @next MoneroTransactionSignInputRequest |
| 265 |
*/ |
| 266 |
message MoneroTransactionAllOutSetAck { |
| 267 |
optional bytes extra = 1; |
| 268 |
optional bytes tx_prefix_hash = 2; |
| 269 |
optional MoneroRingCtSig rv = 4; // xmrtypes.RctSig |
| 270 |
optional bytes full_message_hash = 5; |
| 271 |
|
| 272 |
/* |
| 273 |
* Structure represents initial fields of the Monero RCT signature |
| 274 |
*/ |
| 275 |
message MoneroRingCtSig { |
| 276 |
optional uint64 txn_fee = 1; |
| 277 |
optional bytes message = 2; |
| 278 |
optional uint32 rv_type = 3; |
| 279 |
} |
| 280 |
} |
| 281 |
|
| 282 |
/** |
| 283 |
* Request: Sub request of MoneroTransactionSign. Sends UTXO for the signing. |
| 284 |
* @next MoneroTransactionSignInputAck |
| 285 |
*/ |
| 286 |
message MoneroTransactionSignInputRequest { |
| 287 |
optional MoneroTransactionSourceEntry src_entr = 1; |
| 288 |
optional bytes vini = 2; // xmrtypes.TxinToKey |
| 289 |
optional bytes vini_hmac = 3; |
| 290 |
optional bytes pseudo_out = 4; |
| 291 |
optional bytes pseudo_out_hmac = 5; |
| 292 |
optional bytes pseudo_out_alpha = 6; |
| 293 |
optional bytes spend_key = 7; |
| 294 |
optional uint32 orig_idx = 8; // original sort index, before sorting by key-images |
| 295 |
} |
| 296 |
|
| 297 |
/** |
| 298 |
* Response: Contains full MG signature of the UTXO + multisig data if applicable. |
| 299 |
* @next MoneroTransactionSignInputRequest |
| 300 |
* @next MoneroTransactionFinalRequest |
| 301 |
*/ |
| 302 |
message MoneroTransactionSignInputAck { |
| 303 |
optional bytes signature = 1; |
| 304 |
optional bytes pseudo_out = 2; // updated pseudo-out after mask correction |
| 305 |
} |
| 306 |
|
| 307 |
/** |
| 308 |
* Request: Sub request of MoneroTransactionSign. Final message of the procol after all UTXOs are signed |
| 309 |
* @next MoneroTransactionFinalAck |
| 310 |
*/ |
| 311 |
message MoneroTransactionFinalRequest { |
| 312 |
} |
| 313 |
|
| 314 |
/** |
| 315 |
* Response: Contains transaction metadata and encryption keys needed for further transaction operations (e.g. multisig, send proof). |
| 316 |
* @end |
| 317 |
*/ |
| 318 |
message MoneroTransactionFinalAck { |
| 319 |
optional bytes cout_key = 1; |
| 320 |
optional bytes salt = 2; |
| 321 |
optional bytes rand_mult = 3; |
| 322 |
optional bytes tx_enc_keys = 4; |
| 323 |
optional bytes opening_key = 5; // enc master key to decrypt MLSAGs after protocol finishes correctly |
| 324 |
} |
| 325 |
|
| 326 |
/** |
| 327 |
* Request: Sub request of MoneroKeyImageSync. Initializing key image sync. |
| 328 |
* @start |
| 329 |
* @next MoneroKeyImageExportInitAck |
| 330 |
*/ |
| 331 |
message MoneroKeyImageExportInitRequest { |
| 332 |
optional uint64 num = 1; |
| 333 |
optional bytes hash = 2; |
| 334 |
repeated uint32 address_n = 3; // BIP-32 path to derive the key from master node |
| 335 |
optional uint32 network_type = 4; // Main-net / testnet / stagenet |
| 336 |
repeated MoneroSubAddressIndicesList subs = 5; |
| 337 |
/** |
| 338 |
* Structure representing Monero list of sub-addresses |
| 339 |
*/ |
| 340 |
message MoneroSubAddressIndicesList { |
| 341 |
optional uint32 account = 1; |
| 342 |
repeated uint32 minor_indices = 2; |
| 343 |
} |
| 344 |
} |
| 345 |
|
| 346 |
/** |
| 347 |
* Response: Response to key image sync initialization. |
| 348 |
* @next MoneroKeyImageSyncStepRequest |
| 349 |
*/ |
| 350 |
message MoneroKeyImageExportInitAck { |
| 351 |
} |
| 352 |
|
| 353 |
/** |
| 354 |
* Request: Sub request of MoneroKeyImageSync. Contains batch of the UTXO to export key image for. |
| 355 |
* @next MoneroKeyImageSyncStepAck |
| 356 |
*/ |
| 357 |
message MoneroKeyImageSyncStepRequest { |
| 358 |
repeated MoneroTransferDetails tdis = 1; |
| 359 |
/** |
| 360 |
* Structure representing Monero UTXO for key image sync |
| 361 |
*/ |
| 362 |
message MoneroTransferDetails { |
| 363 |
optional bytes out_key = 1; |
| 364 |
optional bytes tx_pub_key = 2; |
| 365 |
repeated bytes additional_tx_pub_keys = 3; |
| 366 |
optional uint64 internal_output_index = 4; |
| 367 |
optional uint32 sub_addr_major = 5; |
| 368 |
optional uint32 sub_addr_minor = 6; |
| 369 |
} |
| 370 |
} |
| 371 |
|
| 372 |
/** |
| 373 |
* Response: Response to key image sync step. Contains encrypted exported key image. |
| 374 |
* @next MoneroKeyImageSyncStepRequest |
| 375 |
* @next MoneroKeyImageSyncFinalRequest |
| 376 |
*/ |
| 377 |
message MoneroKeyImageSyncStepAck { |
| 378 |
repeated MoneroExportedKeyImage kis = 1; |
| 379 |
/** |
| 380 |
* Structure representing Monero encrypted exported key image |
| 381 |
*/ |
| 382 |
message MoneroExportedKeyImage { |
| 383 |
optional bytes iv = 1; |
| 384 |
optional bytes blob = 3; |
| 385 |
} |
| 386 |
} |
| 387 |
|
| 388 |
/** |
| 389 |
* Request: Sub request of MoneroKeyImageSync. Final message of the sync protocol. |
| 390 |
* @next MoneroKeyImageSyncFinalAck |
| 391 |
*/ |
| 392 |
message MoneroKeyImageSyncFinalRequest { |
| 393 |
} |
| 394 |
|
| 395 |
/** |
| 396 |
* Response: Response to key image sync step. Contains encryption keys for exported key images. |
| 397 |
* @end |
| 398 |
*/ |
| 399 |
message MoneroKeyImageSyncFinalAck { |
| 400 |
optional bytes enc_key = 1; |
| 401 |
} |
| 402 |
|
| 403 |
/** |
| 404 |
* Request: Decrypt tx private keys blob |
| 405 |
* @next MoneroGetTxKeyAck |
| 406 |
*/ |
| 407 |
message MoneroGetTxKeyRequest { |
| 408 |
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node |
| 409 |
optional uint32 network_type = 2; // Main-net / testnet / stagenet |
| 410 |
|
| 411 |
optional bytes salt1 = 3; |
| 412 |
optional bytes salt2 = 4; |
| 413 |
optional bytes tx_enc_keys = 5; |
| 414 |
optional bytes tx_prefix_hash = 6; |
| 415 |
optional uint32 reason = 7; // reason to display for user. e.g., tx_proof |
| 416 |
optional bytes view_public_key = 8; // addr for derivation |
| 417 |
} |
| 418 |
|
| 419 |
/** |
| 420 |
* Response: Response with the re-encrypted private keys and derivations blob under view key |
| 421 |
* @end |
| 422 |
*/ |
| 423 |
message MoneroGetTxKeyAck { |
| 424 |
optional bytes salt = 1; |
| 425 |
optional bytes tx_keys = 2; |
| 426 |
optional bytes tx_derivations = 3; |
| 427 |
} |
| 428 |
|
| 429 |
/** |
| 430 |
* Request: Starts live refresh flow. Asks user permission, switches state |
| 431 |
* @next MoneroLiveRefreshStartAck |
| 432 |
*/ |
| 433 |
message MoneroLiveRefreshStartRequest { |
| 434 |
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node |
| 435 |
optional uint32 network_type = 2; // Main-net / testnet / stagenet |
| 436 |
} |
| 437 |
|
| 438 |
/** |
| 439 |
* Response after user gave permission |
| 440 |
* @next MoneroLiveRefreshStepRequest |
| 441 |
* @next MoneroLiveRefreshFinalRequest |
| 442 |
*/ |
| 443 |
message MoneroLiveRefreshStartAck { |
| 444 |
|
| 445 |
} |
| 446 |
|
| 447 |
/** |
| 448 |
* Request: Request to compute a single key image during live sync |
| 449 |
* @next MoneroLiveRefreshStepAck |
| 450 |
*/ |
| 451 |
message MoneroLiveRefreshStepRequest { |
| 452 |
optional bytes out_key = 1; |
| 453 |
optional bytes recv_deriv = 2; |
| 454 |
optional uint64 real_out_idx = 3; |
| 455 |
optional uint32 sub_addr_major = 4; |
| 456 |
optional uint32 sub_addr_minor = 5; |
| 457 |
} |
| 458 |
|
| 459 |
/** |
| 460 |
* Response: Response with the encrypted key image + signature |
| 461 |
* @next MoneroLiveRefreshStepRequest |
| 462 |
* @next MoneroLiveRefreshFinishedRequest |
| 463 |
*/ |
| 464 |
message MoneroLiveRefreshStepAck { |
| 465 |
optional bytes salt = 1; |
| 466 |
optional bytes key_image = 2; |
| 467 |
} |
| 468 |
|
| 469 |
/** |
| 470 |
* Request: Request terminating live refresh mode. |
| 471 |
* @next MoneroLiveRefreshFinishedAck |
| 472 |
*/ |
| 473 |
message MoneroLiveRefreshFinalRequest { |
| 474 |
|
| 475 |
} |
| 476 |
|
| 477 |
/** |
| 478 |
* Response: Response on termination of live refresh mode. |
| 479 |
* @end |
| 480 |
*/ |
| 481 |
message MoneroLiveRefreshFinalAck { |
| 482 |
|
| 483 |
} |
| 484 |
|
| 485 |
/** |
| 486 |
* Request: Universal Monero protocol implementation diagnosis request. |
| 487 |
* @start |
| 488 |
* @next DebugMoneroDiagAck |
| 489 |
*/ |
| 490 |
message DebugMoneroDiagRequest { |
| 491 |
optional uint64 ins = 1; |
| 492 |
optional uint64 p1 = 2; |
| 493 |
optional uint64 p2 = 3; |
| 494 |
repeated uint64 pd = 4; |
| 495 |
optional bytes data1 = 5; |
| 496 |
optional bytes data2 = 6; |
| 497 |
} |
| 498 |
|
| 499 |
/** |
| 500 |
* Response: Response to Monero diagnosis protocol. |
| 501 |
* @end |
| 502 |
*/ |
| 503 |
message DebugMoneroDiagAck { |
| 504 |
optional uint64 ins = 1; |
| 505 |
optional uint64 p1 = 2; |
| 506 |
optional uint64 p2 = 3; |
| 507 |
repeated uint64 pd = 4; |
| 508 |
optional bytes data1 = 5; |
| 509 |
optional bytes data2 = 6; |
| 510 |
} |