diff --git a/Makefile b/Makefile index dbb17aa..7091014 100755 --- a/Makefile +++ b/Makefile @@ -131,9 +131,13 @@ else ifeq ($(CHAIN),tomochain) APP_LOAD_PARAMS += --path "44'/889'" DEFINES += CHAINID_UPCASE=\"TOMOCHAIN\" CHAINID_COINNAME=\"TOMO\" CHAIN_KIND=CHAIN_KIND_TOMOCHAIN CHAIN_ID=88 APPNAME = "TomoChain" +else ifeq ($(CHAIN),tobalaba) +APP_LOAD_PARAMS += --path "44'/401697'" +DEFINES += CHAINID_UPCASE=\"TOBALABA\" CHAINID_COINNAME=\"TOBALABA\" CHAIN_KIND=CHAIN_KIND_TOBALABA CHAIN_ID=401697 +APPNAME = "Tobalaba" else ifeq ($(filter clean,$(MAKECMDGOALS)),) -$(error Unsupported CHAIN - use ethereum, ethereum_classic, expanse, poa, rsk, rsk_testnet, ubiq, wanchain, kusd, musicoin, pirl, akroma, atheios, callisto, ethersocial, ellaism, ether1, ethergem, gochain, mix, reosc, hpb, tomochain) +$(error Unsupported CHAIN - use ethereum, ethereum_classic, expanse, poa, rsk, rsk_testnet, ubiq, wanchain, kusd, musicoin, pirl, akroma, atheios, callisto, ethersocial, ellaism, ether1, ethergem, gochain, mix, reosc, hpb, tomochain, tobalaba) endif endif @@ -251,4 +255,4 @@ include $(BOLOS_SDK)/Makefile.rules dep/%.d: %.c Makefile listvariants: - @echo VARIANTS CHAIN ethereum ethereum_classic expanse poa rsk rsk_testnet ubiq wanchain kusd pirl akroma atheios callisto ethersocial ether1 gochain musicoin ethergem mix ellaism reosc hpb tomochain + @echo VARIANTS CHAIN ethereum ethereum_classic expanse poa rsk rsk_testnet ubiq wanchain kusd pirl akroma atheios callisto ethersocial ether1 gochain musicoin ethergem mix ellaism reosc hpb tomochain tobalaba diff --git a/blue_app_tobalaba.gif b/blue_app_tobalaba.gif new file mode 100644 index 0000000..d1c438f Binary files /dev/null and b/blue_app_tobalaba.gif differ diff --git a/examples/signTx.py b/examples/signTx.py index 75eb94b..4366b71 100755 --- a/examples/signTx.py +++ b/examples/signTx.py @@ -28,6 +28,9 @@ import binascii from ethBase import Transaction, UnsignedTransaction, unsigned_tx_from_tx from rlp import encode +# Define here Chain_ID for EIP-155 +CHAIN_ID = 0 + try: from rlp.utils import decode_hex, encode_hex, str_to_bytes except: @@ -75,9 +78,12 @@ tx = Transaction( to=decode_hex(args.to[2:]), value=int(amount), data=args.data, + v=CHAIN_ID, + r=0, + s=0 ) -encodedTx = encode(unsigned_tx_from_tx(tx), UnsignedTransaction) +encodedTx = encode(tx, Transaction) donglePath = parse_bip32_path(args.path) apdu = bytearray.fromhex("e0040000") @@ -88,7 +94,13 @@ apdu += donglePath + encodedTx dongle = getDongle(True) result = dongle.exchange(bytes(apdu)) -v = result[0] +# Needs to recover (main.c:1121) +if (CHAIN_ID*2 + 35) + 1 > 255: + ecc_parity = result[0] - ((CHAIN_ID*2 + 35) % 256) + v = (CHAIN_ID*2 + 35) + ecc_parity +else: + v = result[0] + r = int(binascii.hexlify(result[1:1 + 32]), 16) s = int(binascii.hexlify(result[1 + 32: 1 + 32 + 32]), 16) diff --git a/nanos_app_tobalaba.gif b/nanos_app_tobalaba.gif new file mode 100644 index 0000000..d15c937 Binary files /dev/null and b/nanos_app_tobalaba.gif differ diff --git a/src/chainConfig.h b/src/chainConfig.h index fd7d6c1..fe614dc 100644 --- a/src/chainConfig.h +++ b/src/chainConfig.h @@ -44,7 +44,8 @@ typedef enum chain_kind_e { CHAIN_KIND_MIX, CHAIN_KIND_REOSC, CHAIN_KIND_HPB, - CHAIN_KIND_TOMOCHAIN + CHAIN_KIND_TOMOCHAIN, + CHAIN_KIND_TOBALABA } chain_kind_t; typedef struct chain_config_s { diff --git a/src/main.c b/src/main.c index be94b2b..87c559d 100644 --- a/src/main.c +++ b/src/main.c @@ -1849,6 +1849,9 @@ tokenDefinition_t* getKnownToken() { case CHAIN_KIND_TOMOCHAIN: numTokens = NUM_TOKENS_TOMOCHAIN; break; + case CHAIN_KIND_TOBALABA: + numTokens = NUM_TOKENS_TOBALABA; + break; } for (i=0; ikind) { @@ -1918,6 +1921,9 @@ tokenDefinition_t* getKnownToken() { case CHAIN_KIND_TOMOCHAIN: currentToken = (tokenDefinition_t *)PIC(&TOKENS_TOMOCHAIN[i]); break; + case CHAIN_KIND_TOBALABA: + currentToken = (tokenDefinition_t *)PIC(&TOKENS_TOBALABA[i]); + break; } if (os_memcmp(currentToken->address, tmpContent.txContent.destination, 20) == 0) { return currentToken; diff --git a/src/tokens.c b/src/tokens.c index 8578c9f..5b458f6 100644 --- a/src/tokens.c +++ b/src/tokens.c @@ -1180,5 +1180,6 @@ const tokenDefinition_t const TOKENS_HPB[NUM_TOKENS_HPB] = {}; const tokenDefinition_t const TOKENS_TOMOCHAIN[NUM_TOKENS_TOMOCHAIN] = {}; -#endif +const tokenDefinition_t const TOKENS_TOBALABA[NUM_TOKENS_TOBALABA] = {}; +#endif diff --git a/src/tokens.h b/src/tokens.h index bd83fbf..488302d 100644 --- a/src/tokens.h +++ b/src/tokens.h @@ -50,6 +50,7 @@ typedef struct tokenDefinition_t { #define NUM_TOKENS_REOSC 0 #define NUM_TOKENS_HPB 0 #define NUM_TOKENS_TOMOCHAIN 0 +#define NUM_TOKENS_TOBALABA 0 extern tokenDefinition_t const TOKENS_AKROMA[NUM_TOKENS_AKROMA]; extern tokenDefinition_t const TOKENS_ELLAISM[NUM_TOKENS_ELLAISM]; @@ -73,6 +74,7 @@ extern tokenDefinition_t const TOKENS_MIX[NUM_TOKENS_MIX]; extern tokenDefinition_t const TOKENS_REOSC[NUM_TOKENS_REOSC]; extern tokenDefinition_t const TOKENS_HPB[NUM_TOKENS_HPB]; extern tokenDefinition_t const TOKENS_TOMOCHAIN[NUM_TOKENS_TOMOCHAIN]; +extern tokenDefinition_t const TOKENS_TOBALABA[NUM_TOKENS_TOBALABA]; #endif diff --git a/tobalaba.png b/tobalaba.png new file mode 100644 index 0000000..5bda6b7 Binary files /dev/null and b/tobalaba.png differ