mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-17 03:48:09 +00:00
Merge pull request #11 from axic/ethereum-protocol
RFC: Ethereum support (GetEthereumAddress and SignEthereumTx)
This commit is contained in:
commit
0b5c08a166
@ -64,6 +64,11 @@ enum MessageType {
|
|||||||
MessageType_SignIdentity = 53 [(wire_in) = true];
|
MessageType_SignIdentity = 53 [(wire_in) = true];
|
||||||
MessageType_SignedIdentity = 54 [(wire_out) = true];
|
MessageType_SignedIdentity = 54 [(wire_out) = true];
|
||||||
MessageType_GetFeatures = 55 [(wire_in) = true];
|
MessageType_GetFeatures = 55 [(wire_in) = true];
|
||||||
|
MessageType_EthereumGetAddress = 56 [(wire_in) = true];
|
||||||
|
MessageType_EthereumAddress = 57 [(wire_out) = true];
|
||||||
|
MessageType_EthereumSignTx = 58 [(wire_in) = true];
|
||||||
|
MessageType_EthereumTxRequest = 59 [(wire_out) = true];
|
||||||
|
MessageType_EthereumTxAck = 60 [(wire_in) = true];
|
||||||
MessageType_DebugLinkDecision = 100 [(wire_debug_in) = true];
|
MessageType_DebugLinkDecision = 100 [(wire_debug_in) = true];
|
||||||
MessageType_DebugLinkGetState = 101 [(wire_debug_in) = true];
|
MessageType_DebugLinkGetState = 101 [(wire_debug_in) = true];
|
||||||
MessageType_DebugLinkState = 102 [(wire_debug_out) = true];
|
MessageType_DebugLinkState = 102 [(wire_debug_out) = true];
|
||||||
@ -281,6 +286,17 @@ message GetAddress {
|
|||||||
optional MultisigRedeemScriptType multisig = 4; // Filled if we are showing a multisig address
|
optional MultisigRedeemScriptType multisig = 4; // Filled if we are showing a multisig address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device for Ethereum address corresponding to address_n path
|
||||||
|
* @next PassphraseRequest
|
||||||
|
* @next EthereumAddress
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message EthereumGetAddress {
|
||||||
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
||||||
|
optional bool show_display = 2; // optionally show on display before sending the result
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response: Contains address derived from device private seed
|
* Response: Contains address derived from device private seed
|
||||||
* @prev GetAddress
|
* @prev GetAddress
|
||||||
@ -289,6 +305,14 @@ message Address {
|
|||||||
required string address = 1; // Coin address in Base58 encoding
|
required string address = 1; // Coin address in Base58 encoding
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Contains an Ethereum address derived from device private seed
|
||||||
|
* @prev EthereumGetAddress
|
||||||
|
*/
|
||||||
|
message EthereumAddress {
|
||||||
|
required bytes address = 1; // Coin address as an Ethereum 160 bit hash
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request: Request device to wipe all sensitive data and settings
|
* Request: Request device to wipe all sensitive data and settings
|
||||||
* @next ButtonRequest
|
* @next ButtonRequest
|
||||||
@ -565,6 +589,49 @@ message TxAck {
|
|||||||
optional TransactionType tx = 1;
|
optional TransactionType tx = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask device to sign transaction
|
||||||
|
* All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
|
||||||
|
* Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
|
||||||
|
* @next PassphraseRequest
|
||||||
|
* @next PinMatrixRequest
|
||||||
|
* @next EthereumTxRequest
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message EthereumSignTx {
|
||||||
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
||||||
|
optional bytes nonce = 2; // <=256 bit unsigned big endian
|
||||||
|
optional bytes gas_price = 3; // <=256 bit unsigned big endian (in wei)
|
||||||
|
optional bytes gas_limit = 4; // <=256 bit unsigned big endian
|
||||||
|
optional bytes to = 5; // 160 bit address hash
|
||||||
|
optional bytes value = 6; // <=256 bit unsigned big endian (in wei)
|
||||||
|
optional bytes data_initial_chunk = 7; // The initial data chunk (<= 1024 bytes)
|
||||||
|
optional uint32 data_length = 8; // Length of transaction payload
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response: Device asks for more data from transaction payload, or returns the signature.
|
||||||
|
* If data_length is set, device awaits that many more bytes of payload.
|
||||||
|
* Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
|
||||||
|
* @prev EthereumSignTx
|
||||||
|
* @next EthereumTxAck
|
||||||
|
*/
|
||||||
|
message EthereumTxRequest {
|
||||||
|
optional uint32 data_length = 1; // Number of bytes being requested (<= 1024)
|
||||||
|
optional uint32 signature_v = 2; // Computed signature (recovery parameter, limited to 27 or 28)
|
||||||
|
optional bytes signature_r = 3; // Computed signature R component (256 bit)
|
||||||
|
optional bytes signature_s = 4; // Computed signature S component (256 bit)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Transaction payload data.
|
||||||
|
* @prev EthereumTxRequest
|
||||||
|
* @next EthereumTxRequest
|
||||||
|
*/
|
||||||
|
message EthereumTxAck {
|
||||||
|
optional bytes data_chunk = 1; // Bytes from transaction payload (<= 1024 bytes)
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// Identity messages //
|
// Identity messages //
|
||||||
///////////////////////
|
///////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user