messages-ethereum.proto 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. // This file originates from the SatoshiLabs Trezor `common` repository at:
  2. // https://github.com/trezor/trezor-common/blob/master/protob/messages-ethereum.proto
  3. // dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9.
  4. syntax = "proto2";
  5. package hw.trezor.messages.ethereum;
  6. // Sugar for easier handling in Java
  7. option java_package = "com.satoshilabs.trezor.lib.protobuf";
  8. option java_outer_classname = "TrezorMessageEthereum";
  9. import "messages-common.proto";
  10. /**
  11. * Request: Ask device for public key corresponding to address_n path
  12. * @start
  13. * @next EthereumPublicKey
  14. * @next Failure
  15. */
  16. message EthereumGetPublicKey {
  17. repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
  18. optional bool show_display = 2; // optionally show on display before sending the result
  19. }
  20. /**
  21. * Response: Contains public key derived from device private seed
  22. * @end
  23. */
  24. message EthereumPublicKey {
  25. optional hw.trezor.messages.common.HDNodeType node = 1; // BIP32 public node
  26. optional string xpub = 2; // serialized form of public node
  27. }
  28. /**
  29. * Request: Ask device for Ethereum address corresponding to address_n path
  30. * @start
  31. * @next EthereumAddress
  32. * @next Failure
  33. */
  34. message EthereumGetAddress {
  35. repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
  36. optional bool show_display = 2; // optionally show on display before sending the result
  37. }
  38. /**
  39. * Response: Contains an Ethereum address derived from device private seed
  40. * @end
  41. */
  42. message EthereumAddress {
  43. optional bytes addressBin = 1; // Ethereum address as 20 bytes (legacy firmwares)
  44. optional string addressHex = 2; // Ethereum address as hex string (newer firmwares)
  45. }
  46. /**
  47. * Request: Ask device to sign transaction
  48. * All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
  49. * Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
  50. * @start
  51. * @next EthereumTxRequest
  52. * @next Failure
  53. */
  54. message EthereumSignTx {
  55. repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
  56. optional bytes nonce = 2; // <=256 bit unsigned big endian
  57. optional bytes gas_price = 3; // <=256 bit unsigned big endian (in wei)
  58. optional bytes gas_limit = 4; // <=256 bit unsigned big endian
  59. optional bytes toBin = 5; // recipient address (20 bytes, legacy firmware)
  60. optional string toHex = 11; // recipient address (hex string, newer firmware)
  61. optional bytes value = 6; // <=256 bit unsigned big endian (in wei)
  62. optional bytes data_initial_chunk = 7; // The initial data chunk (<= 1024 bytes)
  63. optional uint32 data_length = 8; // Length of transaction payload
  64. optional uint32 chain_id = 9; // Chain Id for EIP 155
  65. optional uint32 tx_type = 10; // (only for Wanchain)
  66. }
  67. /**
  68. * Response: Device asks for more data from transaction payload, or returns the signature.
  69. * If data_length is set, device awaits that many more bytes of payload.
  70. * Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
  71. * @end
  72. * @next EthereumTxAck
  73. */
  74. message EthereumTxRequest {
  75. optional uint32 data_length = 1; // Number of bytes being requested (<= 1024)
  76. optional uint32 signature_v = 2; // Computed signature (recovery parameter, limited to 27 or 28)
  77. optional bytes signature_r = 3; // Computed signature R component (256 bit)
  78. optional bytes signature_s = 4; // Computed signature S component (256 bit)
  79. }
  80. /**
  81. * Request: Transaction payload data.
  82. * @next EthereumTxRequest
  83. */
  84. message EthereumTxAck {
  85. optional bytes data_chunk = 1; // Bytes from transaction payload (<= 1024 bytes)
  86. }
  87. /**
  88. * Request: Ask device to sign message
  89. * @start
  90. * @next EthereumMessageSignature
  91. * @next Failure
  92. */
  93. message EthereumSignMessage {
  94. repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
  95. optional bytes message = 2; // message to be signed
  96. }
  97. /**
  98. * Response: Signed message
  99. * @end
  100. */
  101. message EthereumMessageSignature {
  102. optional bytes addressBin = 1; // address used to sign the message (20 bytes, legacy firmware)
  103. optional bytes signature = 2; // signature of the message
  104. optional string addressHex = 3; // address used to sign the message (hex string, newer firmware)
  105. }
  106. /**
  107. * Request: Ask device to verify message
  108. * @start
  109. * @next Success
  110. * @next Failure
  111. */
  112. message EthereumVerifyMessage {
  113. optional bytes addressBin = 1; // address to verify (20 bytes, legacy firmware)
  114. optional bytes signature = 2; // signature to verify
  115. optional bytes message = 3; // message to verify
  116. optional string addressHex = 4; // address to verify (hex string, newer firmware)
  117. }