github.com/MaynardMiner/ethereumprogpow@v1.8.23/accounts/usbwallet/internal/trezor/types.proto (about) 1 // This file originates from the SatoshiLabs Trezor `common` repository at: 2 // https://github.com/trezor/trezor-common/blob/master/protob/types.proto 3 // dated 28.07.2017, commit dd8ec3231fb5f7992360aff9bdfe30bb58130f4b. 4 5 syntax = "proto2"; 6 7 /** 8 * Types for TREZOR communication 9 * 10 * @author Marek Palatinus <slush@satoshilabs.com> 11 * @version 1.2 12 */ 13 14 // Sugar for easier handling in Java 15 option java_package = "com.satoshilabs.trezor.lib.protobuf"; 16 option java_outer_classname = "TrezorType"; 17 18 import "google/protobuf/descriptor.proto"; 19 20 /** 21 * Options for specifying message direction and type of wire (normal/debug) 22 */ 23 extend google.protobuf.EnumValueOptions { 24 optional bool wire_in = 50002; // message can be transmitted via wire from PC to TREZOR 25 optional bool wire_out = 50003; // message can be transmitted via wire from TREZOR to PC 26 optional bool wire_debug_in = 50004; // message can be transmitted via debug wire from PC to TREZOR 27 optional bool wire_debug_out = 50005; // message can be transmitted via debug wire from TREZOR to PC 28 optional bool wire_tiny = 50006; // message is handled by TREZOR when the USB stack is in tiny mode 29 optional bool wire_bootloader = 50007; // message is only handled by TREZOR Bootloader 30 } 31 32 /** 33 * Type of failures returned by Failure message 34 * @used_in Failure 35 */ 36 enum FailureType { 37 Failure_UnexpectedMessage = 1; 38 Failure_ButtonExpected = 2; 39 Failure_DataError = 3; 40 Failure_ActionCancelled = 4; 41 Failure_PinExpected = 5; 42 Failure_PinCancelled = 6; 43 Failure_PinInvalid = 7; 44 Failure_InvalidSignature = 8; 45 Failure_ProcessError = 9; 46 Failure_NotEnoughFunds = 10; 47 Failure_NotInitialized = 11; 48 Failure_FirmwareError = 99; 49 } 50 51 /** 52 * Type of script which will be used for transaction output 53 * @used_in TxOutputType 54 */ 55 enum OutputScriptType { 56 PAYTOADDRESS = 0; // used for all addresses (bitcoin, p2sh, witness) 57 PAYTOSCRIPTHASH = 1; // p2sh address (deprecated; use PAYTOADDRESS) 58 PAYTOMULTISIG = 2; // only for change output 59 PAYTOOPRETURN = 3; // op_return 60 PAYTOWITNESS = 4; // only for change output 61 PAYTOP2SHWITNESS = 5; // only for change output 62 } 63 64 /** 65 * Type of script which will be used for transaction output 66 * @used_in TxInputType 67 */ 68 enum InputScriptType { 69 SPENDADDRESS = 0; // standard p2pkh address 70 SPENDMULTISIG = 1; // p2sh multisig address 71 EXTERNAL = 2; // reserved for external inputs (coinjoin) 72 SPENDWITNESS = 3; // native segwit 73 SPENDP2SHWITNESS = 4; // segwit over p2sh (backward compatible) 74 } 75 76 /** 77 * Type of information required by transaction signing process 78 * @used_in TxRequest 79 */ 80 enum RequestType { 81 TXINPUT = 0; 82 TXOUTPUT = 1; 83 TXMETA = 2; 84 TXFINISHED = 3; 85 TXEXTRADATA = 4; 86 } 87 88 /** 89 * Type of button request 90 * @used_in ButtonRequest 91 */ 92 enum ButtonRequestType { 93 ButtonRequest_Other = 1; 94 ButtonRequest_FeeOverThreshold = 2; 95 ButtonRequest_ConfirmOutput = 3; 96 ButtonRequest_ResetDevice = 4; 97 ButtonRequest_ConfirmWord = 5; 98 ButtonRequest_WipeDevice = 6; 99 ButtonRequest_ProtectCall = 7; 100 ButtonRequest_SignTx = 8; 101 ButtonRequest_FirmwareCheck = 9; 102 ButtonRequest_Address = 10; 103 ButtonRequest_PublicKey = 11; 104 } 105 106 /** 107 * Type of PIN request 108 * @used_in PinMatrixRequest 109 */ 110 enum PinMatrixRequestType { 111 PinMatrixRequestType_Current = 1; 112 PinMatrixRequestType_NewFirst = 2; 113 PinMatrixRequestType_NewSecond = 3; 114 } 115 116 /** 117 * Type of recovery procedure. These should be used as bitmask, e.g., 118 * `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix` 119 * listing every method supported by the host computer. 120 * 121 * Note that ScrambledWords must be supported by every implementation 122 * for backward compatibility; there is no way to not support it. 123 * 124 * @used_in RecoveryDevice 125 */ 126 enum RecoveryDeviceType { 127 // use powers of two when extending this field 128 RecoveryDeviceType_ScrambledWords = 0; // words in scrambled order 129 RecoveryDeviceType_Matrix = 1; // matrix recovery type 130 } 131 132 /** 133 * Type of Recovery Word request 134 * @used_in WordRequest 135 */ 136 enum WordRequestType { 137 WordRequestType_Plain = 0; 138 WordRequestType_Matrix9 = 1; 139 WordRequestType_Matrix6 = 2; 140 } 141 142 /** 143 * Structure representing BIP32 (hierarchical deterministic) node 144 * Used for imports of private key into the device and exporting public key out of device 145 * @used_in PublicKey 146 * @used_in LoadDevice 147 * @used_in DebugLinkState 148 * @used_in Storage 149 */ 150 message HDNodeType { 151 required uint32 depth = 1; 152 required uint32 fingerprint = 2; 153 required uint32 child_num = 3; 154 required bytes chain_code = 4; 155 optional bytes private_key = 5; 156 optional bytes public_key = 6; 157 } 158 159 message HDNodePathType { 160 required HDNodeType node = 1; // BIP-32 node in deserialized form 161 repeated uint32 address_n = 2; // BIP-32 path to derive the key from node 162 } 163 164 /** 165 * Structure representing Coin 166 * @used_in Features 167 */ 168 message CoinType { 169 optional string coin_name = 1; 170 optional string coin_shortcut = 2; 171 optional uint32 address_type = 3 [default=0]; 172 optional uint64 maxfee_kb = 4; 173 optional uint32 address_type_p2sh = 5 [default=5]; 174 optional string signed_message_header = 8; 175 optional uint32 xpub_magic = 9 [default=76067358]; // default=0x0488b21e 176 optional uint32 xprv_magic = 10 [default=76066276]; // default=0x0488ade4 177 optional bool segwit = 11; 178 optional uint32 forkid = 12; 179 } 180 181 /** 182 * Type of redeem script used in input 183 * @used_in TxInputType 184 */ 185 message MultisigRedeemScriptType { 186 repeated HDNodePathType pubkeys = 1; // pubkeys from multisig address (sorted lexicographically) 187 repeated bytes signatures = 2; // existing signatures for partially signed input 188 optional uint32 m = 3; // "m" from n, how many valid signatures is necessary for spending 189 } 190 191 /** 192 * Structure representing transaction input 193 * @used_in SimpleSignTx 194 * @used_in TransactionType 195 */ 196 message TxInputType { 197 repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node 198 required bytes prev_hash = 2; // hash of previous transaction output to spend by this input 199 required uint32 prev_index = 3; // index of previous output to spend 200 optional bytes script_sig = 4; // script signature, unset for tx to sign 201 optional uint32 sequence = 5 [default=4294967295]; // sequence (default=0xffffffff) 202 optional InputScriptType script_type = 6 [default=SPENDADDRESS]; // defines template of input script 203 optional MultisigRedeemScriptType multisig = 7; // Filled if input is going to spend multisig tx 204 optional uint64 amount = 8; // amount of previous transaction output (for segwit only) 205 } 206 207 /** 208 * Structure representing transaction output 209 * @used_in SimpleSignTx 210 * @used_in TransactionType 211 */ 212 message TxOutputType { 213 optional string address = 1; // target coin address in Base58 encoding 214 repeated uint32 address_n = 2; // BIP-32 path to derive the key from master node; has higher priority than "address" 215 required uint64 amount = 3; // amount to spend in satoshis 216 required OutputScriptType script_type = 4; // output script type 217 optional MultisigRedeemScriptType multisig = 5; // defines multisig address; script_type must be PAYTOMULTISIG 218 optional bytes op_return_data = 6; // defines op_return data; script_type must be PAYTOOPRETURN, amount must be 0 219 } 220 221 /** 222 * Structure representing compiled transaction output 223 * @used_in TransactionType 224 */ 225 message TxOutputBinType { 226 required uint64 amount = 1; 227 required bytes script_pubkey = 2; 228 } 229 230 /** 231 * Structure representing transaction 232 * @used_in SimpleSignTx 233 */ 234 message TransactionType { 235 optional uint32 version = 1; 236 repeated TxInputType inputs = 2; 237 repeated TxOutputBinType bin_outputs = 3; 238 repeated TxOutputType outputs = 5; 239 optional uint32 lock_time = 4; 240 optional uint32 inputs_cnt = 6; 241 optional uint32 outputs_cnt = 7; 242 optional bytes extra_data = 8; 243 optional uint32 extra_data_len = 9; 244 } 245 246 /** 247 * Structure representing request details 248 * @used_in TxRequest 249 */ 250 message TxRequestDetailsType { 251 optional uint32 request_index = 1; // device expects TxAck message from the computer 252 optional bytes tx_hash = 2; // tx_hash of requested transaction 253 optional uint32 extra_data_len = 3; // length of requested extra data 254 optional uint32 extra_data_offset = 4; // offset of requested extra data 255 } 256 257 /** 258 * Structure representing serialized data 259 * @used_in TxRequest 260 */ 261 message TxRequestSerializedType { 262 optional uint32 signature_index = 1; // 'signature' field contains signed input of this index 263 optional bytes signature = 2; // signature of the signature_index input 264 optional bytes serialized_tx = 3; // part of serialized and signed transaction 265 } 266 267 /** 268 * Structure representing identity data 269 * @used_in IdentityType 270 */ 271 message IdentityType { 272 optional string proto = 1; // proto part of URI 273 optional string user = 2; // user part of URI 274 optional string host = 3; // host part of URI 275 optional string port = 4; // port part of URI 276 optional string path = 5; // path part of URI 277 optional uint32 index = 6 [default=0]; // identity index 278 }