2018-07-04 14:44:26 +00:00
|
|
|
syntax = "proto2";
|
2018-07-29 14:17:00 +00:00
|
|
|
package hw.trezor.messages.cardano;
|
2018-07-04 14:44:26 +00:00
|
|
|
|
|
|
|
// Sugar for easier handling in Java
|
|
|
|
option java_package = "com.satoshilabs.trezor.lib.protobuf";
|
|
|
|
option java_outer_classname = "TrezorMessageCardano";
|
|
|
|
|
2018-07-16 13:00:18 +00:00
|
|
|
import "messages-common.proto";
|
2018-07-04 14:44:26 +00:00
|
|
|
|
2020-07-23 13:54:49 +00:00
|
|
|
/**
|
|
|
|
* Values correspond to address header values given by the spec.
|
2020-07-29 13:28:41 +00:00
|
|
|
* Script addresses are only supported in transaction outputs.
|
2020-07-23 13:54:49 +00:00
|
|
|
*/
|
|
|
|
enum CardanoAddressType {
|
|
|
|
BASE = 0;
|
2020-07-29 13:28:41 +00:00
|
|
|
BASE_SCRIPT_KEY = 1;
|
|
|
|
BASE_KEY_SCRIPT = 2;
|
|
|
|
BASE_SCRIPT_SCRIPT = 3;
|
2020-07-23 13:54:49 +00:00
|
|
|
POINTER = 4;
|
2020-07-29 13:28:41 +00:00
|
|
|
POINTER_SCRIPT = 5;
|
2020-07-23 13:54:49 +00:00
|
|
|
ENTERPRISE = 6;
|
2020-07-29 13:28:41 +00:00
|
|
|
ENTERPRISE_SCRIPT = 7;
|
2020-07-23 13:54:49 +00:00
|
|
|
BYRON = 8;
|
|
|
|
REWARD = 14;
|
2020-07-29 13:28:41 +00:00
|
|
|
REWARD_SCRIPT = 15;
|
2020-07-23 13:54:49 +00:00
|
|
|
}
|
|
|
|
|
2020-07-17 07:13:08 +00:00
|
|
|
enum CardanoCertificateType {
|
|
|
|
STAKE_REGISTRATION = 0;
|
|
|
|
STAKE_DEREGISTRATION = 1;
|
|
|
|
STAKE_DELEGATION = 2;
|
|
|
|
}
|
|
|
|
|
2020-07-23 13:54:49 +00:00
|
|
|
/**
|
|
|
|
* Structure representing cardano PointerAddress pointer,
|
|
|
|
* which points to a staking key registration certificate.
|
|
|
|
* @embed
|
|
|
|
*/
|
|
|
|
message CardanoBlockchainPointerType {
|
|
|
|
optional uint32 block_index = 1;
|
|
|
|
optional uint32 tx_index = 2;
|
|
|
|
optional uint32 certificate_index = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Structure to represent address parameters so they can be
|
|
|
|
* reused in CardanoGetAddress and CardanoTxOutputType.
|
|
|
|
* NetworkId isn't a part of the parameters, because in a transaction
|
|
|
|
* this will be included separately in the transaction itself, so it
|
|
|
|
* shouldn't be duplicated here.
|
|
|
|
* @embed
|
|
|
|
*/
|
|
|
|
message CardanoAddressParametersType {
|
|
|
|
optional CardanoAddressType address_type = 1; // one of the CardanoAddressType-s
|
|
|
|
repeated uint32 address_n = 2; // BIP-32-style path to derive the spending key from master node
|
|
|
|
repeated uint32 address_n_staking = 3; // BIP-32-style path to derive staking key from master node
|
|
|
|
optional bytes staking_key_hash = 4; // staking key can be derived from address_n_staking, or
|
|
|
|
// can be sent directly e.g. if it doesn't belong to
|
|
|
|
// the same account as address_n
|
|
|
|
optional CardanoBlockchainPointerType certificate_pointer = 5; // a pointer to the staking key registration certificate
|
|
|
|
}
|
|
|
|
|
2018-07-04 14:44:26 +00:00
|
|
|
/**
|
|
|
|
* Request: Ask device for Cardano address
|
2018-07-16 14:51:03 +00:00
|
|
|
* @start
|
2018-07-04 14:44:26 +00:00
|
|
|
* @next CardanoAddress
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message CardanoGetAddress {
|
2020-07-23 13:54:49 +00:00
|
|
|
// repeated uint32 address_n = 1; // moved to address_parameters
|
|
|
|
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
|
|
|
|
optional uint32 network_id = 4; // network id - mainnet or testnet
|
|
|
|
optional CardanoAddressParametersType address_parameters = 5; // parameters used to derive the address
|
2018-07-04 14:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device for Cardano address
|
2018-07-16 14:51:03 +00:00
|
|
|
* @end
|
2018-07-04 14:44:26 +00:00
|
|
|
*/
|
|
|
|
message CardanoAddress {
|
|
|
|
optional string address = 1; // Base58 cardano address
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device for public key corresponding to address_n path
|
2018-07-16 14:51:03 +00:00
|
|
|
* @start
|
2018-07-04 14:44:26 +00:00
|
|
|
* @next CardanoPublicKey
|
|
|
|
* @next Failure
|
|
|
|
*/
|
2018-07-16 16:19:46 +00:00
|
|
|
message CardanoGetPublicKey {
|
2018-07-04 14:44:26 +00:00
|
|
|
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
|
2018-08-20 13:49:52 +00:00
|
|
|
optional bool show_display = 2; // optionally show on display before sending the result
|
2018-07-04 14:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Contains public key derived from device private seed
|
2018-07-16 14:51:03 +00:00
|
|
|
* @end
|
2018-07-04 14:44:26 +00:00
|
|
|
*/
|
|
|
|
message CardanoPublicKey {
|
2018-07-29 14:17:00 +00:00
|
|
|
optional string xpub = 1; // Xpub key
|
|
|
|
optional hw.trezor.messages.common.HDNodeType node = 2; // BIP-32 public node
|
2018-07-04 14:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device to sign Cardano transaction
|
2018-07-16 14:51:03 +00:00
|
|
|
* @start
|
2018-08-21 09:57:08 +00:00
|
|
|
* @next CardanoSignedTx
|
2018-07-04 14:44:26 +00:00
|
|
|
* @next Failure
|
|
|
|
*/
|
2018-08-21 12:11:56 +00:00
|
|
|
message CardanoSignTx {
|
2020-07-17 07:13:08 +00:00
|
|
|
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
|
|
|
|
optional uint32 network_id = 8; // network id - mainnet or testnet
|
|
|
|
repeated CardanoTxCertificateType certificates = 9; // transaction certificates - added in shelley
|
|
|
|
repeated CardanoTxWithdrawalType withdrawals = 10; // transaction withdrawals - added in shelley
|
2020-07-29 06:22:36 +00:00
|
|
|
optional bytes metadata = 11; // transaction metadata - added in shelley
|
2018-07-04 14:44:26 +00:00
|
|
|
/**
|
|
|
|
* 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
|
2020-07-01 13:43:02 +00:00
|
|
|
// left as a comment so we know to skip the id 4 in the future
|
|
|
|
// optional uint32 type = 4;
|
2018-07-04 14:44:26 +00:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Structure representing cardano transaction output
|
|
|
|
*/
|
|
|
|
message CardanoTxOutputType {
|
2020-07-23 13:54:49 +00:00
|
|
|
optional string address = 1; // target coin address in bech32 or base58
|
|
|
|
// repeated uint32 address_n = 2; // moved to address_parameters
|
|
|
|
optional uint64 amount = 3; // amount to spend
|
|
|
|
optional CardanoAddressParametersType address_parameters = 4; // parameters used to derive the address
|
2018-07-04 14:44:26 +00:00
|
|
|
}
|
2020-07-17 07:13:08 +00:00
|
|
|
/**
|
|
|
|
* Structure representing cardano transaction certificate
|
|
|
|
*/
|
|
|
|
message CardanoTxCertificateType {
|
|
|
|
optional CardanoCertificateType type = 1; // certificate type
|
|
|
|
repeated uint32 path = 2; // BIP-32 path to derive (staking) key
|
|
|
|
optional bytes pool = 3; // pool hash
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Structure representing cardano transaction withdrawals
|
|
|
|
*/
|
|
|
|
message CardanoTxWithdrawalType {
|
|
|
|
repeated uint32 path = 1;
|
|
|
|
optional uint64 amount = 2;
|
|
|
|
}
|
2018-07-04 14:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Serialised signed cardano transaction
|
2018-07-16 14:51:03 +00:00
|
|
|
* @end
|
2018-07-04 14:44:26 +00:00
|
|
|
*/
|
2018-08-21 09:57:08 +00:00
|
|
|
message CardanoSignedTx {
|
2020-07-01 13:43:02 +00:00
|
|
|
optional bytes tx_hash = 1; // hash of the transaction body
|
|
|
|
optional bytes serialized_tx = 2; // serialized, signed transaction
|
2018-07-04 14:44:26 +00:00
|
|
|
}
|