You would like to contribute to Trezor firmware? Great!
If you are working on a new feature, you probably want to contribute it to the trezor-core repository, not trezor-mcu. This currently runs on Trezor T only, but will soon be ported to Trezor One as well.
Adding a small feature or a fix
If your change is somewhat subtle, feel free to file a PR in one of the appropriate repositories directly. See the PR requirements noted at the bottom of this page.
Adding a new coin
Forks and derivatives
If the coin you are adding is a fork of Bitcoin or other cryptocurrency we already support (in other words, new app is not needed) you can modify the definitions in the trezor-firmware repository. The location depends on the type of the asset to be added:
- Bitcoin clones should be added to the common/defs/bitcoin subdirectory as separate .json files
- Ethereum networks should be added to the common/defs/ethereum/networks.json file
- Ethereum tokens should be added to the ethereum-lists/tokens repository
- NEM mosaics should be added to the common/defs/nem/nem_mosaics.json file
- other coins should be added to the common/defs/misc/misc.json file
If you plan to add a new cryptocurrency, which needs its own app, please follow these instructions:
Create an issue in trezor-firmware stating which coin you plan to add where you state:
- What is the approximate scale? Have a look at the other apps and try to compare your new app with one of those present in the terms of scale.
- Do we need any new cryptographic primitives to support this coin?
- Is there (or will you develop) a frontend wallet that will support Trezor with this coin?
- Provide links to relevant developer documentation, esp. about address format and transaction signing
- Provide a link to a transaction explorer
We will review this issue and give feedback. We either confirm that we would like to have this coin in the firmware and give you a go-ahead or we might decline. Please note that it is not possible to merge each and every coin. Using this workflow we would like to ensure you are not spending time on developing code we will later decline.
Also note that at this time, we do not accept submissions for coins that are not in the Top 30 by market cap.
If you do not create this issue, be aware that we will most likely reject your PR.
If we agree on accepting the coin, you can start developing a pull request. Every submission should contain at least these four components:
- application code itself in core/src/apps directory
- unit tests in core/tests directory
- CLI support in trezorctl
- device (integration) tests in python/trezorlib/tests/device_tests directory.
If you need to add new protobuf messages, these can be found in common/protob directory.
In general, it is a good idea to get inspired by the past Pull requests for other coins. Note that the examples here are split into individual PRs against different repos. We have since switched to monorepo model, so you can get all the changes in a single pull request.
- Ripple: trezor-common, trezor-core, python-trezor
- Lisk: trezor-common, trezor-core, python-trezor
- Tezos: trezor-common, trezor-core, python-trezor
Pull request requirements
Each PR needs to fulfill the following criteria:
- Tests on CI must pass.
- The code is properly formatted (`make style`).
- Commits must have concise commit messages, the imperative mood is preferred (rationale).
- Multiple commits per PR are allowed, but please do not use reverts etc. Use interactive rebase.
- Do not use merge (e.g. merge trezor/master into...). Again, use rebase.