Developers guide:Contributing

From Trezor Wiki
Jump to: navigation, search


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[edit]

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[edit]

Forks and derivatives[edit]

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-common repository. The location depends on the type of the asset to be added:

Other[edit]

If you plan to add a new cryptocurrency, which needs its own app, please follow these instructions:

Create an issue in trezor-common stating which coin you plan to add where you state:

  • What is the approximate scale? Have a look on the other apps in trezor-core 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.

If you do not create this issue, be aware that we will most likely reject your PR.

If we agree on accepting the coin, the protobuf definitions need to be added first. This is done by expanding the definitions of messages or adding completely new messages in the trezor-common protob subdirectory. Please study the files in this directory to understand how it works.

After the message definitions are accepted, you can work on your changes to trezor-core firmware. You should also add support to the python-trezor repository, which is the trezorctl command line interface.

In general, it is a good idea to get inspired by the past Pull requests for other coins:

Pull request requirements[edit]

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.
Like Trezor? Get one here!