1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

Added EstimateTxSize

This commit is contained in:
slush0 2014-01-18 05:13:47 +01:00
parent 1a42bc3b70
commit 78efd80bbc
2 changed files with 36 additions and 8 deletions

View File

@ -47,7 +47,8 @@ enum MessageType {
MessageType_MessageSignature = 40 [(wire_out) = true];
MessageType_PassphraseRequest = 41 [(wire_out) = true];
MessageType_PassphraseAck = 42 [(wire_in) = true];
MessageType_EstimateTxSize = 43 [(wire_in) = true];
MessageType_TxSize = 44 [(wire_out) = true];
MessageType_DebugLinkDecision = 100 [(wire_debug_in) = true];
MessageType_DebugLinkGetState = 101 [(wire_debug_in) = true];
MessageType_DebugLinkState = 102 [(wire_debug_out) = true];
@ -84,8 +85,7 @@ message Features {
// Overwrites only filled fields of the structure
message ApplySettings {
optional bytes language = 1;
optional bytes coin_shortcut = 2;
optional bytes label = 3 [(binary) = true];
optional bytes label = 2 [(binary) = true];
}
// Starts workflow for setting/changing the PIN
@ -168,6 +168,7 @@ message Entropy {
// Response: PublicKey, Failure
message GetPublicKey {
repeated uint32 address_n = 1;
optional bytes coin_name = 2 [default='Bitcoin'];
}
// Contains public key derived from device's seed.
@ -177,6 +178,7 @@ message PublicKey {
message GetAddress {
repeated uint32 address_n = 1; // Parameter for address generation algorithm to derive the address from the master node
optional bytes coin_name = 2 [default='Bitcoin'];
}
message Address {
@ -238,6 +240,7 @@ message EntropyAck {
message SignMessage {
repeated uint32 address_n = 1;
required bytes message = 2 [(binary) = true];
optional bytes coin_name = 3 [default='Bitcoin'];
}
message VerifyMessage {
@ -251,12 +254,32 @@ message MessageSignature {
optional bytes signature = 2;
}
// Estimate size of the transaction
// This call behaves exactly like SignTx,
// which means that it can ask for TxInput and TxInput.
// This call is non-blocking (except possible PassphraseRequest
// to unlock the seed) and returns estimated size of transaction
// in bytes.
//
// Response: TxRequest, TxSize, Failure
message EstimateTxSize {
required uint32 outputs_count = 1; // Count of outputs of the transaction
required uint32 inputs_count = 2; // Count of inputs of the transaction
optional bytes coin_name = 3 [default='Bitcoin'];
}
// Result of EstimateTxSize
message TxSize {
optional uint32 tx_size = 1; // Size of transaction in bytes
}
// Request the device to sign the transaction
//
// Response: TxRequest, PinMatrixRequest, Failure
message SignTx {
required uint32 outputs_count = 3; // Count of outputs of the transaction
required uint32 inputs_count = 5; // Count of inputs of the transaction
required uint32 outputs_count = 1; // Count of outputs of the transaction
required uint32 inputs_count = 2; // Count of inputs of the transaction
optional bytes coin_name = 3 [default='Bitcoin'];
}
// Request a simplified workflow of signing.
@ -272,8 +295,10 @@ message SignTx {
//
// Response: Success, PinMatrixRequest, Failure
message SimpleSignTx {
repeated TxInput inputs = 1;
repeated TxOutput outputs = 2;
repeated TxInputType inputs = 1;
repeated TxOutputType outputs = 2;
repeated TransactionType transactions = 3;
optional bytes coin_name = 4 [default='Bitcoin'];
}
// Sent by the device as a response for SignTx. Device asks for information for signing transaction.

View File

@ -28,6 +28,7 @@ enum FailureType {
Failure_PinCancelled = 6;
Failure_PinInvalid = 7;
Failure_InvalidSignature = 8;
Failure_Other = 9;
Failure_FirmwareError = 99;
}
@ -61,6 +62,8 @@ message CoinType {
optional bytes coin_shortcut = 2;
optional uint32 address_type = 3;
optional uint64 maxfee_kb = 4;
optional uint32 ser_private = 5; // bip32 serialization for privkey
optional uint32 ser_public = 6; // bip32 serialization for pubkey
}
message TxInputType {
@ -75,7 +78,7 @@ message TxInputType {
message TxOutputType {
// required uint32 index = 1; // Position of output in proposed transaction
required bytes address = 1; // Target bitcoin address in base58 encoding
optional bytes 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