diff --git a/defs/coins/dash.json b/defs/coins/dash.json index 1b933a378..0c364ea7a 100644 --- a/defs/coins/dash.json +++ b/defs/coins/dash.json @@ -9,7 +9,7 @@ "address_type": 76, "address_type_p2sh": 16, "maxfee_kb": 100000, - "minfee_kb": 10000, + "minfee_kb": 1000, "signed_message_header": "DarkCoin Signed Message:\n", "hash_genesis_block": "00000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6", "xprv_magic": 50221816, diff --git a/defs/coins/monacoin.json b/defs/coins/monacoin.json index b23b30239..a0de87581 100644 --- a/defs/coins/monacoin.json +++ b/defs/coins/monacoin.json @@ -37,6 +37,8 @@ "https://mona.chainsight.info", "https://insight.electrum-mona.org" ], - "blockbook": [], + "blockbook": [ + "https://blockbook.electrum-mona.org" + ], "cooldown": 100 } diff --git a/defs/coins/smartcash.json b/defs/coins/smartcash.json new file mode 100644 index 000000000..733f283c6 --- /dev/null +++ b/defs/coins/smartcash.json @@ -0,0 +1,44 @@ +{ + "coin_name": "SmartCash", + "coin_shortcut": "SMART", + "coin_label": "SmartCash", + "website": "https://smarcash.cc", + "github": "https://github.com/SmartCash/Core-Smart", + "maintainer": "Leandro Reinaux ", + "curve_name": "secp256k1", + "address_type": 63, + "address_type_p2sh": 18, + "maxfee_kb": 1000000, + "minfee_kb": 0, + "signed_message_header": "SmartCash Signed Message:\n", + "hash_genesis_block": "000007acc6970b812948d14ea5a0a13db0fdd07d5047c7e69101fa8b361e05a4", + "xprv_magic": 76066276, + "xpub_magic": 76067358, + "xpub_magic_segwit_p2sh": null, + "xpub_magic_segwit_native": null, + "bech32_prefix": null, + "cashaddr_prefix": null, + "slip44": 224, + "segwit": false, + "decred": false, + "fork_id": null, + "force_bip143": false, + "bip115": false, + "version_group_id": null, + "default_fee_b": { + "Low": 1, + "Economy": 10, + "Normal": 100, + "High": 200 + }, + "dust_limit": 546, + "blocktime_seconds": 55, + "uri_prefix": "smart", + "min_address_length": 27, + "max_address_length": 34, + "bitcore": [ + "https://insight.smartcash.cc" + ], + "blockbook": [], + "cooldown": 100 +} diff --git a/defs/coins/smartcash.png b/defs/coins/smartcash.png new file mode 100644 index 000000000..e8a974e6e Binary files /dev/null and b/defs/coins/smartcash.png differ diff --git a/defs/coins/smartcash_testnet.json b/defs/coins/smartcash_testnet.json new file mode 100644 index 000000000..632562ae7 --- /dev/null +++ b/defs/coins/smartcash_testnet.json @@ -0,0 +1,42 @@ +{ + "coin_name": "SmartCash Testnet", + "coin_shortcut": "tSMART", + "coin_label": "SmartCash Testnet", + "website": "https://smartcash.cc", + "github": "https://github.com/SmartCash/Core-Smart", + "maintainer": "Leandro Reinaux ", + "curve_name": "secp256k1", + "address_type": 65, + "address_type_p2sh": 21, + "maxfee_kb": 1000000, + "minfee_kb": 0, + "signed_message_header": "SmartCash Signed Message:\n", + "hash_genesis_block": "0000027235b5679bcd28c90d03d4bf1a9ba4c07c4efcc1c87d6c68cce25e6e5d", + "xprv_magic": 70615956, + "xpub_magic": 70617039, + "xpub_magic_segwit_p2sh": null, + "xpub_magic_segwit_native": null, + "bech32_prefix": null, + "cashaddr_prefix": null, + "slip44": 224, + "segwit": false, + "decred": false, + "fork_id": null, + "force_bip143": false, + "bip115": false, + "version_group_id": null, + "default_fee_b": { + "Low": 1, + "Economy": 10, + "Normal": 100, + "High": 200 + }, + "dust_limit": 546, + "blocktime_seconds": 55, + "uri_prefix": "testsmart", + "min_address_length": 27, + "max_address_length": 35, + "bitcore": [], + "blockbook": [], + "cooldown": 100 +} diff --git a/defs/coins/smartcash_testnet.png b/defs/coins/smartcash_testnet.png new file mode 100644 index 000000000..b6254426f Binary files /dev/null and b/defs/coins/smartcash_testnet.png differ diff --git a/defs/ethereum/networks.json b/defs/ethereum/networks.json index 4e53bd4f7..219bcac3f 100644 --- a/defs/ethereum/networks.json +++ b/defs/ethereum/networks.json @@ -142,5 +142,29 @@ "name": "Akroma", "rskip60": false, "url": "https://akroma.io" + }, + { + "chain_id": 7762959, + "slip44": 184, + "shortcut": "MUSIC", + "name": "Musicoin", + "rskip60": false, + "url": "https://musicoin.org" + }, + { + "chain_id": 1313114, + "slip44": 1313114, + "shortcut": "ETHO", + "name": "Ether-1", + "rskip60": false, + "url": "https://ether1.org" + }, + { + "chain_id": 3125659152, + "slip44": 164, + "shortcut": "PIRL", + "name": "Pirl", + "rskip60": false, + "url": "https://pirl.io" } ] diff --git a/protob/.gitignore b/protob/.gitignore index 20e75334c..ee30dc04a 100644 --- a/protob/.gitignore +++ b/protob/.gitignore @@ -1,2 +1,3 @@ *.pb +combined.proto graph.gv* diff --git a/protob/Makefile b/protob/Makefile index e33b7b685..74d2e3339 100644 --- a/protob/Makefile +++ b/protob/Makefile @@ -1,7 +1,12 @@ -check: messages.pb messages-bitcoin.pb messages-bootloader.pb messages-cardano.pb messages-common.pb messages-crypto.pb messages-debug.pb messages-ethereum.pb messages-lisk.pb messages-management.pb messages-monero.pb messages-nem.pb messages-ripple.pb messages-stellar.pb messages-tezos.pb +check: messages.pb messages-bitcoin.pb messages-bootloader.pb messages-cardano.pb messages-common.pb messages-crypto.pb messages-debug.pb messages-ethereum.pb messages-lisk.pb messages-management.pb messages-monero.pb messages-nem.pb messages-ripple.pb messages-stellar.pb messages-tezos.pb messages-ontology.pb %.pb: %.proto protoc -I/usr/include -I. $< -o $@ +combine: + echo 'syntax = "proto2";' > combined.proto + echo 'import "google/protobuf/descriptor.proto";' >> combined.proto + grep -hv -e '^import ' -e '^syntax' -e '^package' -e 'option java_' messages*.proto | sed 's/hw\.trezor\.messages\.common\.//' >> combined.proto + clean: rm -f *.pb diff --git a/protob/messages-bitcoin.proto b/protob/messages-bitcoin.proto index cd1d73062..09173edf7 100644 --- a/protob/messages-bitcoin.proto +++ b/protob/messages-bitcoin.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.bitcoin; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; @@ -29,8 +30,8 @@ message MultisigRedeemScriptType { * Structure representing HDNode + Path */ message HDNodePathType { - required HDNodeType node = 1; // BIP-32 node in deserialized form - repeated uint32 address_n = 2; // BIP-32 path to derive the key from node + required hw.trezor.messages.common.HDNodeType node = 1; // BIP-32 node in deserialized form + repeated uint32 address_n = 2; // BIP-32 path to derive the key from node } } @@ -53,7 +54,7 @@ message GetPublicKey { * @end */ message PublicKey { - required HDNodeType node = 1; // BIP32 public node + required hw.trezor.messages.common.HDNodeType node = 1; // BIP32 public node optional string xpub = 2; // serialized form of public node } diff --git a/protob/messages-bootloader.proto b/protob/messages-bootloader.proto index d05a7de3f..7151a8e3b 100644 --- a/protob/messages-bootloader.proto +++ b/protob/messages-bootloader.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.bootloader; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; diff --git a/protob/messages-cardano.proto b/protob/messages-cardano.proto index b0a2c4a47..8962210f4 100644 --- a/protob/messages-cardano.proto +++ b/protob/messages-cardano.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.cardano; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; @@ -40,9 +41,9 @@ message CardanoGetPublicKey { * @end */ message CardanoPublicKey { - optional string xpub = 1; // Xpub key - optional HDNodeType node = 2; // BIP-32 public node - optional string root_hd_passphrase = 3; // HD passphrase for root in hex format + optional string xpub = 1; // Xpub key + optional hw.trezor.messages.common.HDNodeType node = 2; // BIP-32 public node + optional string root_hd_passphrase = 3; // HD passphrase for root in hex format } /** diff --git a/protob/messages-common.proto b/protob/messages-common.proto index 76bbb1fa2..9f3f0763a 100644 --- a/protob/messages-common.proto +++ b/protob/messages-common.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.common; /** * Response: Success of the previous request diff --git a/protob/messages-crypto.proto b/protob/messages-crypto.proto index d1f399911..8841fbc6b 100644 --- a/protob/messages-crypto.proto +++ b/protob/messages-crypto.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.crypto; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; diff --git a/protob/messages-debug.proto b/protob/messages-debug.proto index 3ae81c7d1..6c6e415a2 100644 --- a/protob/messages-debug.proto +++ b/protob/messages-debug.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.debug; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; @@ -30,17 +31,17 @@ message DebugLinkGetState { * @end */ message DebugLinkState { - optional bytes layout = 1; // raw buffer of display - optional string pin = 2; // current PIN, blank if PIN is not set/enabled - optional string matrix = 3; // current PIN matrix - optional string mnemonic = 4; // current BIP-39 mnemonic - optional HDNodeType node = 5; // current BIP-32 node - optional bool passphrase_protection = 6; // is node/mnemonic encrypted using passphrase? - optional string reset_word = 7; // word on device display during ResetDevice workflow - optional bytes reset_entropy = 8; // current entropy during ResetDevice workflow - optional string recovery_fake_word = 9; // (fake) word on display during RecoveryDevice workflow - optional uint32 recovery_word_pos = 10; // index of mnemonic word the device is expecting during RecoveryDevice workflow - optional uint32 reset_word_pos = 11; // index of mnemonic word the device is expecting during ResetDevice workflow + optional bytes layout = 1; // raw buffer of display + optional string pin = 2; // current PIN, blank if PIN is not set/enabled + optional string matrix = 3; // current PIN matrix + optional string mnemonic = 4; // current BIP-39 mnemonic + optional hw.trezor.messages.common.HDNodeType node = 5; // current BIP-32 node + optional bool passphrase_protection = 6; // is node/mnemonic encrypted using passphrase? + optional string reset_word = 7; // word on device display during ResetDevice workflow + optional bytes reset_entropy = 8; // current entropy during ResetDevice workflow + optional string recovery_fake_word = 9; // (fake) word on display during RecoveryDevice workflow + optional uint32 recovery_word_pos = 10; // index of mnemonic word the device is expecting during RecoveryDevice workflow + optional uint32 reset_word_pos = 11; // index of mnemonic word the device is expecting during ResetDevice workflow } /** diff --git a/protob/messages-ethereum.proto b/protob/messages-ethereum.proto index 559a7a220..d059c14b8 100644 --- a/protob/messages-ethereum.proto +++ b/protob/messages-ethereum.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.ethereum; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; diff --git a/protob/messages-lisk.proto b/protob/messages-lisk.proto index b66779a1d..ceeb26c9b 100644 --- a/protob/messages-lisk.proto +++ b/protob/messages-lisk.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.lisk; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; diff --git a/protob/messages-management.proto b/protob/messages-management.proto index 5300cd2f3..cffcbfb29 100644 --- a/protob/messages-management.proto +++ b/protob/messages-management.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.management; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; @@ -162,14 +163,14 @@ message WipeDevice { * @next Failure */ message LoadDevice { - optional string mnemonic = 1; // seed encoded as BIP-39 mnemonic (12, 18 or 24 words) - optional HDNodeType node = 2; // BIP-32 node - optional string pin = 3; // set PIN protection - optional bool passphrase_protection = 4; // enable master node encryption using passphrase - optional string language = 5 [default='english']; // device language - optional string label = 6; // device label - optional bool skip_checksum = 7; // do not test mnemonic for valid BIP-39 checksum - optional uint32 u2f_counter = 8; // U2F counter + optional string mnemonic = 1; // seed encoded as BIP-39 mnemonic (12, 18 or 24 words) + optional hw.trezor.messages.common.HDNodeType node = 2; // BIP-32 node + optional string pin = 3; // set PIN protection + optional bool passphrase_protection = 4; // enable master node encryption using passphrase + optional string language = 5 [default='english']; // device language + optional string label = 6; // device label + optional bool skip_checksum = 7; // do not test mnemonic for valid BIP-39 checksum + optional uint32 u2f_counter = 8; // U2F counter } /** diff --git a/protob/messages-monero.proto b/protob/messages-monero.proto index 623a180c4..f41fe9e14 100644 --- a/protob/messages-monero.proto +++ b/protob/messages-monero.proto @@ -1,9 +1,57 @@ syntax = "proto2"; +package hw.trezor.messages.monero; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; option java_outer_classname = "TrezorMessageMonero"; +/** + * Structure representing Monero transaction source entry, UTXO + * @embed + */ +message MoneroTransactionSourceEntry { + repeated MoneroOutputEntry outputs = 1; + optional uint64 real_output = 2; + optional bytes real_out_tx_key = 3; + repeated bytes real_out_additional_tx_keys = 4; + optional uint64 real_output_in_tx_index = 5; + optional uint64 amount = 6; + optional bool rct = 7; + optional bytes mask = 8; + optional MoneroMultisigKLRki multisig_kLRki = 9; + message MoneroOutputEntry { + optional uint64 idx = 1; + optional MoneroRctKey key = 2; + message MoneroRctKey { + optional bytes dest = 1; + optional bytes mask = 2; + } + } + message MoneroMultisigKLRki { + optional bytes K = 1; + optional bytes L = 2; + optional bytes R = 3; + optional bytes ki = 4; + } +} + +/** + * Structure representing Monero transaction destination entry + * @embed + */ +message MoneroTransactionDestinationEntry { + optional uint64 amount = 1; + optional MoneroAccountPublicAddress addr = 2; + optional bool is_subaddress = 3; + /** + * Structure representing Monero public address + */ + message MoneroAccountPublicAddress { + optional bytes spend_public_key = 1; + optional bytes view_public_key = 2; + } +} + /** * Request: Ask device for public address derived from seed and address_n * @start @@ -57,8 +105,8 @@ message MoneroTransactionInitRequest { optional uint32 network_type = 3; // Main-net / testnet / stagenet optional MoneroTransactionData tsx_data = 4; /** - * Structure representing Monero initial transaction information - */ + * Structure representing Monero initial transaction information + */ message MoneroTransactionData { optional uint32 version = 1; optional bytes payment_id = 2; @@ -74,21 +122,6 @@ message MoneroTransactionInitRequest { optional bytes exp_tx_prefix_hash = 12; repeated bytes use_tx_keys = 13; optional bool is_bulletproof = 14; - /** - * Structure representing Monero transaction destination entry - */ - message MoneroTransactionDestinationEntry { - optional uint64 amount = 1; - optional MoneroAccountPublicAddress addr = 2; - optional bool is_subaddress = 3; - /** - * Structure representing Monero public address - */ - message MoneroAccountPublicAddress { - optional bytes spend_public_key = 1; - optional bytes view_public_key = 2; - } - } } } @@ -111,7 +144,7 @@ message MoneroTransactionInitAck { */ message MoneroTransactionSetInputRequest { optional uint32 version = 1; - optional bytes src_entr = 2; // xmrtypes.TxSourceEntry + optional MoneroTransactionSourceEntry src_entr = 2; } /** @@ -147,7 +180,7 @@ message MoneroTransactionInputsPermutationAck { * @next MoneroTransactionInputViniAck */ message MoneroTransactionInputViniRequest { - optional bytes src_entr = 1; // xmrtypes.TxSourceEntry + optional MoneroTransactionSourceEntry src_entr = 1; optional bytes vini = 2; // xmrtypes.TxinToKey optional bytes vini_hmac = 3; optional bytes pseudo_out = 4; @@ -166,7 +199,7 @@ message MoneroTransactionInputViniAck { * @next MoneroTransactionSetOutputAck */ message MoneroTransactionSetOutputRequest { - optional bytes dst_entr = 1; // xmrtypes.TxDestinationEntry + optional MoneroTransactionDestinationEntry dst_entr = 1; optional bytes dst_entr_hmac = 2; } @@ -198,8 +231,8 @@ message MoneroTransactionAllOutSetAck { optional bytes tx_prefix_hash = 2; optional MoneroRingCtSig rv = 3; // xmrtypes.RctSig /* - * Structure represents initial fields of the Monero RCT signature - */ + * Structure represents initial fields of the Monero RCT signature + */ message MoneroRingCtSig { optional uint64 txn_fee = 1; optional bytes message = 2; @@ -227,7 +260,7 @@ message MoneroTransactionMlsagDoneAck { * @next MoneroTransactionSignInputAck */ message MoneroTransactionSignInputRequest { - optional bytes src_entr = 1; // xmrtypes.TxSourceEntry + optional MoneroTransactionSourceEntry src_entr = 1; optional bytes vini = 2; // xmrtypes.TxinToKey optional bytes vini_hmac = 3; optional bytes pseudo_out = 4; @@ -299,8 +332,8 @@ message MoneroKeyImageExportInitRequest { optional uint32 network_type = 4; // Main-net / testnet / stagenet repeated MoneroSubAddressIndicesList subs = 5; /** - * Structure representing Monero list of sub-addresses - */ + * Structure representing Monero list of sub-addresses + */ message MoneroSubAddressIndicesList { optional uint32 account = 1; repeated uint32 minor_indices = 2; @@ -321,8 +354,8 @@ message MoneroKeyImageExportInitAck { message MoneroKeyImageSyncStepRequest { repeated MoneroTransferDetails tdis = 1; /** - * Structure representing Monero UTXO for key image sync - */ + * Structure representing Monero UTXO for key image sync + */ message MoneroTransferDetails { optional bytes out_key = 1; optional bytes tx_pub_key = 2; @@ -338,8 +371,8 @@ message MoneroKeyImageSyncStepRequest { message MoneroKeyImageSyncStepAck { repeated MoneroExportedKeyImage kis = 1; /** - * Structure representing Monero encrypted exported key image - */ + * Structure representing Monero encrypted exported key image + */ message MoneroExportedKeyImage { optional bytes iv = 1; optional bytes tag = 2; diff --git a/protob/messages-nem.proto b/protob/messages-nem.proto index 62428699f..295f9dcdb 100644 --- a/protob/messages-nem.proto +++ b/protob/messages-nem.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.nem; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; diff --git a/protob/messages-ontology.proto b/protob/messages-ontology.proto new file mode 100644 index 000000000..cac05cd8e --- /dev/null +++ b/protob/messages-ontology.proto @@ -0,0 +1,189 @@ +syntax = "proto2"; + +// Sugar for easier handling in Java +option java_package = "com.satoshilabs.trezor.lib.protobuf"; +option java_outer_classname = "TrezorMessageOntology"; + +/** + * Ontology Transaction + * @embed + */ +message OntologyTransaction { + optional uint32 version = 1; + optional uint32 type = 2; + optional uint32 nonce = 3; + optional uint64 gas_price = 4; + optional uint64 gas_limit = 5; + optional string payer = 6; + repeated OntologyTxAttribute tx_attributes = 7; + /** + * Attribute of Ontology transaction + */ + message OntologyTxAttribute { + optional uint32 usage = 1; + optional bytes data = 2; + } +} + +/** + * Request: Ask device for Ontology public key corresponding to address_n path + * @start + * @next OntologyPublicKey + */ +message OntologyGetPublicKey { + 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 Ontology public key derived from device private seed + * @end + */ +message OntologyPublicKey { + optional bytes public_key = 1; // Ontology public key +} + +/** + * Request: Ask device for Ontology address corresponding to address_n path + * @start + * @next OntologyAddress + */ +message OntologyGetAddress { + 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 Ontology address derived from device private seed + * @end + */ +message OntologyAddress { + optional string address = 1; // Ontology address +} + +/** + * Request: Ask device to sign Ontology transfer + * @start + * @next OntologySignedTransfer + */ +message OntologySignTransfer { + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + optional OntologyTransaction transaction = 2; + optional OntologyTransfer transfer = 3; + /** + * Ontology Transfer + */ + message OntologyTransfer { + optional OntologyAsset asset = 1; + optional uint64 amount = 2; + optional string from_address = 3; + optional string to_address = 4; + /** + * Ontology Asset + */ + enum OntologyAsset { + ONT = 1; + ONG = 2; + } + } +} + +/** + * Response: Contains Ontology transfer signature + * @end + */ +message OntologySignedTransfer { + optional bytes signature = 1; + optional bytes payload = 2; +} + +/** + * Request: Ask device to sign Ontology ONG withdrawal + * @start + * @next OntologySignedWithdrawOng + */ +message OntologySignWithdrawOng { + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + optional OntologyTransaction transaction = 2; + optional OntologyWithdrawOng withdraw_ong = 3; + /** + * Ontology ONG Withdrawal + */ + message OntologyWithdrawOng { + optional uint64 amount = 1; + optional string from_address = 2; + optional string to_address = 3; + } +} + +/** + * Response: Contains Ontology ONG withdrawal signature + * @end + */ +message OntologySignedWithdrawOng { + optional bytes signature = 1; + optional bytes payload = 2; +} + +/** + * Request: Ask device to sign Ontology ONT ID registration + * @start + * @next OntologySignedOntIdRegister + */ +message OntologySignOntIdRegister { + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + optional OntologyTransaction transaction = 2; + optional OntologyOntIdRegister ont_id_register = 3; + /** + * Ontology ONT ID registration + */ + message OntologyOntIdRegister { + optional string ont_id = 1; + optional bytes public_key = 2; + } +} + +/** + * Response: Contains Ontology ONT ID registration signature + * @end + */ +message OntologySignedOntIdRegister { + optional bytes signature = 1; + optional bytes payload = 2; +} + +/** + * Request: Ask device to sign Ontology ONT ID attributes adding + * @start + * @next OntologySignedOntIdAddAttributes + */ +message OntologySignOntIdAddAttributes { + repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node + optional OntologyTransaction transaction = 2; + optional OntologyOntIdAddAttributes ont_id_add_attributes = 3; + /** + * Ontology ONT ID attributes adding + */ + message OntologyOntIdAddAttributes { + optional string ont_id = 1; + optional bytes public_key = 2; + repeated OntologyOntIdAttribute ont_id_attributes = 3; + /** + * Attribute of Ontology ONT ID + */ + message OntologyOntIdAttribute { + optional string key = 1; + optional string type = 2; + optional string value = 3; + } + } +} + +/** + * Response: Contains Ontology ONT ID attributes adding signature + * @end + */ +message OntologySignedOntIdAddAttributes { + optional bytes signature = 1; + optional bytes payload = 2; +} diff --git a/protob/messages-ripple.proto b/protob/messages-ripple.proto index 47909c1a8..5d13c909e 100644 --- a/protob/messages-ripple.proto +++ b/protob/messages-ripple.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.ripple; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; diff --git a/protob/messages-stellar.proto b/protob/messages-stellar.proto index 21a8ae7f5..b23e25ab0 100644 --- a/protob/messages-stellar.proto +++ b/protob/messages-stellar.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages.stellar; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; diff --git a/protob/messages-tezos.proto b/protob/messages-tezos.proto index d1ead31a4..2f954d4f0 100644 --- a/protob/messages-tezos.proto +++ b/protob/messages-tezos.proto @@ -1,9 +1,19 @@ syntax = "proto2"; +package hw.trezor.messages.tezos; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; option java_outer_classname = "TrezorMessageTezos"; +/** + * Tezos Curve Type + */ +enum TezosCurveType { + Ed25519 = 0; + Secp256k1 = 1; + P256 = 2; +} + /** * Request: Ask device for Tezos address corresponding to address_n path * @start @@ -12,7 +22,8 @@ option java_outer_classname = "TrezorMessageTezos"; */ message TezosGetAddress { 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 + optional TezosCurveType curve = 2 [default=Ed25519]; // Curve to use in trezor + optional bool show_display = 3; // optionally show on display before sending the result } /** @@ -30,7 +41,8 @@ message TezosAddress { */ message TezosGetPublicKey { 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 + optional TezosCurveType curve = 2 [default=Ed25519]; // Curve to use in trezor + optional bool show_display = 3; // Optionally show on display before sending the result } /** @@ -38,7 +50,7 @@ message TezosGetPublicKey { * @end */ message TezosPublicKey { - optional bytes public_key = 1; // Tezos public key + optional string public_key = 1; // b58 encoded Tezos public key with prefix } /** @@ -48,68 +60,77 @@ message TezosPublicKey { */ message TezosSignTx { repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node - optional TezosOperationCommon operation = 2; // Tezos operation structure - optional TezosTransactionType transaction = 3; // Tezos transaction part - optional TezosOriginationType origination = 4; // Tezos origination part - optional TezosDelegationType delegation = 5; // Tezos delegation part + optional TezosCurveType curve = 2 [default=Ed25519]; // Curve to use in trezor + optional bytes branch = 3; // b58 encoded branch with prefix + + optional TezosRevealOp reveal = 4; // Tezos reveal operation (may be bundled with other op) + optional TezosTransactionOp transaction = 5; // Tezos transaction operation + optional TezosOriginationOp origination = 6; // Tezos origination operation + optional TezosDelegationOp delegation = 7; // Tezos delegation operation /* - * Tezos contract ID - */ + * Tezos contract ID + */ message TezosContractID { optional TezosContractType tag = 1; optional bytes hash = 2; // Implicit = 21B, originated = 20B + 1B padding /* - * Type of Tezos Contract type - */ + * Type of Tezos Contract type + */ enum TezosContractType { Implicit = 0; Originated = 1; } } - /* - * Structure representing the common part for Tezos operations + /** + * Structure representing information for reveal */ - message TezosOperationCommon { - optional bytes branch = 1; - optional TezosOperationType tag = 2; - optional TezosContractID source = 3; - optional uint64 fee = 4; - optional uint64 counter = 5; - optional uint64 gas_limit = 6; - optional uint64 storage_limit = 7; - /* - * Type of Tezos operation - */ - enum TezosOperationType { - Transaction = 8; - Origination = 9; - Delegation = 10; - } + message TezosRevealOp { + optional TezosContractID source = 1; + optional uint64 fee = 2; + optional uint64 counter = 3; + optional uint64 gas_limit = 4; + optional uint64 storage_limit = 5; + optional bytes public_key = 6; } - /* - * Structure representing additional information for transaction + /** + * Structure representing information for transaction */ - message TezosTransactionType { - optional uint64 amount = 1; - optional TezosContractID destination = 2; - optional bytes parameters = 3; + message TezosTransactionOp { + optional TezosContractID source = 1; + optional uint64 fee = 2; + optional uint64 counter = 3; + optional uint64 gas_limit = 4; + optional uint64 storage_limit = 5; + optional uint64 amount = 6; + optional TezosContractID destination = 7; + optional bytes parameters = 8; } - /* - * Structure representing additional information for origination - */ - message TezosOriginationType { - optional bytes manager_pubkey = 1; - optional uint64 balance = 2; - optional bool spendable = 3; - optional bool delegatable = 4; - optional bytes delegate = 5; // 1B tag + 20B public key hash - optional bytes script = 6; + /** + * Structure representing information for origination + */ + message TezosOriginationOp { + optional TezosContractID source = 1; + optional uint64 fee = 2; + optional uint64 counter = 3; + optional uint64 gas_limit = 4; + optional uint64 storage_limit = 5; + optional bytes manager_pubkey = 6; + optional uint64 balance = 7; + optional bool spendable = 8; + optional bool delegatable = 9; + optional bytes delegate = 10; + optional bytes script = 11; } - /* - * Structure representing additional information for delegation - */ - message TezosDelegationType { - optional bytes delegate = 1; // 1B tag + 20B public key hash + /** + * Structure representing information for delegation + */ + message TezosDelegationOp { + optional TezosContractID source = 1; + optional uint64 fee = 2; + optional uint64 counter = 3; + optional uint64 gas_limit = 4; + optional uint64 storage_limit = 5; + optional bytes delegate = 6; } } @@ -118,7 +139,7 @@ message TezosSignTx { * @end */ message TezosSignedTx { - optional bytes signature = 1; // Tezos transaction signature - optional bytes sig_op_contents = 2; // Signed operation contents - optional string operation_hash = 3; // b58 check encoded blake2b hashed operation contents + optional string signature = 1; // Tezos b58 encoded transaction signature with prefix + optional bytes sig_op_contents = 2; // operation_bytes + signed operation_bytes + optional string operation_hash = 3; // b58 encoded hashed operation contents with prefix } diff --git a/protob/messages.proto b/protob/messages.proto index ef794e855..d93efb02c 100644 --- a/protob/messages.proto +++ b/protob/messages.proto @@ -1,4 +1,5 @@ syntax = "proto2"; +package hw.trezor.messages; /** * Messages for TREZOR communication @@ -173,6 +174,20 @@ enum MessageType { MessageType_CardanoTxAck = 309 [(wire_in) = true]; MessageType_CardanoSignedTransaction = 310 [(wire_out) = true]; + // Ontology + MessageType_OntologyGetAddress = 350 [(wire_in) = true]; + MessageType_OntologyAddress = 351 [(wire_out) = true]; + MessageType_OntologyGetPublicKey = 352 [(wire_in) = true]; + MessageType_OntologyPublicKey = 353 [(wire_out) = true]; + MessageType_OntologySignTransfer = 354 [(wire_in) = true]; + MessageType_OntologySignedTransfer = 355 [(wire_out) = true]; + MessageType_OntologySignWithdrawOng = 356 [(wire_in) = true]; + MessageType_OntologySignedWithdrawOng = 357 [(wire_out) = true]; + MessageType_OntologySignOntIdRegister = 358 [(wire_in) = true]; + MessageType_OntologySignedOntIdRegister = 359 [(wire_out) = true]; + MessageType_OntologySignOntIdAddAttributes = 360 [(wire_in) = true]; + MessageType_OntologySignedOntIdAddAttributes = 361 [(wire_out) = true]; + // Ripple MessageType_RippleGetAddress = 400 [(wire_in) = true]; MessageType_RippleAddress = 401 [(wire_out) = true]; diff --git a/protob/pb2py b/protob/pb2py index 6323d7f37..cf73456f8 100755 --- a/protob/pb2py +++ b/protob/pb2py @@ -189,6 +189,8 @@ class Descriptor: if field.orig.type == field.orig.TYPE_MESSAGE ) + if len(imports) > 0: + yield "" # make isort happy for name in sorted(imports): yield self.create_message_import(name) @@ -218,15 +220,16 @@ class Descriptor: fields = [self.parse_field(field) for field in message.field] + yield from self.process_message_imports(fields) + if any(field.repeated for field in fields): + yield "" yield "if __debug__:" yield " try:" yield " from typing import List" yield " except ImportError:" yield " List = None # type: ignore" - yield from self.process_message_imports(fields) - yield "" yield "" yield "class {}(p.MessageType):".format(message.name) diff --git a/tools/coindef.py b/tools/coindef.py index 6ac4c0ecc..cc658bd2d 100644 --- a/tools/coindef.py +++ b/tools/coindef.py @@ -35,6 +35,7 @@ class CoinDef(p.MessageType): 30: ('maintainer', p.UnicodeType, 0), 31: ('blocktime_seconds', p.UVarintType, 0), 32: ('bip115', p.BoolType, 0), + 33: ('cooldown', p.UVarintType, 0), } def __init__( @@ -73,7 +74,8 @@ class CoinDef(p.MessageType): blocktime_seconds: int = None, default_fee_b: dict = None, bitcore: dict = None, - blockbook: dict = None + blockbook: dict = None, + cooldown: int = None ): self.coin_name = coin_name self.coin_shortcut = coin_shortcut @@ -110,4 +112,5 @@ class CoinDef(p.MessageType): self.default_fee_b = default_fee_b self.bitcore = bitcore self.blockbook = blockbook + self.cooldown = cooldown p.MessageType.__init__(self)