- C 45.1%
- Python 31%
- Rust 18.9%
- HTML 3.4%
- Mako 0.3%
- Other 1.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .clusterfuzzlite | ||
| .github | ||
| ci | ||
| common | ||
| core | ||
| crypto | ||
| docs | ||
| legacy | ||
| nordic | ||
| python | ||
| rust | ||
| storage | ||
| tests | ||
| tools | ||
| vendor | ||
| .clang-format | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| .gitmodules | ||
| .pylintrc | ||
| .yamllint.yml | ||
| build-docker.sh | ||
| CODEOWNERS | ||
| COMMITS.md | ||
| CONTRIBUTING.md | ||
| COPYING | ||
| create_monorepo.py | ||
| LICENSE.md | ||
| Makefile | ||
| pyproject.toml | ||
| pyrightconfig.json | ||
| README.md | ||
| SECURITY.md | ||
| setup.cfg | ||
| shell.nix | ||
| tbench.toml | ||
| uv.lock | ||
Trezor, with the unified opt-in signature hash
An unofficial fork of Trezor Firmware that signs with the unified opt-in signature hash defined by the Bitcoin hardfork, as Bitcoin Knots v29.4.1.knots20260508 specifies it in doc/unified-sighash.md. It is not affiliated with SatoshiLabs. SatoshiLabs has not adopted the fork, so use their firmware instead if that is what you want.
Not audited. Use at your own risk, and no warranty of any kind, see the LICENSE. Builds here are not signed by the vendor, so the device shows an unofficial-firmware warning and its fingerprint on every boot, permanently. Installing it erases the device, and so does going back to official firmware, so you need your recovery seed both times. Everything below the divider is SatoshiLabs' documentation and describes their firmware rather than this fork.
What differs from Trezor Firmware
A signature that opts in commits to every spent amount and scriptPubKey rather than only the input being signed, which closes CVE-2020-14199 at the consensus layer, and it does not verify under the pre-fork rules, so the transaction cannot be replayed onto a chain that has not adopted the change. Signing is byte-for-byte unchanged unless the host asks for it.
TxInput.unified_sighash(protobuf field 21) requests hash type0x21for that input, the wayPSBT_IN_SIGHASH_TYPEcarries it in a PSBT.Capability_UnifiedSigHash(28) is reported inFeatures, andtrezorlibrefuses to request the opt-in from a device that does not report it rather than letting the field be ignored.- The digest itself, in
coreand inlegacy, taken from the sub-hashes both already stream for BIP-341. Those are single SHA-256 where the BIP-143 digests from the same writers are double. - An approval screen naming the hash type, in the same register as the existing sighash warnings.
- The opt-in is bound to what the confirmation screen reported, and a replacement transaction may add it but never remove it.
Script types covered are bare and P2SH, segwit v0 including P2SH-wrapped, and taproot key path. Only SIGHASH_ALL|SIGHASH_UNIFIED is implemented, because this firmware never signs SIGHASH_NONE, SIGHASH_SINGLE or SIGHASH_ANYONECANPAY and so has no legacy counterpart to give a unified form to. Tapscript is unreachable because there is no script-path taproot here.
Trezor Suite does not know about the field, so opting in needs a host that sets it. The Shrike fork does, through lark.
Releases carry Bitcoin-only builds for Model One, Model T, Safe 3, Safe 5 and Safe 7, each built twice in the same container and byte identical, with a reproducible build recipe, published hashes and a signed manifest. Only the Model One build has been run on real hardware; the rest are verified on the emulator.
Trezor Firmware
Repository Structure
ci: Ancillary files, data, and scripts for the CI pipelinecommon/defs: JSON coin definitions and support tablescommon/protob: Common protobuf definitions for the Trezor protocolcommon/tools: Tools for managing coin definitions and related datacore: Trezor Core, a firmware implementation for Trezor T, Trezor Safe 3, Trezor Safe 5, and Trezor Safe 7crypto: Stand-alone cryptography library used by both Trezor Core and the Trezor One firmwaredocs: Assorted documentationlegacy: Trezor One firmware implementationpython: Python client library and thetrezorctlcommandstorage: NORCOW storage implementation used by both Trezor Core and the Trezor One firmwaretests: Firmware unit test suitetools: Miscellaneous build and helper scriptsvendor: Submodules for external dependencies
Contribute
See CONTRIBUTING.md.
Using Conventional Commits is strongly recommended and might be enforced in the future.
Also, please have a look at the docs, either in the docs folder or at docs.trezor.io before contributing. The misc chapter should be read in particular, as it contains useful assorted knowledge.
Security Vulnerability Disclosure
Please do NOT create publicly viewable issues for suspected security vulnerabilities. See the Security tab for reporting instructions.
Documentation
See the docs folder or visit docs.trezor.io.