Skip to content

Commit

Permalink
Added structures for multisig and CipherKeyValue
Browse files Browse the repository at this point in the history
  • Loading branch information
admin-slush authored and prusnak committed Jun 5, 2014
1 parent 4eef0a9 commit f264f01
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 15 deletions.
26 changes: 23 additions & 3 deletions protob/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Messages for TREZOR communication
*
* @author Marek Palatinus <slush@satoshilabs.com>
* @version 0.6
* @version 1.2
*/

// Sugar for easier handling in Java
Expand Down Expand Up @@ -37,6 +37,7 @@ enum MessageType {
MessageType_Cancel = 20 [(wire_in) = true];
MessageType_TxRequest = 21 [(wire_out) = true];
MessageType_TxAck = 22 [(wire_in) = true];
MessageType_CipherKeyValue = 23 [(wire_in) = true];
MessageType_ApplySettings = 25 [(wire_in) = true];
MessageType_ButtonRequest = 26 [(wire_out) = true];
MessageType_ButtonAck = 27 [(wire_in) = true];
Expand Down Expand Up @@ -91,7 +92,7 @@ message Features {
optional bool initialized = 12; // does device contain seed?
optional bytes revision = 13; // SCM revision of firmware
optional bytes bootloader_hash = 14; // hash of the bootloader
optional bool imported = 15; // was storage imported from an external source?
optional bool imported = 15; // was storage imported from an external source?
}

/**
Expand Down Expand Up @@ -131,6 +132,7 @@ message Ping {
*/
message Success {
optional string message = 1; // human readable description of action or request-specific payload
optional bytes payload = 2; // request-specific binary payload
}

/**
Expand Down Expand Up @@ -378,6 +380,24 @@ message MessageSignature {
optional bytes signature = 2; // signature of the message
}

///////////////////////////
// Encryption/decryption //
///////////////////////////

/**
* Request: Ask device to encrypt or decrypt value of given key
* @next Success
* @next Failure
*/
message CipherKeyValue {
repeated uint32 address_n = 1;
optional string key = 2;
optional bytes value = 3;
optional bool encrypt = 4; // are we encrypting (True) or decrypting (False)?
optional bool ask_on_encrypt = 5; // should we ask on encrypt operation?
optional bool ask_on_decrypt = 6; // should we ask on decrypt operation?
}

//////////////////////////////////
// Transaction signing messages //
//////////////////////////////////
Expand Down Expand Up @@ -441,7 +461,7 @@ message SimpleSignTx {
* @prev TxAck
*/
message TxRequest {
optional RequestType request_type = 1; // what should be filled in TxAck message?
optional RequestType request_type = 1; // what should be filled in TxAck message?
optional TxRequestDetailsType details = 2; // request for tx details
optional TxRequestSerializedType serialized = 3; // serialized data and request for next
}
Expand Down
43 changes: 31 additions & 12 deletions protob/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Types for TREZOR communication
*
* @author Marek Palatinus <slush@satoshilabs.com>
* @version 0.6
* @version 1.2
*/

// Sugar for easier handling in Java
Expand Down Expand Up @@ -44,11 +44,20 @@ enum FailureType {
* Type of script which will be used for transaction output
* @used_in TxOutputType
*/
enum ScriptType {
enum OutputScriptType {
PAYTOADDRESS = 0;
PAYTOSCRIPTHASH = 1;
}

/**
* Type of script which will be used for transaction output
* @used_in TxInputType
*/
enum InputScriptType {
SPENDADDRESS = 0;
SPENDMULTISIG = 1;
}

/**
* Type of information required by transaction signing process
* @used_in TxRequest
Expand Down Expand Up @@ -113,17 +122,28 @@ message CoinType {
optional uint64 maxfee_kb = 4;
}

/*
* Type of redeem script used in input
* @used_in TxInputType
*/
message MultisigRedeemScriptType {
repeated bytes pubkeys = 1; // pubkeys from multisig address (sorted lexicographically)
repeated bytes signatures = 2; // existing signatures for partially signed input
}

/**
* 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
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, unset for tx to sign
optional uint32 sequence = 5 [default=0xffffffff]; // sequence
optional InputScriptType script_type = 6 [default=SPENDADDRESS]; // defines template of input script
optional MultisigRedeemScriptType multisig = 7; // Filled if input is going to spend multisig tx
}

/**
Expand All @@ -132,11 +152,10 @@ message TxInputType {
* @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)
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 OutputScriptType script_type = 4; // output script type
}

/**
Expand Down

0 comments on commit f264f01

Please sign in to comment.