运行Trezor 钱包suite项目+firmware(包含onekey)项目

一些流程


前言

记录一些硬件钱包的文档信息之类

本部分核心为nix的安装,在windows(wsl)安装ubuntu,和nix


一、trezor钱包

doc文档:https://docs.trezor.io/

一、firmware的安装步骤

linux - 在Windows 10上安装WSL2 - 个人文章 - SegmentFault 思否

二、suite官方操作 步骤

GitHub - trezor/trezor-suite: Trezor Suite Monorepo

Before you start make sure you have downloaded and installed NVMYarn and git with git lfs.

  • git clone [email protected]:trezor/trezor-suite.git
  • git submodule update --init --recursive
  • git lfs pull
  • nvm install
  • yarn
  • yarn build:libs && yarn workspace @trezor/message-system sign-config

It's recommended to enable git config --global submodule.recurse true so you don't need to run git submodule update --init --recursive every time when submodules are updated.

To set up your dev environment for a native platform (iOS/Android) follow these additional steps.

Run a dev build:

  • yarn suite:dev (web app)
  • yarn suite:dev:desktop (electron app)

1.git

代码如下(示例):

git clone 。。。

然後出現报错:

Git报错解决:OpenSSL SSL_read: Connection was reset, errno 10054_你脸上有BUG的博客-CSDN博客

git config --global http.sslVerify "false"

解决fatal: unable to access xxx: Failed to connect to github.com port 443: Timed out_DeadPool loves Star的博客-CSDN博客

在控制面板的》网络和共享中心》internet选项》 连接》局域网设置

git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080

1.5 以下才是核心,尝试运行onekey的firmware

需要在ubuntu的终端中进行nix操作

 开始在 WSL 上使用 Git | Microsoft Learn

 1. 完成了windows(wsl)的安装,在ubuntu的终端中,进行nix的安装

在安装nix后提示您需要运行一些指令来设置环境变量。

(学会合理使用 chatgpt来解决问题,实现环境的安装,不要全部依赖,结合网上搜索和chatgpt)

这个提示是在安装nix后提示您需要运行一些指令来设置环境变量。操作步骤如下:

1. 打开终端
2. 输入指令:`. /home/whrime/.nix-profile/etc/profile.d/nix.sh` (注意前面有一个点和空格)
3. 回车运行该指令
4. 完成操作后,您应该可以使用nix命令了。

请注意,此指令只在打开的当前终端中为您设置环境变量。如果您需要在以后的会话中仍然拥有nix环境变量,请在每个新终端会话中重复此操作。

curl -L https://nixos.org/nix/install | sh -s -- --daemon

. /home/whrime/.nix-profile/etc/profile.d/nix.sh

 在ubuntu的shell中,进行nix --version;(完成nix的安装)

接着按照官网步骤进行(部分对官网进行了修改)

Pulling the latest code via the git command line tool, setting up the development environment

步骤一中的 --recurse-submodules

git clone --recurse-submodules https://github.com/OneKeyHQ/firmware.git
cd firmware
git submodule sync --recursive
git submodule update --init --recursive
// 在实际下载过程中,有时候下载不下来是玄学,换个时间可能可以
如果实在下不下来,可以尝试进入主目录,然后单独下载fail的子模块
git submodule update --init --recursive vendor/lvgl_mp

nix-shell
poetry install

之后的操作就是

  • Run the build with:
   cd core && poetry run make build_unix
  • Now you can start the emulator
   poetry run ./emu.py
  • You can now install the command line client utility to interact with the emulator
   cd python && poetry run python3 -m pip install .

主要问题:

代码的拉取问题,缺乏文件

进入主项目后 cd firmware

git submodule update --init --recursive vendor/lvgl_mp

git submodule update --init --recursive vendor/fido2-tests

接着,以下方法都是检验是否拉取代码完成

git submodule update --recursive --remote

 git submodule update --init

对于问题

 Failed to connect to github.com port 443 after 21093 ms: Timed out
使用

git config --global https.proxy http://127.0.0.1:1080
git config --global http.proxy http://127.0.0.1:1080
 

git中问题:

error: RPC failed; curl 28 OpenSSL SSL_read: Connection was reset, errno 10054
fatal: expected flush after ref listing
使用

git config --global http.sslVerify "false"

 OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
使用

 git config --global --unset http.proxy

2.接着

  • cd trezor-suite
  • git submodule sync --recursive(需要这个!)
  • git submodule update --init --recursive

 

git lfs pull
  • nvm install
  • yarn
  • yarn build:libs && yarn workspace @trezor/message-system sign-config

三、代码分析

1.doc的分析

Repository Structure

  • ciGitlab CI configuration files
  • common/defs: JSON coin definitions and support tables
  • common/protob: Common protobuf definitions for the Trezor protocol
  • common/tools: Tools for managing coin definitions and related data
  • core: Trezor Core, firmware implementation for Trezor T
  • crypto: Stand-alone cryptography library used by both Trezor Core and the Trezor One firmware
  • docs: Assorted documentation
  • legacy: Trezor One firmware implementation
  • python: Python client library and the trezorctl command
  • storage: NORCOW storage implementation used by both Trezor Core and the Trezor One firmware
  • tests: Firmware unit test suite
  • tools: Miscellaneous build and helper scripts
  • vendor: Submodules for external dependencies

ci: 这个文件夹包含了Gitlab CI的配置文件,可以用于在Gitlab上进行自动化构建、集成和部署。

common/defs: 这个文件夹包含了各种数字货币的定义文件和相关的支持表格,例如货币的单位、地址格式、交易格式、手续费等等。

common/protob: 这个文件夹包含了Trezor协议的通用protobuf定义,用于描述Trezor设备和客户端之间的通信协议。

common/tools: 这个文件夹包含了用于管理各种数字货币定义和相关数据的工具,例如转换货币定义格式、生成代码等等。

core: 这个文件夹包含了Trezor T的固件实现,也就是Trezor T的主要功能代码。

crypto: 这个文件夹包含了一个用于提供加密功能的独立库,它被Trezor Core和Trezor One固件都使用。

docs: 这个文件夹包含了各种文档,例如项目的设计文档、API文档和开发者指南等等。

legacy: 这个文件夹包含了Trezor One固件的实现代码。

python: 这个文件夹包含了Python客户端库和trezorctl命令,这使得开发者可以使用Python编写Trezor应用程序并与Trezor设备进行交互。

storage: 这个文件夹包含了一个用于提供NORCOW存储功能的实现,它被Trezor Core和Trezor One固件都使用。

tests: 这个文件夹包含了Trezor固件的单元测试套件。

tools: 这个文件夹包含了各种构建和帮助脚本,例如用于构建固件、打包二进制文件等等。

vendor: 这个文件夹包含了外部依赖项的子模块,例如libusb库和btchip库。


总结

提示:这里对文章进行总结:
例如:以上就是今天要讲的内容,本文仅仅简单介绍了pandas的使用,而pandas提供了大量能使我们快速便捷地处理数据的函数和方法。

猜你喜欢

转载自blog.csdn.net/m0_73016265/article/details/130718331