mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-16 04:29:08 +00:00
173 lines
4.7 KiB
Protocol Buffer
173 lines
4.7 KiB
Protocol Buffer
/**
|
|
* Types for TREZOR communication
|
|
*
|
|
* @author Marek Palatinus <slush@satoshilabs.com>
|
|
* @version 0.6
|
|
*/
|
|
|
|
// Sugar for easier handling in Java
|
|
option java_package = "com.satoshilabs.trezor.protobuf";
|
|
option java_outer_classname = "TrezorType";
|
|
|
|
import "google/protobuf/descriptor.proto";
|
|
|
|
/**
|
|
* Options for specifying message direction and type of wire (normal/debug)
|
|
*/
|
|
extend google.protobuf.EnumValueOptions {
|
|
optional bool wire_in = 50002; // message can be transmitted via wire from PC to TREZOR
|
|
optional bool wire_out = 50003; // message can be transmitted via wire from TREZOR to PC
|
|
optional bool wire_debug_in = 50004; // message can be transmitted via debug wire from PC to TREZOR
|
|
optional bool wire_debug_out = 50005; // message can be transmitted via debug wire from TREZOR to PC
|
|
}
|
|
|
|
/**
|
|
* Type of failures returned by Failure message
|
|
* @used_in Failure
|
|
*/
|
|
enum FailureType {
|
|
Failure_UnexpectedMessage = 1;
|
|
Failure_ButtonExpected = 2;
|
|
Failure_SyntaxError = 3;
|
|
Failure_ActionCancelled = 4;
|
|
Failure_PinExpected = 5;
|
|
Failure_PinCancelled = 6;
|
|
Failure_PinInvalid = 7;
|
|
Failure_InvalidSignature = 8;
|
|
Failure_Other = 9;
|
|
Failure_NotEnoughFunds = 10;
|
|
Failure_NotInitialized = 11;
|
|
Failure_FirmwareError = 99;
|
|
}
|
|
|
|
/**
|
|
* Type of script which will be used for transaction output
|
|
* @used_in TxOutputType
|
|
*/
|
|
enum ScriptType {
|
|
PAYTOADDRESS = 0;
|
|
PAYTOSCRIPTHASH = 1;
|
|
}
|
|
|
|
/**
|
|
* Type of information required by transaction signing process
|
|
* @used_in TxRequest
|
|
*/
|
|
enum RequestType {
|
|
TXINPUT = 0;
|
|
TXOUTPUT = 1;
|
|
TXMETA = 2;
|
|
TXFINISHED = 3;
|
|
}
|
|
|
|
/**
|
|
* Type of button request
|
|
* @used_in ButtonRequest
|
|
*/
|
|
enum ButtonRequestType {
|
|
ButtonRequest_Other = 1;
|
|
ButtonRequest_FeeOverThreshold = 2;
|
|
ButtonRequest_ConfirmOutput = 3;
|
|
ButtonRequest_ResetDevice = 4;
|
|
ButtonRequest_ConfirmWord = 5;
|
|
ButtonRequest_WipeDevice = 6;
|
|
ButtonRequest_ProtectCall = 7;
|
|
ButtonRequest_SignTx = 8;
|
|
}
|
|
|
|
/**
|
|
* Type of PIN request
|
|
* @used_in PinMatrixRequest
|
|
*/
|
|
enum PinMatrixRequestType {
|
|
PinMatrixRequestType_Current = 1;
|
|
PinMatrixRequestType_NewFirst = 2;
|
|
PinMatrixRequestType_NewSecond = 3;
|
|
}
|
|
|
|
/**
|
|
* Structure representing BIP32 (hierarchical deterministic) node
|
|
* Used for imports of private key into the device and exporting public key out of device
|
|
* @used_in PublicKey
|
|
* @used_in LoadDevice
|
|
* @used_in DebugLinkState
|
|
* @used_in Storage
|
|
*/
|
|
message HDNodeType {
|
|
required uint32 depth = 1;
|
|
required uint32 fingerprint = 2;
|
|
required uint32 child_num = 3;
|
|
required bytes chain_code = 4;
|
|
optional bytes private_key = 5;
|
|
optional bytes public_key = 6;
|
|
}
|
|
|
|
/**
|
|
* Structure representing Coin
|
|
* @used_in Features
|
|
*/
|
|
message CoinType {
|
|
optional string coin_name = 1;
|
|
optional string coin_shortcut = 2;
|
|
optional uint32 address_type = 3;
|
|
optional uint64 maxfee_kb = 4;
|
|
}
|
|
|
|
/**
|
|
* Structure representing transaction input
|
|
* @used_in SimpleSignTx
|
|
* @used_in TransactionType
|
|
*/
|
|
message TxInputType {
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
required bytes prev_hash = 2; // hash of previous transaction output to spend by this input
|
|
required uint32 prev_index = 3; // index of previous output to spend
|
|
optional bytes script_sig = 4; // script signature
|
|
optional uint32 sequence = 5 [default=0xffffffff]; // sequence
|
|
}
|
|
|
|
/**
|
|
* Structure representing transaction output
|
|
* @used_in SimpleSignTx
|
|
* @used_in TransactionType
|
|
*/
|
|
message TxOutputType {
|
|
optional string address = 1; // target coin address in Base58 encoding
|
|
repeated uint32 address_n = 2; // BIP-32 path to derive the key from master node; has higher priority than "address"
|
|
required uint64 amount = 3; // amount to spend in satoshis
|
|
required ScriptType script_type = 4; // output script type
|
|
repeated bytes script_args = 5; // additional parameters for the script (script-dependent)
|
|
}
|
|
|
|
/**
|
|
* Structure representing compiled transaction output
|
|
* @used_in TransactionType
|
|
*/
|
|
message TxOutputBinType {
|
|
required uint64 amount = 1;
|
|
required bytes script_pubkey = 2;
|
|
}
|
|
|
|
/**
|
|
* Structure representing transaction
|
|
* @used_in SimpleSignTx
|
|
*/
|
|
message TransactionType {
|
|
optional uint32 version = 1;
|
|
repeated TxInputType inputs = 2;
|
|
repeated TxOutputBinType bin_outputs = 3;
|
|
repeated TxOutputType outputs = 5;
|
|
optional uint32 lock_time = 4;
|
|
}
|
|
|
|
message TxRequestDetailsType {
|
|
optional uint32 request_index = 1; // device expects TxAck message from the computer
|
|
optional bytes tx_hash = 2; // tx_hash of requested transaction
|
|
}
|
|
|
|
message TxRequestSerializedType {
|
|
optional uint32 signature_index = 1; // 'signature' field contains signed input of this index
|
|
optional bytes signature = 2; // signature of the signature_index input
|
|
optional bytes serialized_tx = 3; // part of serialized and signed transaction
|
|
}
|