Repository storing external token/network definitions belonging to Trezor. It helps by offloading the storage of these data into a client application, so that the device itself does not need to store them (because of flash-size constraints). It also allows for more frequent updates of these definitions. Device requests these data on demand and validates the signature.
cli.py- entry point for all definition handling (download,generate,sign, ...)definitions/- Python package with the tooling, split by concern:common.py- coin-agnostic core: definitions file format, payload encoding, shared helpersserialize.py- serialization dispatch over all coins, Merkle root computationdownloader.py- coin-agnostic downloading/caching of source data (CoinGecko, DeFiLlama)download.py- thedownloadcommand orchestrating the whole pipelinecheck_definitions.py,generate.py,sign.py,crypto.py- coin-agnostic diffing, binary generation and signingethereum/- everything Ethereum-specific: types, serialization, data sources (ethereum-lists, ERC-7730 registry, on-chain), built-in definitions checksolana/- everything Solana-specific: types, serialization, data sources
coins_details/- generation ofcoins_details.json(market/support data per coin)ethereum-lists/,ethereum/clear-signing-erc7730-registry,coins_details/trezor_common- data source submodules
When adding definitions for another coin, add a new definitions/<coin>/ subpackage with its types, serialization and data loading, and wire it into serialize.py / download.py.
./do_update.sh makes sure to update all definitions to their latest version. It is using data from multiple sources, e.g. ethereum-lists repository and coingecko API.
This script will automatically create a commit with these changes.
To prevent incorrect/malicious definitions from being supplied to Trezor, they need to be signed before using them.
Signing has the following steps:
- run
python cli.py computed-merkle-rootto get themerkle_rootcomputed from the definitions data rather than trusting the value stored indefinitions-latest.json::metadata::merkle_root - sign it with appropriate keys (outside of definitions repo)
- get the signature and provide it as an argument to
do_sign.sh, e.g../do_sign.sh abcd... - the results should look something like this signing commit - https://github.com/trezor/definitions/commit/42d3093e83c85dade59af92a37fb3c33d3b047eb
definitions.tar.gzfile should also be created, containing signed definitions, ready for deployment