1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00
trezor-firmware/protob/types.proto

114 lines
3.5 KiB
Protocol Buffer
Raw Normal View History

/*
Types for TREZOR communication
Author: Marek Palatinus <slush@satoshilabs.com>
Version: 0.6
*/
// Some sugar for easier handling in Multibit
option java_package = "org.multibit.hd.hardware.trezor.protobuf";
2014-02-03 22:13:09 +00:00
option java_outer_classname = "TrezorType";
import "google/protobuf/descriptor.proto";
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
}
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;
2014-01-18 04:13:47 +00:00
Failure_Other = 9;
2014-02-08 23:15:03 +00:00
Failure_NotEnoughFunds = 10;
2014-02-11 15:59:24 +00:00
Failure_NotInitialized = 11;
Failure_FirmwareError = 99;
}
// Specifies which script will be used for given transaction output.
enum ScriptType {
PAYTOADDRESS = 0;
PAYTOSCRIPTHASH = 1;
}
// Specifies which kind of information is required by transaction signing process
enum RequestType {
TXINPUT = 0;
TXOUTPUT = 1;
}
2014-02-04 16:47:29 +00:00
enum ButtonRequestType {
2014-02-06 09:34:50 +00:00
ButtonRequest_Other = 1;
ButtonRequest_FeeOverThreshold = 2;
ButtonRequest_ConfirmOutput = 3;
ButtonRequest_ResetDevice = 4;
ButtonRequest_ConfirmWord = 5;
ButtonRequest_WipeDevice = 6;
ButtonRequest_ProtectCall = 7;
2014-03-01 11:07:45 +00:00
ButtonRequest_SignTx = 8;
2014-02-04 16:47:29 +00:00
}
enum PinMatrixRequestType {
PinMatrixRequestType_Current = 1;
PinMatrixRequestType_NewFirst = 2;
PinMatrixRequestType_NewSecond = 3;
}
// Structure of BIP32 (hierarchical deterministic) node
// Used for imports of private key into the device and exporting public key out of device
message HDNodeType {
required uint32 depth = 1;
required uint32 fingerprint = 2;
required uint32 child_num = 3;
2014-03-01 10:17:06 +00:00
required bytes chain_code = 4;
optional bytes private_key = 5;
optional bytes public_key = 6;
}
message CoinType {
2014-03-01 10:17:06 +00:00
optional string coin_name = 1;
optional string coin_shortcut = 2;
optional uint32 address_type = 3;
optional uint64 maxfee_kb = 4;
}
message TxInputType {
repeated uint32 address_n = 1; // Parameter for address generation algorithm to derive the address from the master node
2014-03-01 10:17:06 +00:00
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
2014-03-01 10:17:06 +00:00
optional bytes script_sig = 4; // Script signature
optional uint32 sequence = 5 [default=0xffffffff];
}
message TxOutputType {
2014-03-01 10:17:06 +00:00
optional string address = 1; // Target bitcoin address in base58 encoding
repeated uint32 address_n = 2; // Has higher priority than "address".
required uint64 amount = 3; // Amount to send in satoshis
required ScriptType script_type = 4; // Select output script type
2014-03-01 10:17:06 +00:00
repeated bytes script_args = 5; // Provide additional parameters for the script (its script-depended)
}
// Transaction output with script pubkey in binary form.
// This is used for obtaining hashes of existing transactions
// and for compiling TxOutput for signing.
message TxOutputBinType {
required uint64 amount = 1;
2014-03-01 10:17:06 +00:00
required bytes script_pubkey = 2;
}
message TransactionType {
optional uint32 version = 1 [default=1];
repeated TxInputType inputs = 2;
repeated TxOutputBinType outputs = 3;
optional uint32 lock_time = 4 [default=0];
}