trezor / trezor-mcu

:lock: Don't use this repo, use the new monorepo instead:
https://github.com/trezor/trezor-firmware
GNU Lesser General Public License v3.0
318 stars 255 forks source link

Get CoinName #420

Closed MelbourneDeveloper closed 6 years ago

MelbourneDeveloper commented 6 years ago

In older versions of the protobuf definitions there was a CoinType message that had a CoinName. There used to be a list that came with the Features message. It looks like this is gone now. There was also a file in this repo called Coins.json from memory. This also seems to be gone.

My understanding is that CoinName is still important when calling GetAddress for coins like Bitcoin Cash for example - especially pre-fork addresses. Am I right?

I can see that the coins list is generated from a mako file. Here is some relevant code in coin_info_c.mako:

https://github.com/trezor/trezor-mcu/blob/555a650eb8bcea352c934ae8d0becd3de80dd58c/firmware/coin_info.c.mako#L25

It seems that the coins.json file was broken up in to smaller files, and I believe these files are here: \vendor\trezor-common\defs\bitcoin . I'm guessing that the mako file iterates through this folder to find all the json files right? So, does this mean that we should use the json data here ourselves? Or, is there a mechanism for getting this data from the device?

MelbourneDeveloper commented 6 years ago

I think I've answered my own question here. This seems to work well.

prusnak commented 6 years ago

Correct. There is no way how to get the info from the device and you should look at trezor-common for coin definitions. Also there is a support.json file which declares the minium version which supports such coin.

matejcik commented 6 years ago

I'll add that you can use tools/cointool.py from trezor-common - either the dump command that will output the data as JSON, or render which will process the Mako templates with the appropriate data fed in