### Run Trezor Client Examples Source: https://github.com/trezor/trezor-firmware/blob/main/rust/trezor-client/README.md Execute the provided examples for the `trezor-client` Rust crate to demonstrate its features and functionality. This command runs the `features` example, showcasing various capabilities of the library. ```Shell cargo run --example features ``` -------------------------------- ### Interactively Signing Bitcoin Transaction with Python Script Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/EXAMPLES.rst This command demonstrates an interactive method for signing a Bitcoin transaction by piping output from a Python script (`tools/build_tx.py`) to `trezorctl`. It guides the user through providing necessary transaction details like previous outputs, BIP32 paths, destination addresses, and amounts, then signs the transaction on the Trezor device. ```bash $ python3 tools/build_tx.py | trezorctl btc sign-tx - Coin name [Bitcoin]: Bitcoin Previous output to spend (txid:vout) []: a5ea715aa99ca30516f3af6f622dfe7399d883d49ad74b1fe33fdf73d201e64e:0 BIP-32 path to derive the key: m/44h/0h/0h/0/0 Prefilling input amount: 111000 Sequence Number to use (RBF opt-in enabled by default) [4294967293]: 4294967293 Input type (address, segwit, p2shsegwit) [address]: Previous output to spend (txid:vout) []: Output address (for non-change output) []: 3M8XGFBKwkf7miBzpkU3x2DoWwAVrD1mhk Amount to spend (satoshis): 91305 Output address (for non-change output) []: BIP-32 path (for change output) []: Transaction version [2]: Transaction locktime [0]: Please confirm action on your Trezor device Signed Transaction: 02000000014ee601d273df3fe31f4bd79ad483d89973fe2d626faff316(...) ``` -------------------------------- ### Install Trezorlib with Ethereum Support Source: https://github.com/trezor/trezor-firmware/blob/main/docs/python/trezorlib.md Installs `trezorlib` along with additional packages required for supporting Ethereum signing functionality from the command line. This option extends the basic installation to include Ethereum-specific features. ```sh pip3 install trezor[ethereum] ``` -------------------------------- ### Install Core Dependencies for OpenSUSE Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/build/emulator.md Install essential build dependencies for the Trezor emulator on OpenSUSE systems, including SCons and SDL2 libraries. ```sh sudo zypper install scons libSDL2-devel libSDL2_image-devel ``` -------------------------------- ### Install All Trezorlib Optional Features Source: https://github.com/trezor/trezor-firmware/blob/main/docs/python/trezorlib.md Installs `trezorlib` with all available optional features, including HIDAPI support for older devices, and extended support for Ethereum, Stellar, and advanced device authentication. This command provides a comprehensive installation for all use cases. ```sh pip3 install trezor[hidapi,ethereum,stellar,authentication] ``` -------------------------------- ### Install Poetry Environment for UI Tests Source: https://github.com/trezor/trezor-firmware/blob/main/docs/tests/ui-tests.md Installs the necessary Python dependencies using Poetry for the `trezor-firmware` monorepo. This step is crucial before running any UI tests. ```sh poetry install ``` -------------------------------- ### Example Output from xpubaddrgen Address Generation Source: https://github.com/trezor/trezor-firmware/blob/main/crypto/tools/README.md Demonstrates the addresses generated by the `xpubaddrgen` utility based on the provided example input. The output shows the job ID, the derivation index, and the corresponding Bitcoin address for each requested derivation. ```text 23 0 14vb5Cws75p2i5rmSiF5CKMyezUX4hxSb9 23 1 1Lf4ciA36dsi1niF6smVcpCiHcpj2skaPq 23 2 1LraByp7gQAipvHnFS1gTSzixBtYaVyQGp 23 3 1Hy6n56qZj1EefLVfDAeEpmveNteY9jpiG 23 4 183Nn4mrUjPizM3xu8C6SrmViaWrk8YyRS 42 1000 12eAFGAqGUtszc9R7euRqk7DUcQNXvQZSg 42 1001 1BrLbFCD3MNYedJaz92U9iqy9ukHrtQ1A6 42 1002 1Jhv33bJy229ThM7HKxUa92cMK5gi7DyPC 42 1003 13LxbTjQPByisj4F4sZEivUBdnJwigzg6R 42 1004 1BWBpSWkPwcKxVr2WDyUqQbmvk5SGihcx9 ``` -------------------------------- ### Example Trezorctl Hello World CLI Call and Output Source: https://github.com/trezor/trezor-firmware/blob/main/docs/developers/hello_world_feature_TT.md This example demonstrates how to invoke the `say-hello` command from the command line using `trezorctl`, passing arguments and options. It also shows the expected output, including the device confirmation prompt and the repeated 'Hello George!' messages. ```sh $ trezorctl helloworld say-hello George -a 3 -d Please confirm action on your Trezor device. Hello George! Hello George! Hello George! ``` -------------------------------- ### Example Input for xpubaddrgen Address Generation Source: https://github.com/trezor/trezor-firmware/blob/main/crypto/tools/README.md Illustrative examples of job specifications provided to the `xpubaddrgen` utility via standard input. These lines demonstrate how to request address generation for different xpubs and index ranges. ```text 23 xpub6BcjTvRCYD4VvFQ8whztSXhbNyhS56eTd5P3g9Zvd3zPEeUeL5CUqBYX8NSd1b6Thitr8bZcSnesmXZH7KerMcc4tUkenBShYCtQ1L8ebVe 0 0 5 42 xpub6AT2YrLinU4Be5UWUxMaUz3zTA99CSGvXt1jt2Lgym8PqXbTzmpQ8MHjoLnx8YJiMMUP5iEfR97YQVmgF6B2tAhbCZrXqn65ur526NkZ6ey 1 1000 1005 ``` -------------------------------- ### Install Dependencies using NixOS Shell Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/build/emulator.md Utilize the `shell.nix` file in the project root to automatically set up the required development environment and dependencies for NixOS users. ```sh nix-shell ``` -------------------------------- ### Displaying trezorctl Help Options Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/EXAMPLES.rst This command shows all available command-line options and general usage information for the `trezorctl` utility. It's useful for discovering supported commands and their arguments, providing a quick reference for its functionalities. ```bash $ trezorctl --help ``` -------------------------------- ### Install Python Coverage Tool Source: https://github.com/trezor/trezor-firmware/blob/main/tests/device_tests/README.md Installs the `coverage.py` tool using pip3, which is required to generate HTML or console summary outputs for code coverage reports. ```Shell pip3 install coverage ``` -------------------------------- ### Executing the Pareen Plot Example with Easer Feature Source: https://github.com/trezor/trezor-firmware/blob/main/rust/pareen/README.md This Bash command shows how to run the `plots` example provided with the Pareen library. It uses `cargo run` to execute the example, enabling the `easer` feature which is required for the plot generation. This command is useful for visualizing the behavior of various Pareen animations. ```Bash cargo run --example plots --feature easer ``` -------------------------------- ### Install Trezor Library from GitHub Source: https://github.com/trezor/trezor-firmware/blob/main/python/README.md Installs the latest development version of `trezorlib` directly from the `trezor-firmware` GitHub repository. ```sh pip3 install "git+https://github.com/trezor/trezor-firmware#egg=trezor&subdirectory=python" ``` -------------------------------- ### Install Trezor Library with Ethereum Support Source: https://github.com/trezor/trezor-firmware/blob/main/python/README.md Installs `trezorlib` with additional packages required for supporting Ethereum signing from the command line. ```sh pip3 install trezor[ethereum] ``` -------------------------------- ### Start Trezor Emulator for UI Tests Source: https://github.com/trezor/trezor-firmware/blob/main/docs/tests/ui-tests.md Launches the Trezor emulator with animations disabled, which is recommended for UI testing to ensure consistent screenshots and reliable test results. ```sh ./core/emu.py -a ``` -------------------------------- ### Get Litecoin SegWit-in-P2SH Address with trezorctl Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/EXAMPLES.rst This command retrieves the first receiving address for the first account on a Trezor device for Litecoin, using the SegWit-in-P2SH script type. This address format is compatible with older wallets that may not support native SegWit. ```Shell $ trezorctl ltc get-address --script-type p2shsegwit --address m/49h/2h/0h/0/0 ``` -------------------------------- ### Run Trezor Library from Source with Poetry Source: https://github.com/trezor/trezor-firmware/blob/main/python/README.md Provides instructions to set up a development environment for `trezorlib` using Poetry, allowing changes to be immediately effective. Requires Poetry to be installed. ```sh pip3 install poetry git clone https://github.com/trezor/trezor-firmware cd trezor-firmware poetry install poetry shell ``` -------------------------------- ### Install Core Dependencies for Debian/Ubuntu Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/build/emulator.md Install essential build dependencies for the Trezor emulator on Debian or Ubuntu systems, including SCons, SDL2 libraries, LLVM, and Clang. ```sh sudo apt-get install scons libsdl2-dev libsdl2-image-dev llvm-dev libclang-dev clang ``` -------------------------------- ### Install Coverage.py Tool Source: https://github.com/trezor/trezor-firmware/blob/main/docs/tests/device-tests.md Install the `coverage.py` tool, which is required to generate HTML or console summary output for code coverage reports. ```sh pip3 install coverage ``` -------------------------------- ### Install Core Dependencies for Fedora Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/build/emulator.md Install essential build dependencies for the Trezor emulator on Fedora systems, including SCons, SDL2 libraries, and Clang development files. ```sh sudo yum install scons SDL2-devel SDL2_image-devel clang-devel ``` -------------------------------- ### Retrieving Trezor Device Features and Settings Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/EXAMPLES.rst This command queries the connected Trezor device to retrieve its supported features, current settings, and available coin types. It provides a comprehensive overview of the device's capabilities and configuration. ```bash $ trezorctl get-features ``` -------------------------------- ### Get Litecoin Native SegWit (Bech32) Address with trezorctl Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/EXAMPLES.rst This command retrieves the first receiving address for the first account on a Trezor device for Litecoin, using the native SegWit (Bech32 P2WPKH) script type. This format offers better efficiency and lower transaction fees. It requires Trezor Firmware v1.6.0 or later. ```Shell $ trezorctl ltc get-address --script-type segwit --address m/84h/2h/0h/0/0 ``` -------------------------------- ### Install Trezor Library with Stellar Support Source: https://github.com/trezor/trezor-firmware/blob/main/python/README.md Installs `trezorlib` with additional packages required for supporting Stellar signing from the command line. ```sh pip3 install trezor[stellar] ``` -------------------------------- ### Install TOIF Tool via pip Source: https://github.com/trezor/trezor-firmware/blob/main/python/tools/toiftool/README.md Instructions to install the `toiftool` separately from the firmware repository using pip in editable mode. This makes the `toiftool` command available in your shell. ```bash pip install -e . ``` -------------------------------- ### Install Core Dependencies for Arch Linux Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/build/emulator.md Install essential build dependencies for the Trezor emulator on Arch Linux, including SCons, SDL2 libraries, and Clang development files. ```sh sudo pacman -S scons sdl2 sdl2_image clang-devel ``` -------------------------------- ### Install Poetry and Initialize Environment Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/build/index.md This sequence of commands installs Poetry, a Python dependency manager, globally using pip3, then installs project-specific dependencies, and finally activates a Poetry shell environment. This prepares the system for running Poetry-managed commands without explicit `poetry run` prefixes. ```sh sudo pip3 install poetry poetry install poetry shell ``` -------------------------------- ### Install Poetry Environment for Trezor Firmware Source: https://github.com/trezor/trezor-firmware/blob/main/docs/tests/click-tests.md Installs the necessary Python dependencies using Poetry for the Trezor firmware monorepo. ```sh poetry install ``` -------------------------------- ### Install Trezorlib with Stellar Support Source: https://github.com/trezor/trezor-firmware/blob/main/docs/python/trezorlib.md Installs `trezorlib` along with additional packages necessary for enabling Stellar signing functionality via the command line. This option expands the library's capabilities to include Stellar-specific operations. ```sh pip3 install trezor[stellar] ``` -------------------------------- ### Trezorctl Device Subcommand API Reference Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Provides a comprehensive reference for the `trezorctl device` subcommand, detailing its usage, general options, and specific commands for device management such as setup, recovery, backup, and wiping. ```APIDOC Usage: trezorctl device [OPTIONS] COMMAND [ARGS]... Device management commands - setup, recover seed, wipe, etc. Options: --help Show this message and exit. Commands: authenticate Verify the authenticity of the device. backup Perform device seed backup. load Upload seed and custom configuration to the device. reboot-to-bootloader Reboot device into bootloader mode. recover Start safe recovery workflow. sd-protect Secure the device with SD card protection. set-busy Show a "Do not disconnect" dialog. setup Perform device setup and generate new seed. tutorial Show on-device tutorial. unlock-bootloader Unlocks bootloader. wipe Reset device to factory defaults and remove all private data. ``` -------------------------------- ### Install nRF Connect SDK Toolchain Source: https://github.com/trezor/trezor-firmware/blob/main/nordic/trezor/README.md Installs the specified version of the nRF Connect SDK toolchain using `nrfutil`. This command sets up the necessary development environment for building the Trezor BLE Gateway application. ```sh nrfutil toolchain-manager install --ncs-version v2.9.0 ``` -------------------------------- ### Trezorctl Solana Subcommands Reference Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Provides an overview of `trezorctl` commands specific to Solana, including how to get addresses, public keys, and sign transactions. ```CLI trezorctl solana --help ``` ```CLI Usage: trezorctl solana [OPTIONS] COMMAND [ARGS]... Solana commands. Options: --help Show this message and exit. Commands: get-address Get Solana address. get-public-key Get Solana public key. sign-tx Sign Solana transaction. ``` -------------------------------- ### Install Poetry Environment for Trezor Firmware Tests Source: https://github.com/trezor/trezor-firmware/blob/main/tests/device_tests/README.md Installs the necessary Python dependencies and sets up the Poetry environment for the Trezor firmware project. This is a prerequisite for running all automated and manual tests. ```sh poetry install ``` -------------------------------- ### Clone and Set Up Trezor Firmware Project Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/build/index.md This command sequence clones the Trezor firmware repository, navigates into it, installs Python dependencies using Poetry, and then changes directory into the 'core' submodule, preparing the environment for further build steps. ```sh git clone --recurse-submodules https://github.com/trezor/trezor-firmware.git cd trezor-firmware poetry install cd core ``` -------------------------------- ### Install Core Dependencies for Mac OS X Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/build/emulator.md Install essential build dependencies for the Trezor emulator on Mac OS X using Homebrew, including SCons, SDL2 libraries, pkg-config, and LLVM. ```sh brew install scons sdl2 sdl2_image pkg-config llvm ``` -------------------------------- ### Trezorctl Tezos Subcommands Reference Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Provides an overview of `trezorctl` commands specific to Tezos, including how to get addresses, public keys, and sign transactions. ```CLI trezorctl tezos --help ``` ```CLI Usage: trezorctl tezos [OPTIONS] COMMAND [ARGS]... Tezos commands. Options: --help Show this message and exit. Commands: get-address Get Tezos address for specified path. get-public-key Get Tezos public key. sign-tx Sign Tezos transaction. ``` -------------------------------- ### Install Latest Trezorlib from GitHub Source: https://github.com/trezor/trezor-firmware/blob/main/docs/python/trezorlib.md Installs the latest development version of `trezorlib` directly from the `trezor-firmware` GitHub repository. This is useful for accessing the most recent features or for development purposes, bypassing official package releases. ```sh pip3 install "git+https://github.com/trezor/trezor-firmware#egg=trezor&subdirectory=python" ``` -------------------------------- ### Install Git Hooks Source: https://github.com/trezor/trezor-firmware/blob/main/docs/misc/git-hooks.md Copies the Git hook scripts from the `docs/git/hooks/` directory to the `.git/hooks/` directory to activate them for the current repository. This command should be executed from the project's root directory. ```shell cp docs/git/hooks/* .git/hooks/ ``` -------------------------------- ### Run Trezor Firmware Emulator and Bridge Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/emulator/index.md This snippet outlines the steps to start the Trezor firmware emulator within a Poetry environment. It also includes the command to initialize the Trezor Bridge, enabling communication between the emulator and applications like Trezor Suite or trezorctl. ```sh poetry shell ./emu.py ``` ```sh poetry run ./emu.py ``` ```sh trezord-go -e 21324 ``` -------------------------------- ### Trezor Protocol: Protobuf Request Message Example Source: https://github.com/trezor/trezor-firmware/blob/main/common/protob/protocol.md An example of a protobuf message comment for a request to sign a transaction, demonstrating the 'Request' message type and flow tags like '@start', '@next TxRequest', and '@next Failure' to define the message's position and potential follow-ups in a flow. ```protobuf /** * Request: Ask device to sign transaction * @start * @next TxRequest * @next Failure */ ``` -------------------------------- ### Install Trezorlib Python Package Source: https://github.com/trezor/trezor-firmware/blob/main/docs/python/trezorlib.md Installs the basic `trezorlib` package using pip, which provides the core Python library and `trezorctl` command-line client for interacting with Trezor Hardware Wallets. Requires Python 3.8+ and libusb 1.0. ```sh pip3 install trezor ``` -------------------------------- ### Prodtest CLI haptic-test Command Example (APIDOC) Source: https://github.com/trezor/trezor-firmware/blob/main/core/embed/projects/prodtest/README.md This example demonstrates a simple command execution in the Trezor prodtest CLI. The `haptic-test` command is invoked with a single parameter, `500`, likely indicating a duration or intensity for a haptic feedback test. ```APIDOC haptic-test 500 ``` -------------------------------- ### Displaying General Help for trezorctl Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows the full list of available subcommands for the `trezorctl` utility. ```Shell trezorctl --help ``` -------------------------------- ### Run Trezor Firmware Emulator Source: https://github.com/trezor/trezor-firmware/blob/main/docs/tests/click-tests.md Starts the Trezor firmware emulator in a separate terminal, allowing tests to interact with a simulated device. ```sh ./core/emu.py ``` -------------------------------- ### Run Full UI Test Suite with Poetry Source: https://github.com/trezor/trezor-firmware/blob/main/docs/tests/ui-tests.md Executes the complete UI test suite for the `core` module using `make` within the Poetry environment. This command runs tests against the emulator. ```sh poetry run make -C core test_emu_ui ``` -------------------------------- ### Run Firmware Tests with Coverage Report Source: https://github.com/trezor/trezor-firmware/blob/main/tests/device_tests/README.md Builds the Unix version of the firmware and then runs the test suite, generating a code coverage report. This command assumes `coverage.py` is already installed. ```Shell make build_unix && make coverage ``` -------------------------------- ### Displaying Help for trezorctl benchmark Subcommand Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows specific help and available options for the `trezorctl benchmark` subcommand. ```Shell trezorctl benchmark --help ``` -------------------------------- ### Handle Resuming an Evicted or Unknown Trezor Session Source: https://github.com/trezor/trezor-firmware/blob/main/docs/common/communication/sessions.md This example demonstrates the behavior when attempting to resume a session that is no longer active or known to the Trezor device (e.g., after `EndSession` or eviction). Instead of resuming the specified ID, Trezor transparently allocates and returns a *new* session ID (BBBB in this case), effectively starting a fresh session. ```APIDOC Initialize() ---------> Features(..., session_id=AAAA) <--------- ------ EndSession() ---------> Success() <--------- ------ Initialize(session_id=AAAA) ---------> Features(..., session_id=BBBB) <--------- ------ ``` -------------------------------- ### Start Trezor Firmware Emulator Source: https://github.com/trezor/trezor-firmware/blob/main/tests/device_tests/README.md Launches the Trezor firmware emulator, which is required to run device tests against a simulated hardware environment. It should be run in a separate terminal. ```sh ./core/emu.py ``` -------------------------------- ### Prodtest CLI help Command (APIDOC) Source: https://github.com/trezor/trezor-firmware/blob/main/core/embed/projects/prodtest/README.md The `help` command in the Trezor prodtest CLI displays a list of all available commands. It optionally accepts a prefix parameter to filter the displayed commands, showing only those that start with the specified characters. ```APIDOC help otp # Available commands (filtered): # otp-batch-write - Write the device batch info into OTP memory # otp-batch-read - Read the device batch info from OTP memory # otp-variant-write - Write the device variant info into OTP memory # otp-variant-read - Read the device variant info from OTP memory OK ``` -------------------------------- ### Install Trezor Python Library Source: https://github.com/trezor/trezor-firmware/blob/main/python/README.md Installs the core `trezorlib` Python library using pip. This is the basic installation required for communicating with Trezor Hardware Wallet. ```sh pip3 install trezor ``` -------------------------------- ### Display Trezorctl Monero Subcommand Help Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows the help message for the `trezorctl monero` subcommand, listing its options and available commands for interacting with Monero. ```Shell trezorctl monero --help ``` -------------------------------- ### Trezorctl Stellar Subcommands Reference Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Provides an overview of `trezorctl` commands specific to Stellar, including how to get public addresses and sign transactions. ```CLI trezorctl stellar --help ``` ```CLI Usage: trezorctl stellar [OPTIONS] COMMAND [ARGS]... Stellar commands. Options: --help Show this message and exit. Commands: get-address Get Stellar public address. sign-transaction Sign a base64-encoded transaction envelope. ``` -------------------------------- ### Trezorctl Monero Subcommand API Reference Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Provides a reference for the `trezorctl monero` subcommand, detailing its usage, general options, and specific commands for Monero operations like getting addresses and watch keys. ```APIDOC Usage: trezorctl monero [OPTIONS] COMMAND [ARGS]... Monero commands. Options: --help Show this message and exit. Commands: get-address Get Monero address for specified path. get-watch-key Get Monero watch key for specified path. ``` -------------------------------- ### Enter Poetry Shell for Manual UI Testing Source: https://github.com/trezor/trezor-firmware/blob/main/docs/tests/ui-tests.md Activates the Poetry virtual environment, allowing direct execution of commands and scripts within the project's dependency context for manual testing. ```sh poetry shell ``` -------------------------------- ### Display Trezorctl Ethereum Subcommand Help Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows the help message for the `trezorctl ethereum` subcommand, listing its options and available commands for interacting with Ethereum. ```Shell trezorctl ethereum --help ``` -------------------------------- ### Structured Description of Cardano Transaction Body (CBOR) Source: https://github.com/trezor/trezor-firmware/blob/main/core/src/apps/cardano/README.md This snippet provides a human-readable, commented breakdown of the CBOR-encoded Cardano transaction body. It clarifies the structure and meaning of each field, including inputs, outputs (with multi-asset and ADA-only examples), fees, time-to-live (TTL), certificates, withdrawals, auxiliary data hash, validity interval start, and minting details. ```CBOR Structure # transaction body # map(6) { # inputs [id, index] # uint(0), array(1), array(2), bytes(32), uint(0) 0: [[h'3B4...', 0]], # outputs [address, [ada_amount, { policy_id => { asset_name => asset_amount }}], datum_hash?] # uint(1), array(3) 1: [ # multi asset output # array(2), bytes(57), uint(1234), map(1), bytes(28), map(1), bytes(8), uint(4321) [ h'01E...', [ 1234, { h'95A...': { h'74652474436f696e': 4321 } } ] ], # output containing only ADA [address, ada_amount] # array(2), bytes(57), uint(4444) [h'018...', 4444], # output with datum_hash [address, ada_amount, datum_hash] # array(3), bytes(29), uint(3142), bytes(32) [h'714...', 3142, h'3b4...'], ] # fee # uint(2), uint(42) 2: 42, # ttl # uint(3), uint(10) 3: 10, # certificates [[type, [keyhash/scripthash, keyhash]]] # uint(4), array(1), array(2), uint(0), array(2), uint(0), bytes(28) 4: [[0,[0, h'122...']]], # withdrawal [reward_address: amount] # uint(5), map(1), bytes(29), uint(7204944340) 5: {h'E11...': 1000}, # auxiliary data hash 7: h'541...', # validity_interval_start # uint(8), uint(20) 8: 20, # mint # map(2), bytes(8), "te$tCoin", uint(7878754), bytes(8), "ue$tCoin", int(7878753) 9: { h'95A2...': { h'7465...': 7878754, h'7565...': -7878754 } } } ``` -------------------------------- ### Initialize Development Environment with nix-shell Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/build/embedded.md This command initializes the development environment using nix-shell, which automatically installs all required dependencies in an isolated environment based on the `shell.nix` configuration file. ```sh nix-shell ``` -------------------------------- ### Get Current Firmware Size Information (get.sh) Source: https://github.com/trezor/trezor-firmware/blob/main/core/tools/size/README.md Gets the size information about the current firmware. ```APIDOC get.sh Description: Retrieves size information for the currently built firmware. ``` -------------------------------- ### Set up Nix Shell for Valgrind and KCachegrind Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/emulator/valgrind.md If you are using Nix, this command enters a development shell that includes Valgrind and KCachegrind packages, and then activates the Poetry environment. ```Shell nix-shell --arg devTools true --run "poetry shell" ``` -------------------------------- ### Start Trezor firmware emulator for manual testing Source: https://github.com/trezor/trezor-firmware/blob/main/docs/tests/device-tests.md Launches the Trezor firmware emulator in a separate terminal. The emulator provides a simulated hardware environment necessary for running device tests. ```sh ./core/emu.py ``` -------------------------------- ### Generating Bitcoin SegWit-in-P2SH Receiving Address (BIP49) Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/EXAMPLES.rst This command retrieves the first receiving address for the first account in Bitcoin SegWit-in-P2SH format. It uses the BIP49 derivation path (`m/49h/0h/0h/0/0`), providing SegWit benefits while maintaining compatibility with older wallet software. ```bash $ trezorctl btc get-address --script-type p2shsegwit --address m/49h/0h/0h/0/0 ``` -------------------------------- ### Get Size Difference by Commit (commit.sh) Source: https://github.com/trezor/trezor-firmware/blob/main/core/tools/size/README.md Gets the size difference introduced by a specified commit. ```APIDOC commit.sh Description: Calculates the size difference introduced by a specific commit. Parameters: : The ID of the commit to analyze. ``` -------------------------------- ### Generating Bitcoin Legacy Receiving Address (BIP44) Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/EXAMPLES.rst This command retrieves the first receiving address for the first account in Bitcoin Legacy (non-SegWit) format. It uses the BIP44 derivation path (`m/44h/0h/0h/0/0`) for standard P2PKH addresses, suitable for older wallets. ```bash $ trezorctl btc get-address --script-type address --address m/44h/0h/0h/0/0 ``` -------------------------------- ### Trezorctl NEM Subcommand API Reference Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Provides a reference for the `trezorctl nem` subcommand, detailing its usage, general options, and specific commands for NEM operations like getting addresses and signing transactions. ```APIDOC Usage: trezorctl nem [OPTIONS] COMMAND [ARGS]... NEM commands. Options: --help Show this message and exit. Commands: get-address Get NEM address for specified path. sign-tx Sign (and optionally broadcast) NEM transaction. ``` -------------------------------- ### Displaying Help for trezorctl btc Subcommand Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows specific help and available options for the `trezorctl btc` subcommand, which handles Bitcoin and Bitcoin-like coin operations. ```Shell trezorctl btc --help ``` -------------------------------- ### Record UI Test Fixtures (Short Version) Source: https://github.com/trezor/trezor-firmware/blob/main/docs/tests/ui-tests.md Updates the UI test fixtures by running the `test_emu_ui_record` make target. This command generates new screenshots and calculates their hashes, which are then committed to Git. ```sh poetry run make -C core test_emu_ui_record ``` -------------------------------- ### System Program: Create Account Instruction Source: https://github.com/trezor/trezor-firmware/blob/main/common/defs/solana/programs.md Defines the parameters for creating a new account within the Solana System Program, including the new account's address, initial lamports, funding source, allocated space, and owner. ```APIDOC Program: System Program Instruction: Create Account (0) Parameters: new_account: Type: account Description: Create account lamports: Type: lamports Description: Deposit funding_account: Type: account Description: From space: Type: u64 Description: (not shown) owner: Type: pubkey Description: (not shown) ``` -------------------------------- ### Build and Spawn Trezor Emulator Source: https://github.com/trezor/trezor-firmware/blob/main/docs/developers/hello_world_feature_TT.md These shell commands are used to build the Trezor emulator image and then run it. This step is crucial for testing the newly implemented 'Hello World' feature on a simulated Trezor device. ```sh cd core make build_unix ./emu.py ``` -------------------------------- ### Display Trezorctl NEM Subcommand Help Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows the help message for the `trezorctl nem` subcommand, listing its options and available commands for interacting with NEM. ```Shell trezorctl nem --help ``` -------------------------------- ### Display Trezorctl FIDO Subcommand Help Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows the help message for the `trezorctl fido` subcommand, listing its options and available commands for FIDO2, U2F, and WebAuthN management. ```Shell trezorctl fido --help ``` -------------------------------- ### Trezorctl EOS Subcommand API Reference Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Provides a reference for the `trezorctl eos` subcommand, detailing its usage, general options, and specific commands for EOS operations like getting public keys and signing transactions. ```APIDOC Usage: trezorctl eos [OPTIONS] COMMAND [ARGS]... EOS commands. Options: --help Show this message and exit. Commands: get-public-key Get Eos public key in base58 encoding. sign-transaction Sign EOS transaction. ``` -------------------------------- ### Install Trezor Library with Extended Device Authentication Source: https://github.com/trezor/trezor-firmware/blob/main/python/README.md Installs `trezorlib` with additional packages for user-friendly device authentication, specifically for Trezor Safe 3 and newer models. ```sh pip3 install trezor[authentication] ``` -------------------------------- ### System Program: Initialize Nonce Account Instruction Source: https://github.com/trezor/trezor-firmware/blob/main/common/defs/solana/programs.md Outlines the parameters for initializing a new nonce account with a specified authority, requiring access to recent blockhashes and rent sysvars. ```APIDOC Program: System Program Instruction: Initialize Nonce Account (6) Parameters: nonce_account: Type: account Description: Initialize nonce account nonce_authority: Type: pubkey Description: New authority recent_blockhashes_sysvar: Type: account Description: (not shown) rent_sysvar: Type: account Description: (not shown) ``` -------------------------------- ### trezorctl Main Command-Line Interface Reference Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Detailed reference for the `trezorctl` command, including global options and a list of all top-level subcommands. Options control device selection, verbosity, output format, and session management. Subcommands categorize functionality by currency or feature. ```APIDOC Usage: trezorctl [OPTIONS] COMMAND [ARGS]... Options: -p, --path TEXT Select device by specific path. -v, --verbose Show communication messages. -j, --json Print result as JSON object -P, --passphrase-on-host Enter passphrase on host. -S, --script Use UI for usage in scripts. -s, --session-id HEX Resume given session ID. -r, --record TEXT Record screen changes into a specified directory. --version Show the version and exit. --help Show this message and exit. Commands: benchmark Benchmark commands. btc Bitcoin and Bitcoin-like coins commands. cardano Cardano commands. clear-session Clear session (remove cached PIN, passphrase, etc.). crypto Miscellaneous cryptography features. debug Miscellaneous debug features. device Device management commands - setup, recover seed, wipe, etc. eos EOS commands. ethereum Ethereum commands. fido FIDO2, U2F and WebAuthN management commands. firmware Firmware commands. get-features Retrieve device features and settings. get-session Get a session ID for subsequent commands. list List connected Trezor devices. monero Monero commands. nem NEM commands. ping Send ping message. ripple Ripple commands. set Device settings. solana Solana commands. stellar Stellar commands. tezos Tezos commands. usb-reset Perform USB reset on stuck devices. version Show version of trezorctl/trezorlib. wait-for-emulator Wait until Trezor Emulator comes up. ``` -------------------------------- ### Trezorctl Ethereum Subcommand API Reference Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Provides a reference for the `trezorctl ethereum` subcommand, detailing its usage, options for network and token definitions, and specific commands for Ethereum operations like getting addresses, signing messages, and transactions. ```APIDOC Usage: trezorctl ethereum [OPTIONS] COMMAND [ARGS]... Ethereum commands. Most Ethereum commands now require the host to specify definition of a network and possibly an ERC-20 token. These definitions can be automatically fetched using the `-a` option. You can also specify a custom definition source using the `-d` option. Allowable values are: - HTTP or HTTPS URL - path to local directory - path to local tar archive For debugging purposes, it is possible to force use a specific network and token definition by using the `--network` and `--token` options. These options accept either a path to a file with a binary blob, or a hex-encoded string. Options: -d, --definitions TEXT Source for Ethereum definition blobs. -a, --auto-definitions Automatically download required definitions from trezor.io --network TEXT Network definition blob. --token TEXT Token definition blob. --help Show this message and exit. Commands: get-address Get Ethereum address in hex encoding. get-public-node Get Ethereum public node of given path. sign-message Sign message with Ethereum address. sign-tx Sign (and optionally publish) Ethereum transaction. sign-typed-data Sign typed data (EIP-712) with Ethereum address. sign-typed-data-hash Sign hash of typed data (EIP-712) with Ethereum address. verify-message Verify message signed with Ethereum address. ``` -------------------------------- ### Install Trezor Library with HIDAPI Support Source: https://github.com/trezor/trezor-firmware/blob/main/python/README.md Installs `trezorlib` with HIDAPI support, necessary for brand new Trezor One devices manufactured before 2021 with older bootloaders, especially on Linux. ```sh pip3 install trezor[hidapi] ``` -------------------------------- ### Displaying Help for trezorctl crypto Subcommand Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows specific help and available options for the `trezorctl crypto` subcommand, which provides miscellaneous cryptography features. ```Shell trezorctl crypto --help ``` -------------------------------- ### Displaying Help for trezorctl cardano Subcommand Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows specific help and available options for the `trezorctl cardano` subcommand, which handles Cardano-related operations. ```Shell trezorctl cardano --help ``` -------------------------------- ### Implement CLI Command for Hello World in Trezorlib Source: https://github.com/trezor/trezor-firmware/blob/main/docs/developers/hello_world_feature_TT.md This Python code uses the `click` library to create a command-line interface for the 'Hello World' feature. It defines a `helloworld` group and a `say-hello` command, which accepts `name` as an argument and `amount` and `show-display` as options. The command internally calls the `hello_world.say_hello` function, passing the user-provided arguments. ```python from typing import TYPE_CHECKING, Optional import click from .. import hello_world from . import with_client if TYPE_CHECKING: from ..client import TrezorClient @click.group(name="helloworld") def cli() -> None: """Hello world commands.""" @cli.command() @click.argument("name") @click.option("-a", "--amount", type=int, help="How many times to greet.") @click.option( "-d", "--show-display", is_flag=True, help="Whether to show confirmation screen." ) @with_client def say_hello( client: "TrezorClient", name: str, amount: Optional[int], show_display: bool ) -> str: """Simply say hello to the supplied name.""" return hello_world.say_hello(client, name, amount, show_display=show_display) ``` -------------------------------- ### Download Emulators for Trezor Firmware Upgrade Tests Source: https://github.com/trezor/trezor-firmware/blob/main/tests/upgrade_tests/README.md This script downloads and sets up the necessary emulators required for executing the Trezor firmware upgrade tests. It's a one-time setup step that must be completed before running any upgrade test suites. ```sh tests/download_emulators.sh ``` -------------------------------- ### Display Trezorctl Set Subcommand Help Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows the help message for the `trezorctl set` subcommand, listing its options for device settings. ```Shell trezorctl set --help ``` -------------------------------- ### Record BTC Get Address Interaction with Click Test Recorder Source: https://github.com/trezor/trezor-firmware/blob/main/docs/tests/click-tests.md Uses the click test recorder tool to record a user interaction for getting a Bitcoin address, specifying a derivation path and debug mode. ```sh python tests/click_tests/record_layout.py btc get-address -n m/44h/0h/0h/0/0 -d ``` -------------------------------- ### Display Trezorctl Firmware Subcommand Help Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows the help message for the `trezorctl firmware` subcommand, listing its options and available commands for managing device firmware. ```Shell trezorctl firmware --help ``` -------------------------------- ### Install Poetry environment for Trezor firmware tests Source: https://github.com/trezor/trezor-firmware/blob/main/docs/tests/device-tests.md Installs the necessary Python dependencies using Poetry for the Trezor firmware project. This step is required before running any tests and should be executed from the monorepo root. ```sh poetry install ``` -------------------------------- ### Run Trezorlib from Source with Poetry Source: https://github.com/trezor/trezor-firmware/blob/main/docs/python/trezorlib.md Sets up a development environment to run `trezorlib` directly from its source code using Poetry. This allows developers to make changes and see their effects immediately, facilitating active development and testing. ```sh pip3 install poetry git clone https://github.com/trezor/trezor-firmware cd trezor-firmware poetry install poetry shell ``` -------------------------------- ### Trezor Protocol: Protobuf Embedded Message Example Source: https://github.com/trezor/trezor-firmware/blob/main/common/protob/protocol.md An example of a protobuf message comment for an embedded BIP32 (hierarchical deterministic) node structure, illustrating the '@embed' flow tag to indicate that the message is integrated within other messages. ```protobuf /** * Structure representing BIP32 (hierarchical deterministic) node * Used for imports of private key into the device and exporting public key out of device * @embed */ ``` -------------------------------- ### Display Trezorctl EOS Subcommand Help Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows the help message for the `trezorctl eos` subcommand, listing its options and available commands for interacting with EOS. ```Shell trezorctl eos --help ``` -------------------------------- ### Display Trezorctl Device Subcommand Help Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows the help message for the `trezorctl device` subcommand, listing its options and available commands for managing Trezor devices. ```Shell trezorctl device --help ``` -------------------------------- ### Byron Address Examples Source: https://github.com/trezor/trezor-firmware/blob/main/core/src/apps/cardano/README.md Examples of legacy Byron addresses for Mainnet and Testnet, which are Base58 encoded and lack staking rights. These addresses were primarily used during the Byron era but remain supported in Shelley. ```Text Mainnet: Ae2tdPwUPEZCanmBz5g2GEwFqKTKpNJcGYPKfDxoNeKZ8bRHr8366kseiK2 Testnet: 2657WMsDfac7BteXkJq5Jzdog4h47fPbkwUM49isuWbYAr2cFRHa3rURP236h9PBe ``` -------------------------------- ### Initialize Trezor Emulator with Mnemonic or Shamir Shares Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/emulator/index.md This snippet shows how to pre-configure the Trezor emulator with a specific mnemonic phrase or multiple Shamir shares for testing purposes. It also provides a convenient shortcut to use the 'all all all' seed defined in SLIP-14. ```sh ./emu.py --mnemonic "such deposit very security much theme..." ``` ```sh ./emu.py --mnemonic "your first share" --mnemonic "your second share" ... ``` ```sh ./emu.py --slip0014 ``` ```sh ./emu.py -s ``` -------------------------------- ### Displaying Help for trezorctl debug Subcommand Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Shows specific help and available options for the `trezorctl debug` subcommand, which provides miscellaneous debug features. ```Shell trezorctl debug --help ``` -------------------------------- ### Install Python Dependencies and Activate Poetry Shell Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/build/embedded.md These commands install Python dependencies using Poetry and then activate the Poetry shell, managing all Python packages in an isolated environment. This is recommended after initializing nix-shell. ```sh poetry install poetry shell ``` -------------------------------- ### Run Trezor Firmware Emulator Source: https://github.com/trezor/trezor-firmware/blob/main/docs/core/build/emulator.md Execute the compiled Trezor firmware emulator. This command launches the emulator, allowing interaction with the simulated Trezor device. ```sh ./emu.py ``` -------------------------------- ### Shelley Base Address Examples Source: https://github.com/trezor/trezor-firmware/blob/main/core/src/apps/cardano/README.md Examples of Shelley Base addresses for Mainnet and Testnet, which include both payment and staking credentials and are Bech32 encoded. These addresses support staking rights upon registration of the staking credential. ```Text Mainnet: addr1q8v42wjda8r6mpfj40d36znlgfdcqp7jtj03ah8skh6u8wnrqua2vw243tmjfjt0h5wsru6appuz8c0pfd75ur7myyeqsx9990 Testnet: addr_test1qrv42wjda8r6mpfj40d36znlgfdcqp7jtj03ah8skh6u8wnrqua2vw243tmjfjt0h5wsru6appuz8c0pfd75ur7myyeqnsc9fs ``` -------------------------------- ### support.py Command Line Tool Overview Source: https://github.com/trezor/trezor-firmware/blob/main/common/tools/README.md Describes the `support.py` utility for querying and managing information in `support.json`, primarily supporting the release flow. It lists commands such as `check`, `fix`, `show`, `set`, and `release`. ```APIDOC support.py: check: Description: Check validity of JSON data. Used in CI. fix: Description: Prune keys without associated coins. show: Description: Keyword-search for a coin and show its support status for each device. set: Description: Set support data. release: Description: Perform the release workflow. ``` -------------------------------- ### Install Trezorlib with HIDAPI Support Source: https://github.com/trezor/trezor-firmware/blob/main/docs/python/trezorlib.md Installs `trezorlib` with HIDAPI support, which is necessary for recognizing older Trezor One devices manufactured before 2021 (with bootloader older than 1.6.0). On Linux, this requires `python3-dev`, `cython3`, `libusb-1.0-0-dev`, and `libudev-dev` as prerequisites. ```sh pip3 install trezor[hidapi] ``` -------------------------------- ### trezorctl benchmark Subcommand Reference Source: https://github.com/trezor/trezor-firmware/blob/main/python/docs/OPTIONS.rst Reference for the `trezorctl benchmark` subcommand, detailing its purpose and available subcommands for running or listing benchmarks. ```APIDOC Usage: trezorctl benchmark [OPTIONS] COMMAND [ARGS]... Benchmark commands. Options: --help Show this message and exit. Commands: list-names List names of all supported benchmarks run Run benchmark ``` -------------------------------- ### Setting Coin Support Status with support.py Source: https://github.com/trezor/trezor-firmware/blob/main/common/tools/README.md Demonstrates how to use the `support.py` command-line tool to view and update the support status of a coin. It shows querying the current status for 'Ontology' and then setting specific support versions and reasons for different devices (T1B1 and T2T1). ```Shell $ ./support.py show Ontology misc:ONT - Ontology (ONT) * connect : NO * T1B1 : support info missing * T2T1 : support info missing * suite : NO $ ./support.py set misc:ONT T1B1=no -r "not planned on T1" T2T1=2.4.7 misc:ONT - Ontology (ONT) * connect : NO * T1B1 : NO (reason: not planned on T1) * T2T1 : 2.4.7 * suite : NO ``` -------------------------------- ### Shelley Pointer Address Examples Source: https://github.com/trezor/trezor-firmware/blob/main/core/src/apps/cardano/README.md Examples of Shelley Pointer addresses for Mainnet and Testnet, which use a certificate pointer instead of a full staking credential. This makes them shorter than Base addresses while serving a similar staking purpose. ```Text Mainnet: addr1gxq0nckg3ekgzuqg7w5p9mvgnd9ym28qh5grlph8xd2z92spqgpsl97q83 Testnet: addr_test1gzq0nckg3ekgzuqg7w5p9mvgnd9ym28qh5grlph8xd2z925ph3wczvf2ag2x9t ```