Top Related Projects
Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
Bitcoin wallet for iOS & Android. Built with React Native
Quick Overview
Trezor-firmware is the official repository for the firmware of Trezor hardware wallets, developed by SatoshiLabs. It contains the source code for both Trezor One and Trezor Model T devices, as well as the associated tools and libraries for development and testing.
Pros
- Open-source, allowing for community audits and contributions
- Supports multiple cryptocurrencies and tokens
- Regular updates and security improvements
- Extensive documentation and developer resources
Cons
- Complexity may be challenging for new contributors
- Limited to Trezor hardware devices
- Requires specialized knowledge in embedded systems and cryptography
- Potential for security vulnerabilities if not properly maintained
Code Examples
This is not a code library in the traditional sense, but rather a firmware project. However, here are a few examples of how developers might interact with the project:
- Building the firmware:
# Clone the repository
git clone https://github.com/trezor/trezor-firmware.git
cd trezor-firmware
# Install dependencies
pip3 install -r requirements.txt
# Build firmware for Trezor Model T
make -C core
- Running tests:
# Run unit tests for core
pytest tests/device_tests
- Flashing firmware to a device:
# Flash firmware to Trezor Model T
python3 -m trezorctl firmware-update -f build/core/firmware.bin
Getting Started
To get started with Trezor firmware development:
-
Set up the development environment:
git clone https://github.com/trezor/trezor-firmware.git cd trezor-firmware pip3 install -r requirements.txt
-
Build the firmware:
make -C core
-
Run the emulator:
./core/emu.py
-
For more detailed instructions, refer to the official documentation.
Competitor Comparisons
Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
Pros of BTCPayServer
- More comprehensive payment processing solution for merchants and businesses
- Supports multiple cryptocurrencies beyond just Bitcoin
- Offers a wider range of features, including invoicing and store management
Cons of BTCPayServer
- Larger codebase and potentially more complex to set up and maintain
- May have a steeper learning curve for non-technical users
- Less focused on hardware security compared to Trezor Firmware
Code Comparison
BTCPayServer (C#):
public async Task<IActionResult> CreateInvoice(CreateInvoiceRequest request)
{
var store = HttpContext.GetStoreData();
var result = await _invoiceController.CreateInvoiceCoreRaw(request, store);
return Ok(result);
}
Trezor Firmware (Python):
def sign_tx(self, tx: SignTx) -> None:
self.signing = True
self.tx = tx
self.tx_info = TxInfo(tx)
self.serialize_input_hash = tx.serialize_input_hash
self.serialize_output_hash = tx.serialize_output_hash
self.multisig_fingerprint = tx.multisig_fingerprint
BTCPayServer is a more comprehensive payment processing solution, while Trezor Firmware focuses on hardware wallet security. BTCPayServer's code example shows invoice creation, whereas Trezor Firmware's code demonstrates transaction signing functionality.
Bitcoin wallet for iOS & Android. Built with React Native
Pros of BlueWallet
- Mobile-focused Bitcoin wallet with a user-friendly interface
- Supports multiple wallet types, including Lightning Network
- Active development with frequent updates and new features
Cons of BlueWallet
- Less secure than hardware wallet solutions like Trezor
- Limited to Bitcoin and Lightning Network transactions
- Relies on third-party servers for some functionalities
Code Comparison
BlueWallet (JavaScript):
export const getAddress = async wallet => {
if (wallet.type === HDSegwitBech32Wallet.type) {
return wallet.getAddressAsync();
}
return wallet.getAddress();
};
Trezor Firmware (C):
void fsm_msgGetAddress(const GetAddress *msg) {
RESP_INIT(Address);
CHECK_INITIALIZED
CHECK_PIN
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
if (!coin) return;
HDNode *node = fsm_getDerivedNode(coin->curve_name, msg->address_n, msg->address_n_count, NULL);
if (!node) return;
hdnode_fill_public_key(node);
if (msg->has_show_display && msg->show_display) {
if (!fsm_layoutAddress(node, coin, msg->has_multisig, &msg->multisig)) {
return;
}
}
resp->has_address = true;
hdnode_get_address(node, coin->address_type, resp->address, sizeof(resp->address));
msg_write(MessageType_MessageType_Address, resp);
layoutHome();
}
The code snippets demonstrate the different approaches and complexity levels between the two projects, with BlueWallet focusing on mobile wallet functionality and Trezor Firmware implementing low-level hardware interactions.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Trezor Firmware
Repository Structure
ci
: Gitlab CI configuration filescommon/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, firmware implementation for Trezor Tcrypto
: Stand-alone cryptography library used by both Trezor Core and the Trezor One firmwaredocs
: Assorted documentationlegacy
: Trezor One firmware implementationpython
: Python client library and thetrezorctl
commandstorage
: 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 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 because it contains some useful assorted knowledge.
Security vulnerability disclosure
Please report suspected security vulnerabilities in private to security@satoshilabs.com, also see the disclosure section on the Trezor.io website. Please do NOT create publicly viewable issues for suspected security vulnerabilities.
Documentation
See the docs
folder or visit docs.trezor.io.
Top Related Projects
Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
Bitcoin wallet for iOS & Android. Built with React Native
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot