mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-13 01:58:08 +00:00

Update protobuf - Previous transactions don't need to be sent anymore, because fee is included in the transaction now. Thus transactions_count can be removed from CardanoSignTx message and the CardanoTxAck and CardanoTxRequest messages can be removed altogether. - CardanoTxInputType.type is unused so remove it Add NULL (None type) serialisation to CBOR - Transaction metada must either have a valid structure or CBOR NULL must be used (if metadata is empty) - it can't be simply left out. Add protocol_magics file - Just to have a nicer way of representing protocol magics Update transaction signing - Previous transactions no longer need to be requested - Output building is simplified, since fee doesn't need to be calculated - Remove transaction class since it is no longer needed (only functions remained) - Reorder functions so it reads top to bottom Add protocol magic to byron address on testnet - This has always been a part of the spec, but it hasn't been implemented before, because it wasn't really needed. Update trezorlib Update tests - Transaction messages are no longer required - Expected values are different since tx format changed - Common values in test cases have been extracted Remove unused file - Progress was used when receiving previous transactions Add CRC check to output address validation
91 lines
3.1 KiB
Protocol Buffer
91 lines
3.1 KiB
Protocol Buffer
syntax = "proto2";
|
|
package hw.trezor.messages.cardano;
|
|
|
|
// Sugar for easier handling in Java
|
|
option java_package = "com.satoshilabs.trezor.lib.protobuf";
|
|
option java_outer_classname = "TrezorMessageCardano";
|
|
|
|
import "messages-common.proto";
|
|
|
|
/**
|
|
* Request: Ask device for Cardano address
|
|
* @start
|
|
* @next CardanoAddress
|
|
* @next Failure
|
|
*/
|
|
message CardanoGetAddress {
|
|
repeated uint32 address_n = 1; // BIP-32-style path to derive the key from master node
|
|
optional bool show_display = 2; // optionally prompt for confirmation on trezor display
|
|
optional uint32 protocol_magic = 3; // network's protocol magic - needed for Byron addresses on testnets
|
|
}
|
|
|
|
/**
|
|
* Request: Ask device for Cardano address
|
|
* @end
|
|
*/
|
|
message CardanoAddress {
|
|
optional string address = 1; // Base58 cardano address
|
|
}
|
|
|
|
/**
|
|
* Request: Ask device for public key corresponding to address_n path
|
|
* @start
|
|
* @next CardanoPublicKey
|
|
* @next Failure
|
|
*/
|
|
message CardanoGetPublicKey {
|
|
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 public key derived from device private seed
|
|
* @end
|
|
*/
|
|
message CardanoPublicKey {
|
|
optional string xpub = 1; // Xpub key
|
|
optional hw.trezor.messages.common.HDNodeType node = 2; // BIP-32 public node
|
|
}
|
|
|
|
/**
|
|
* Request: Ask device to sign Cardano transaction
|
|
* @start
|
|
* @next CardanoSignedTx
|
|
* @next Failure
|
|
*/
|
|
message CardanoSignTx {
|
|
repeated CardanoTxInputType inputs = 1; // inputs to be used in transaction
|
|
repeated CardanoTxOutputType outputs = 2; // outputs to be used in transaction
|
|
// optional uint32 transactions_count = 3; // left as a comment so we know to skip the id 3 in the future
|
|
optional uint32 protocol_magic = 5; // network's protocol magic
|
|
optional uint64 fee = 6; // transaction fee - added in shelley
|
|
optional uint64 ttl = 7; // transaction ttl - added in shelley
|
|
/**
|
|
* Structure representing cardano transaction input
|
|
*/
|
|
message CardanoTxInputType {
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
|
optional bytes prev_hash = 2; // hash of previous transaction output to spend by this input
|
|
optional uint32 prev_index = 3; // index of previous output to spend
|
|
// left as a comment so we know to skip the id 4 in the future
|
|
// optional uint32 type = 4;
|
|
}
|
|
/**
|
|
* Structure representing cardano transaction output
|
|
*/
|
|
message CardanoTxOutputType {
|
|
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"
|
|
optional uint64 amount = 3; // amount to spend
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Response: Serialised signed cardano transaction
|
|
* @end
|
|
*/
|
|
message CardanoSignedTx {
|
|
optional bytes tx_hash = 1; // hash of the transaction body
|
|
optional bytes serialized_tx = 2; // serialized, signed transaction
|
|
}
|