### Environment Setup and Execution Source: https://docs.trezor.io/trezor-firmware/tests/click-tests.html Commands to initialize the development environment, start the emulator, and execute the test suite. ```bash uv sync ``` ```bash source .venv/bin/activate ``` ```bash ./core/emu.py ``` ```bash pytest tests/click_tests ``` -------------------------------- ### Start local update server Source: https://docs.trezor.io/trezor-suite/releases/desktop_updates.html Installs and runs a local HTTP server to host the mocked update files. ```bash npm i -g http-server http-server -p 8989 ``` -------------------------------- ### Install environment Source: https://docs.trezor.io/trezor-firmware/tests/ui-tests.html Install the required environment using uv in the monorepo root. ```bash uv sync ``` -------------------------------- ### emulator-setup Source: https://docs.trezor.io/trezor-user-env/print.html Performs the emulator setup. ```APIDOC ## POST / (emulator-setup) ### Description Perform the emulator setup. ### Parameters - **mnemonic** (str) - Required - **pin** (str) - Required - **passphrase_protection** (bool) - Required - **label** (str) - Required - **needs_backup** (bool) - Optional ### Request Example {"type": "emulator-setup", "mnemonic": "...", "pin": "1234", "passphrase_protection": false, "label": "test"} ``` -------------------------------- ### Start the emulator Source: https://docs.trezor.io/trezor-firmware/core/build/emulator.html Launch the compiled emulator script. ```bash ./emu.py ``` -------------------------------- ### emulator-start Source: https://docs.trezor.io/trezor-user-env/print.html Starts the specified emulator. ```APIDOC ## POST / (emulator-start) ### Description Starts the specified emulator (identified by model + version). If one already runs, it is killed. ### Parameters - **model** (str) - Required - Enum: ["T1B1", "T2T1", "T3B1", "T3T1", "T3W1"] - **version** (str) - Optional - Emulator version (e.g., 2.4.0, -latest) - **wipe** (bool) - Optional - Whether to delete the emulator profile before starting. - **output_to_logfile** (bool) - Optional - Whether debug output should go to a logfile. - **save_screenshots** (bool) - Optional - Whether to save screenshots. ### Request Example {"type": "emulator-start", "model": "T2T1", "version": "2.4.0"} ``` -------------------------------- ### Install Trezor Library Source: https://docs.trezor.io/trezor-firmware/python/trezorlib.html Standard installation command for the trezor library using pip. ```bash pip3 install trezor ``` -------------------------------- ### Setup Development Environment Source: https://docs.trezor.io/trezor-firmware/python/trezorlib.html Commands to clone the repository and initialize the development environment using uv. ```bash git clone https://github.com/trezor/trezor-firmware cd trezor-firmware git submodule update --init --recursive uv sync source .venv/bin/activate ``` -------------------------------- ### emulator-start Source: https://docs.trezor.io/trezor-user-env/controller.html Starts a specific Trezor emulator instance. ```APIDOC ## emulator-start ### Description Starts the specified emulator model and version. If an emulator is already running, it will be terminated. ### Parameters - **model** (string) - Required - One of ["T1B1", "T2T1", "T3B1", "T3T1", "T3W1"] - **version** (string) - Optional - Firmware version or "-latest" - **wipe** (boolean) - Optional - Whether to delete the profile before starting - **output_to_logfile** (boolean) - Optional - Whether to log debug output - **save_screenshots** (boolean) - Optional - Whether to enable screenshot functionality ### Request Example { "type": "emulator-start", "model": "T2T1", "version": "2.4.0" } ``` -------------------------------- ### Build and run the emulator Source: https://docs.trezor.io/trezor-firmware/developers/hello_world_in_core.html Commands to compile the unix emulator and start the process. ```bash __ cd core make build_unix ./emu.py ``` -------------------------------- ### Execute the Hello World command Source: https://docs.trezor.io/trezor-firmware/developers/hello_world_in_core.html Example command line invocation to trigger the custom functionality. ```bash __ $ trezorctl helloworld say-hello George -a 3 -d Please confirm action on your Trezor device. Hello George! Hello George! Hello George! ``` -------------------------------- ### Install dependencies on OpenSUSE Source: https://docs.trezor.io/trezor-firmware/core/build/emulator.html Install required packages for OpenSUSE systems. ```bash sudo zypper install scons libSDL2-devel libSDL2_image-devel ``` -------------------------------- ### Installing coverage.py Source: https://docs.trezor.io/trezor-firmware/tests/device-tests.html Installs the tool required for generating Python code coverage reports. ```bash pip3 install coverage ``` -------------------------------- ### Start Local trezor-user-env with Docker Compose Source: https://docs.trezor.io/trezor-user-env/development.html Commands to start the local version of trezor-user-env using compose.local.yml overrides. ```bash docker compose -f docker/compose.yml -f docker/compose.local.yml up trezor-user-env-unix docker compose -f docker/compose.yml -f docker/compose.local.yml up trezor-user-env-mac ``` ```bash --build --force-recreate ``` -------------------------------- ### Device Metadata Example Source: https://docs.trezor.io/trezor-suite/features/metadata.html Example of the JSON structure for device-level metadata. ```json { "version": "1.0.0", "walletLabel": "my hidden wallet label", } ``` -------------------------------- ### Install Optional Trezor Dependencies Source: https://docs.trezor.io/trezor-firmware/python/trezorlib.html Commands to install specific feature sets for the Trezor library. ```bash pip3 install trezor[ble] ``` ```bash pip3 install trezor[ethereum] ``` ```bash pip3 install trezor[stellar] ``` ```bash pip3 install trezor[hidapi] ``` ```bash pip3 install trezor[ble,hidapi,ethereum,stellar] ``` -------------------------------- ### Install dependencies on Debian/Ubuntu Source: https://docs.trezor.io/trezor-firmware/core/build/emulator.html Install required packages for Debian or Ubuntu systems. ```bash sudo apt-get install scons libsdl2-dev libsdl2-image-dev llvm-dev libclang-dev clang ``` -------------------------------- ### Build Firmware with Debug Console Source: https://docs.trezor.io/trezor-firmware/core/misc/logging.html Example command to build firmware with the USB VCP debug console enabled. ```bash make build_firmware TREZOR_MODEL=T3W1 DBG_CONSOLE=VCP ``` -------------------------------- ### Sync Python dependencies with uv Source: https://docs.trezor.io/trezor-firmware/core/build/embedded.html Install dependencies and activate the virtual environment managed by uv. ```bash uv sync source .venv/bin/activate ``` -------------------------------- ### Unpack Windows Installer Source: https://docs.trezor.io/trezor-suite/releases/signing-binaries-win.html Extract the contents of the Trezor Suite Windows installer on Linux using 7za. ```bash 7za x Trezor-Suite-22.2.1-win-x64.exe ``` -------------------------------- ### Start GDB Server for SWD Adapters Source: https://docs.trezor.io/trezor-firmware/core/embed_debug/index.html Commands to initialize the GDB server for JLink or OpenOCD adapters. ```bash JLinkGDBServerCLExe -select USB -device STM32F427VI -endian little -if SWD -speed 4000 -LocalhostOnly ``` ```bash openocd -f interface/stlink.cfg -f target/stm32f4x.cfg ``` -------------------------------- ### Run Trezor Suite web and desktop apps Source: https://docs.trezor.io/trezor-suite/misc/development-on-nix.html Commands to start the development servers for the web and desktop applications. ```bash nix develop yarn yarn suite:dev # Web app at http://localhost:8000 yarn suite:dev:desktop # Electron desktop app ``` -------------------------------- ### Emulator Lifecycle Source: https://docs.trezor.io/trezor-user-env/print.html Methods to start and stop the Trezor emulator. ```APIDOC ## emulator_start ### Description Starts an emulator with a specific model and firmware version. ### Parameters - **model** (str) - Required - One of "T1B1", "T2T1", "T3B1", "T3T1", "T3W1". - **version** (str) - Optional - Firmware version (e.g., "2.7.1", "-latest"). Default: "" (latest dev build). - **wipe** (bool) - Optional - Default: false. ## emulator_start_from_url ### Description Starts an emulator from a firmware binary URL. ### Parameters - **url** (str) - Required - **model** (str) - Required - **wipe** (bool) - Optional ## emulator_start_from_branch ### Description Starts an emulator built from a git branch. ### Parameters - **branch** (str) - Required - **model** (str) - Required - **btc_only** (bool) - Optional - **wipe** (bool) - Optional ## emulator_stop ### Description Stops the running emulator. ``` -------------------------------- ### Download production binary and signature Source: https://docs.trezor.io/trezor-suite/releases/desktop_updates.html Downloads a specific production installer and its corresponding signature file for verification testing. ```bash curl https://data.trezor.io/suite/releases/desktop/latest/Trezor-Suite-26.7.2-win-x64.exe > Trezor-Suite-26.7.2-win-x64.exe curl https://data.trezor.io/suite/releases/desktop/latest/Trezor-Suite-26.7.2-win-x64.exe.asc > Trezor-Suite-26.7.2-win-x64.exe.asc ``` -------------------------------- ### Emulator Lifecycle Source: https://docs.trezor.io/trezor-user-env/mcp.html Methods to start, stop, and configure Trezor emulator instances. ```APIDOC ## emulator_start ### Description Starts an emulator with a specific model and firmware version. ### Parameters - **model** (str) - Required - One of "T1B1", "T2T1", "T3B1", "T3T1", "T3W1". - **version** (str) - Optional - Firmware version (e.g., "2.7.1"). - **wipe** (bool) - Optional - Whether to wipe data. ## emulator_start_from_url ### Description Starts an emulator from a firmware binary URL. ### Parameters - **url** (str) - Required - **model** (str) - Required - **wipe** (bool) - Optional ## emulator_start_from_branch ### Description Starts an emulator built from a git branch. ### Parameters - **branch** (str) - Required - **model** (str) - Required - **btc_only** (bool) - Optional - **wipe** (bool) - Optional ## emulator_stop ### Description Stops the running emulator. ``` -------------------------------- ### Run Emulator Source: https://docs.trezor.io/trezor-firmware/tests/device-tests.html Start the emulator in a separate terminal session. ```bash ./core/emu.py ``` -------------------------------- ### Example Message System Configuration Source: https://docs.trezor.io/trezor-suite/features/message-system.html A sample JSON configuration structure for the message system, including versioning, timestamps, and conditional action definitions. ```json { // Version of message system implementation. Bump if new version is not backward compatible. "version": 1, // Datetime in ISO8601 when was config created. "timestamp": "2021-03-03T03:48:16+00:00", // Version of config. New config is accepted only if sequence number is higher. "sequence": 1, "actions": [ { /* - User's stack has to match one of the condition objects to show this message. - The bitwise operation is OR. */ "conditions": [ /* - All keys are optional (duration, os, environment, browser, settings, transport, ``` -------------------------------- ### Run Trezor Suite on Android Source: https://docs.trezor.io/trezor-suite/misc/development-on-nix.html Commands to start the Metro bundler and run the application on an Android device. ```bash nix develop .#android yarn yarn native:start # Start Metro bundler (in one terminal) yarn a # Run on Android (in another terminal) ``` -------------------------------- ### emulator-read-and-confirm-atomic-shamir-mnemonic Source: https://docs.trezor.io/trezor-user-env/print.html Simulates the atomic Shamir backup process where the device starts at the share-number picker screen. ```APIDOC ## emulator-read-and-confirm-atomic-shamir-mnemonic ### Description Simulates the atomic Shamir backup process (e.g. for T3W1) where the device starts at the share-number picker screen. ### Arguments - **shares** (int) - Optional - Default: 1 - **threshold** (int) - Optional - Default: 1 ``` -------------------------------- ### Run local CoinJoin backend Source: https://docs.trezor.io/trezor-suite/features/coinjoin.html Execute the shell script to start the local CoinJoin backend container for development purposes. ```bash ./docker/docker-coinjoin-backend.sh ``` -------------------------------- ### Checkout the project Source: https://docs.trezor.io/trezor-firmware/core/build/index.html Initializes the repository and sets up the environment. ```bash git clone --recurse-submodules https://github.com/trezor/trezor-firmware.git cd trezor-firmware uv sync cd core ``` -------------------------------- ### Install dependencies on Fedora Source: https://docs.trezor.io/trezor-firmware/core/build/emulator.html Install required packages for Fedora systems. ```bash sudo yum install scons SDL2-devel SDL2_image-devel clang-devel ``` -------------------------------- ### Install dependencies on macOS Source: https://docs.trezor.io/trezor-firmware/core/build/emulator.html Install required packages for macOS using Homebrew. ```bash brew install scons sdl2 sdl2_image pkg-config llvm ``` -------------------------------- ### Initialize and use the Logger Source: https://docs.trezor.io/trezor-suite/features/desktop-logger.html Demonstrates creating a logger instance with custom options and invoking various log methods. ```javascript const logger = new Logger('warn', { colors: false, // Turning off colors logFormat: '%lvl: %msg', // Level and message only writeToDisk: true, // Write to disk outputFile: 'log-desktop.txt', // Static file name, will be overwritten if it exists }); // These messages will be printed with the level provided above logger.error('example', 'This is an example error message with the topic "example"'); logger.warn('example', 'This is an example warn message with the topic "example"'); // And these won't logger.info('example', 'This is an example info message with the topic "example"'); logger.debug('example', 'This is an example debug message with the topic "example"'); // Closes the write stream (only needed of writing the log file) logger.exit(); ``` -------------------------------- ### Install dependencies on Arch Source: https://docs.trezor.io/trezor-firmware/core/build/emulator.html Install required packages for Arch Linux systems. ```bash sudo pacman -S scons sdl2 sdl2_image clang-devel ``` -------------------------------- ### Install FFmpeg on MacOS Source: https://docs.trezor.io/trezor-suite/misc/videos.html Use Homebrew to install the FFmpeg encoder required for video processing. ```bash brew install ffmpeg ``` -------------------------------- ### Initialize Development Environment Source: https://docs.trezor.io/trezor-firmware/tests/upgrade-tests.html Commands to enter the nix-shell and synchronize the Python environment. ```bash nix-shell uv sync source .venv/bin/activate ``` -------------------------------- ### Account Metadata Example Source: https://docs.trezor.io/trezor-suite/features/metadata.html Example of the JSON structure for account-level metadata, including transaction and address labels. ```json { "version": "1.0.0", "accountLabel": "my cool account label", "outputLabels": { "9f472739fa7034dfb9736fa4d98915f2e8ddf70a86ee5e0a9ac0634f8c1d0007": { "0": "transaction 1" }, }, "addressLabels": { "bc1qannfxke2tfd4l7vhepehpvt05y83v3qsf6nfkk": "my cool address label", } } ``` -------------------------------- ### Run Controller on NixOS Source: https://docs.trezor.io/trezor-user-env/development.html Commands to prepare binaries and execute the controller locally on NixOS. ```bash nix-shell --run 'uv run python src/main.py' ``` ```bash uv run python src/binaries/firmware/bin/download.py ``` ```bash src/binaries/trezord-go/bin/download.sh ``` -------------------------------- ### bridge-start Source: https://docs.trezor.io/trezor-user-env/controller.html Starts a specific version of the Trezor bridge. ```APIDOC ## bridge-start ### Description Starts the specified version of the bridge if it is not already running. ### Parameters - **version** (str) - Optional - The bridge version (e.g., 2.0.27). - **output_to_logfile** (bool) - Optional - Whether to log output to a file (default=True). ``` -------------------------------- ### Initialize Trezor User Environment Source: https://docs.trezor.io/trezor-suite/symlink/tests/e2e-playwright-suite.html Commands to prepare the local environment for E2E testing. ```bash ./run.sh ``` ```bash yarn workspace @trezor/suite-e2e docker:suite-sync ``` -------------------------------- ### Initialize nix-shell with Android support Source: https://docs.trezor.io/trezor-suite/misc/development-on-nix.html Command to enter the nix-shell with Android SDK and JDK dependencies enabled. ```bash USE_ANDROID=1 nix-shell ``` -------------------------------- ### Download release metadata for local mocking Source: https://docs.trezor.io/trezor-suite/releases/desktop_updates.html Fetches the latest release configuration files for Windows, macOS, and Linux to a local directory. ```bash curl https://data.trezor.io/suite/releases/desktop/latest/latest.yml > latest.yml curl https://data.trezor.io/suite/releases/desktop/latest/latest-mac.yml > latest-mac.yml curl https://data.trezor.io/suite/releases/desktop/latest/latest-linux.yml > latest-linux.yml ``` -------------------------------- ### Build firmware components Source: https://docs.trezor.io/trezor-firmware/core/build/embedded.html Compile the boardloader, bootloader, and firmware from the repository root. ```bash make vendor build_boardloader build_bootloader build_firmware ``` -------------------------------- ### Build Trezor Legacy Firmware Source: https://docs.trezor.io/trezor-firmware/legacy/index.html Commands to initialize the environment and execute the build process for the emulator or device firmware. ```bash # enter the legacy subdirectory cd legacy # set up uv uv sync # set up environment variables. For example, to build emulator with debuglink: export EMULATOR=1 DEBUG_LINK=1 # clear build artifacts uv run ./script/setup # run build process uv run ./script/cibuild ``` -------------------------------- ### Run emulator Source: https://docs.trezor.io/trezor-firmware/tests/ui-tests.html Start the emulator with animations disabled in a separate terminal. ```bash ./core/emu.py -a ``` -------------------------------- ### Initialize nix-shell environment Source: https://docs.trezor.io/trezor-firmware/core/build/embedded.html Run this command in the repository root to enter the isolated development environment. ```bash nix-shell ``` -------------------------------- ### Allocate, execute, and end a session Source: https://docs.trezor.io/trezor-firmware/common/protocol_v1/sessions.html Demonstrates the lifecycle of a single session from initialization to termination. ```text Initialize() ---------> Features(..., session_id=AAAA) <--------- ------ Request ---------> Response <--------- EndSession() ---------> Success() <--------- ------ ``` -------------------------------- ### Get Receive Address Source: https://docs.trezor.io/trezor-suite/packages/suite-desktop/skills/trezor-mcp/references/tools-reference.html Retrieves a receive address from the connected Trezor device. ```APIDOC ## JSON-RPC: getAddress ### Description Get a receive address from the Trezor device. Automatically selects the correct method based on coin type. ### Parameters - **coin** (string) - Required - Coin symbol (e.g., "btc", "eth", "ltc") - **path** (string) - Required - BIP44 derivation path (e.g., "m/84'/0'/0'/0/0") - **showOnTrezor** (boolean) - Optional - Display the address on device screen for verification (default: false) ``` -------------------------------- ### Run UI tests Source: https://docs.trezor.io/trezor-firmware/tests/ui-tests.html Execute the UI tests using the make command. ```bash uv run make -C core test_emu_ui ``` -------------------------------- ### Avoid Fragile Locators Source: https://docs.trezor.io/trezor-suite/symlink/tests/e2e-playwright-contribution-guide.html Examples of XPath and CSS selectors that should be avoided due to their fragility. ```typescript await page .locator('#tsf > div:nth-child(2) > div.A8SBwf > div.RNNXgb > div > div.a4bIc > input') .click(); await page.locator('//*[@id="tsf"]/div[2]/div[1]/div[1]/div/div[2]/input').click(); ``` -------------------------------- ### Log Message Macro Source: https://docs.trezor.io/trezor-firmware/core/misc/logging.html Example of using the printf-like logging macro for error reporting. ```c LOG_ERR("operation failed (errcode=%d)", errcode); ``` -------------------------------- ### Prepare microSD card for bootloader update Source: https://docs.trezor.io/trezor-firmware/core/misc/boot.html Commands to clear the SD card and write the bootloader binary. Ensure the destination device path is correct before execution. ```bash sudo dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=256 conv=fsync sudo dd if=build/bootloader/bootloader.bin of=/dev/mmcblk0 bs=512 conv=fsync ``` -------------------------------- ### GET /definitions.tar.xz Source: https://docs.trezor.io/trezor-firmware/common/external-definitions.html Downloads the full set of signed definitions in a single tar archive. ```APIDOC ## GET /definitions.tar.xz ### Description Downloads the full set of signed definitions in a single tar archive. ### Method GET ### Endpoint https://data.trezor.io/firmware/definitions/definitions.tar.xz ``` -------------------------------- ### GET /eth/slip44//network.dat Source: https://docs.trezor.io/trezor-firmware/common/external-definitions.html Retrieves the network definition for a specific SLIP-44 identifier. ```APIDOC ## GET /eth/slip44//network.dat ### Description Retrieves the network definition for a given SLIP-44 identifier, useful for calls that do not depend on a specific chain ID. ### Method GET ### Endpoint https://data.trezor.io/firmware/definitions/eth/slip44//network.dat ### Parameters #### Path Parameters - **SLIP44_ID** (decimal) - Required - The decimal SLIP-44 identifier. ``` -------------------------------- ### Define Hello World Protobuf Messages Source: https://docs.trezor.io/trezor-firmware/developers/hello_world_in_core.html Create a new .proto file to define the request and response structures for the custom feature. ```protobuf syntax = "proto2"; package hw.trezor.messages.helloworld; // Sugar for easier handling in Java option java_package = "com.satoshilabs.trezor.lib.protobuf"; option java_outer_classname = "TrezorMessageHelloWorld"; /** * Request: Hello world request for text * @next HelloWorldResponse * @next Failure */ message HelloWorldRequest { required string name = 1; optional uint32 amount = 2 [default=1]; optional bool show_display = 3; } /** * Response: Hello world text * @end */ message HelloWorldResponse { required string text = 1; } ``` -------------------------------- ### Build and flash firmware for DISC1 Source: https://docs.trezor.io/trezor-firmware/core/misc/disc1.html Commands to compile the firmware images and flash them to the board using OpenOCD via the ST-Link interface. ```bash make build_boardloader build_bootloader build_firmware TREZOR_MODEL=DISC1 make flash ``` -------------------------------- ### Action Logs Data Structure Source: https://docs.trezor.io/trezor-suite/analytics/sentry.html Example of the action logs array tracking application events. ```json __ [ { time: 1634644852099, type: @suite/online-status }, { action: {}, time: 1634644852104, type: @suite/init }, { time: 1634644852966, type: @message-system/save-valid-messages }, { time: 1634644852967, type: @suite/tor-status }, { time: 1634644853131, type: @resize/update-window-size }, { time: 1634644853306, type: @desktop-update/enable }, { time: 1634644853361, type: @desktop-update/checking }, { time: 1634644853449, type: @message-system/save-valid-messages }, { action: {}, time: 1634644853453, type: @suite/set-language }, { time: 1634644853455, type: @storage/loaded }, { time: 1634644853717, type: @message-system/fetch-config-success }, { time: 1634644853744, type: @analytics/init }, { time: 1634644854072, type: @desktop-update/not-available }, { time: 1634644854166, type: iframe-loaded }, { time: 1634644854168, type: @suite/trezor-connect-initialized }, { time: 1634644854187, type: @blockchain/update-fee }, { action: {}, time: 1634644854188, type: @suite/app-changed }, { time: 1634644854189, type: @router/location-change }, { time: 1634644854191, type: @suite/ready }, { time: 1634644854192, type: @wallet-settings/clear-tor-blockbook-urls }, { time: 1634644854192, type: @blockchain/ready }, ] ``` -------------------------------- ### Manage multiple sessions and resume Source: https://docs.trezor.io/trezor-firmware/common/protocol_v1/sessions.html Shows how to switch between multiple sessions and resume a previously initialized session using its ID. ```text Initialize() ---------> Features(..., session_id=AAAA) <--------- ------ Request ---------> Response <--------- Initialize() ---------> Features(..., session_id=BBBB) <--------- ------ Request ---------> Response <--------- Initialize(session_id=AAAA) ---------> Features(..., session_id=AAAA) <--------- ------ Request ---------> Response <--------- ``` -------------------------------- ### Run Trezor Suite with debug logging Source: https://docs.trezor.io/trezor-suite/packages/suite-desktop/debugging.html Launch the application from the command line with the --log-level=debug flag to capture detailed logs. ```bash ./Trezor-Suite-22.7.2.AppImage --log-level=debug ``` ```bash ./Trezor\ Suite.app/Contents/MacOS/Trezor\ Suite --log-level=debug ``` ```bash appimage-run ./Trezor-Suite.AppImage --log-level=debug ``` ```bash "C:\Users\[user-name]\AppData\Local\Programs\Trezor Suite\Trezor Suite.exe" --log-level=debug ``` -------------------------------- ### Wallet Discovery Data Structure Source: https://docs.trezor.io/trezor-suite/analytics/sentry.html Example of the wallet discovery state object collected by analytics. ```json __ [ { bundleSize: 0, deviceState: [redacted], failed: [], index: 0, loaded: 14, networks: [btc, btc, btc, ltc, ltc, ltc, eth, xrp, doge], running: [undefined], status: 4, total: 14, }, ] ``` -------------------------------- ### Protobuf TxAck Definition Source: https://docs.trezor.io/trezor-firmware/common/bitcoin-signing.html Example of a nested Protobuf message structure used for transaction acknowledgment. ```protobuf message TxAck { optional TransactionType tx = 1; message TransactionType { // ... some fields omitted ... repeated TxInputType inputs = 2; // ... some fields omitted ... message TxInputType { repeated uint32 address_n = 1; // ... some fields omitted ... optional uint64 amount = 8; // ... some fields omitted ... } } } ``` -------------------------------- ### Build the emulator Source: https://docs.trezor.io/trezor-firmware/core/build/emulator.html Compile the firmware for the Unix emulator, optionally specifying a model. ```bash make build_unix # default make build_unix TREZOR_MODEL=T2B1 # different model ``` -------------------------------- ### Defining an Application Handler Source: https://docs.trezor.io/trezor-firmware/core/src/apps.html Example of an asynchronous handler function signature for processing a GetAddress message. ```python # in core/src/apps/bitcoin/get_address.py # ... async def get_address(msg: GetAddress, keychain: Keychain, coin: CoinInfo) -> Address: # ... ``` -------------------------------- ### Manage Android Virtual Devices Source: https://docs.trezor.io/trezor-suite/misc/development-on-nix.html Commands to list and launch Android Virtual Devices. ```bash nix develop .#android # list available AVDs with: avdmanager list avd emulator -avd emulator -avd Pixel_6_API_34 ``` -------------------------------- ### Initialize and Session Resumption Flow Source: https://docs.trezor.io/trezor-firmware/common/protocol_v1/passphrase-redesign-migration.html Demonstrates the message exchange sequence for initializing a session and checking for successful resumption. ```text --> Initialize() <-- Features(session_id=0xABCDEF, ...) --> Initialize(session_id=0xABCDEF) <-- Features(session_id=0xABCDEF) # (session resumed successfully) --> Initialize(session_id=0xABCDEF) <-- Features(session_id=0x123456) # (session was not resumed, user will be prompted for passphrase again) ``` -------------------------------- ### Get Account Information Source: https://docs.trezor.io/trezor-suite/packages/suite-desktop/skills/trezor-mcp/references/tools-reference.html Retrieves account details including balance, transaction history, and UTXOs. ```APIDOC ## JSON-RPC: getAccountInfo ### Description Get account information including balance, transaction history, and UTXOs. ### Parameters - **coin** (string) - Required - Coin symbol - **path** (string) - Optional - BIP44 account-level derivation path - **descriptor** (string) - Optional - Account descriptor (xpub for BTC, address for ETH). Alternative to path - **details** (string) - Optional - Detail level: "basic", "tokens", "tokenBalances", "txids", "txs" (default: "basic") ``` -------------------------------- ### GET /solana/token/.dat Source: https://docs.trezor.io/trezor-firmware/common/external-definitions.html Retrieves the token definition for a specific Solana mint account. ```APIDOC ## GET /solana/token/.dat ### Description Retrieves the token definition for a given Solana mint account. ### Method GET ### Endpoint https://data.trezor.io/firmware/definitions/solana/token/.dat ### Parameters #### Path Parameters - **MINT_ACCOUNT** (string) - Required - The base58-encoded mint account of the token. ``` -------------------------------- ### Build firmware with debug options Source: https://docs.trezor.io/trezor-firmware/core/embed_debug/index.html Use these make flags to enable debuglink, verbose output, and optimization levels suitable for debugging. ```bash make PYOPT=0 BITCOIN_ONLY=1 V=1 VERBOSE=1 OPTIMIZE=-Og build_firmware ``` -------------------------------- ### Execute test suite Source: https://docs.trezor.io/trezor-firmware/tests/ui-tests.html Run the device tests with UI testing enabled. ```bash pytest tests/device_tests --ui=test ``` ```bash pytest tests/device_tests --ui=test --ui-check-missing ```