• Stars
    star
    315
  • Rank 132,951 (Top 3 %)
  • Language
    C
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Jade hardware wallet

Jade Firmware

NOTE: the below instructions are for Jade developers with access to Jade development boards or for those wanting to build and flash their own esp32 consumer devices - eg. M5Stack or TTGO T-Display boards. They are not for updating the firmware of an official Blockstream Jade hw unit - these can only be updated in-app, or using the 'update_jade_fw.py' script - see FWUPDATE.md

  • DO NOT ATTEMPT THE BELOW WITH BLOCKSTREAM OFFICIAL BLOCKSTREAM JADE HW UNITS

To build you can use the docker image (see Dockerfile) or install the esp-idf toolchain and repo following the commands in this readme.

DIY Hardware & Programming Notes

For information about suitable DIY hardware, as well as suggested configuration profiles and notes on secure boot. DIY Guide

Use docker

Note the supplied docker-compose.yml assumes the Jade device is at dev/ttyUSB0.

Note the below instructions assume an original Jade v1.0 hardware with a true wheel. When using the later Jade v1.1 hw revision with a rocker/jog-wheel, use 'configs/sdkconfig_jade_v1_1.defaults' in place of 'configs/sdkconfig_jade.defaults'.

(local)$ docker-compose up -d
(local)$ docker-compose exec dev bash
(docker)$ cp configs/sdkconfig_jade.defaults sdkconfig.defaults
(docker)$ idf.py flash

The docker-compose.yml also mounts the local git repo so that it is the origin of the repo in the docker.

Set up the environment

Jade requires the esp-idf sdk.

More information is available in the Espressif official guide.

Get the esp-idf sdk and required tools:

cd ~/esp
git clone -b v5.0.2 --recursive https://github.com/espressif/esp-idf.git
cd ~/esp/esp-idf && git checkout 5181de8ac5ec5e18f04f634da8ce173b7ef5ab73 && ./install.sh esp32

Set up the environmental variables:

. $HOME/esp/esp-idf/export.sh

Build the firmware

git clone --recursive https://github.com/Blockstream/Jade.git $HOME/jade
cd $HOME/jade
cp configs/sdkconfig_jade.defaults sdkconfig.defaults
idf.py flash monitor

_Some hardware configurations (eg: M5StickC-Plus) may not support the default baud rate and won't be detected, so you can force a specific baud rate for flash/monitor by using the -b argument.

For example, the last line of the above code block would change be:

idf.py -b 115200 flash monitor

Build configurations

There are various build configurations used by the CI in the configs/ directory, which may be required for specific builds eg. without BLE radio, with the screen enabled (or disabled, as with the CI tests), or for specific hardware (eg. the m5-fire).

The menuconfig tool can also be used to adjust the build settings.

idf.py menuconfig

Note: for any but the simplest CI-like build with no GUI, no camera, no user-interaction etc. it is recommended that PSRAM is available and enabled. ( Component Config -> ESP-32 specific -> Support external SPI connected RAM )

Run the tests

cd $HOME/jade
virtualenv -p python3 venv3
source venv3/bin/activate
pip install -r requirements.txt

python test_jade.py

deactivate

Emulator/Virtualizer (qemu in Docker)

Run these commands inside the jade source repo root directory, it will enter a docker container

DOCKER_BUILDKIT=1 docker build . -t testjadeqemu
docker run -v ${PWD}:/jade -p 30121:30121 -it testjadeqemu bash

Note: You can skip the build step if you want by fetching the prebuilt image and running with

docker pull blockstream/verde
docker run -v ${PWD}:/jade -p 30121:30121 -it blockstream/verde bash

Now inside the container

. /root/esp/esp-idf/export.sh
cd /jade
rm -fr sdkconfig
cp configs/sdkconfig_qemu.defaults sdkconfig.defaults
idf.py all
apt-get update -qq && apt-get install virtualenv -yqq
virtualenv -p python3 ./venv3
source ./venv3/bin/activate
pip install -r requirements.txt
./tools/fwprep.py build/jade.bin build
./main/qemu/make-flash-img.sh

# To run the CI tests
./main/qemu/qemu_ci_flash.sh

# To reboot the qemu instance
./main/qemu/qemu_reboot.sh

# To reboot the qemu instance and attach gdb to the Jade fw
./main/qemu/qemu_gdb.sh

At this point the Jade fw running in the qemu emulator should be available on 'tcp:localhost:30121' from inside and outside the docker container.

Reproducible Build

See REPRODUCIBLE.md for instructions on locally reproducing the official Blockstream Jade firmware images (minus the Blockstream signature block).

License

The collection is subject to gpl3 but individual source components can be used under their specific licenses.

More Repositories

1

esplora

Explorer for Bitcoin and Liquid
JavaScript
975
star
2

satellite

Blockstream Satellite
Python
953
star
3

green_qt

Blockstream Green App
QML
189
star
4

green_android

Blockstream Green Wallet for Android
Kotlin
177
star
5

gdk

Blockstream Green Development Kit
C++
143
star
6

greenlight

Build apps using self-custodial lightning nodes in the cloud
Rust
114
star
7

green_ios

Blockstream Green Wallet for iOS
Swift
101
star
8

contracthashtool

A simple implementation of Pay-to-Contract-Hash
C++
90
star
9

liquid

Liquid daemon and cli
C++
80
star
10

liquid-swap

Swap Issued Assets on the Liquid Network using Confidential Transactions
Python
50
star
11

borromean_paper

Technical paper on the Borromean ring signature construction
47
star
12

satellite-api

Blockstream Satellite API
Python
33
star
13

green_cli

Command line wallet for Blockstream Green
Python
27
star
14

lwk

Liquid Wallet Kit
Rust
26
star
15

bitcoin-images

This repository contains some useful Docker images.
Dockerfile
19
star
16

aqua_ios

Old GDK iOS wallet, new repo at https://github.com/AquaWallet/aqua-wallet
Swift
18
star
17

asset_registry_db

Assets db
DIGITAL Command Language
15
star
18

liquid-functionary

Liquid network functionary code
Rust
14
star
19

liquid-walkthrough

13
star
20

esp32_bsdiff

bsdiff changed to remove bz2, the header and to allow streaming interfaces, to be used on the esp32 with idf as a component
C
12
star
21

blind_pin_server

Python
12
star
22

docs

Blockstream product documentation
Python
12
star
23

miniscript-templates

Templates for Miniscript-based spending policies. For use by Bitcoin wallet developers and users.
12
star
24

gr-blocksat

Blockstream Satellite Receiver GNU Radio Out-of-tree Module
C++
8
star
25

liquid-melt

Python
7
star
26

gdk_rpc

gdk_rpc for bitcoind/liquidd
Rust
6
star
27

webjadeupgrader

A web based firmware upgrade tool for Blockstream Jade
JavaScript
6
star
28

ln-wordpress-store

Lightning Store in a box
PHP
6
star
29

asset_registry

registry for liquid assets
HTML
5
star
30

liquid_multisig_issuance

Issuance of liquid assets with multisig and registry support
Python
5
star
31

verify-elements-commitments

Python
3
star
32

esp32_deflate

Wrapper around the deflate functionality found in the miniz in the esp32 rom
C
3
star
33

cln-lsps

A Lightning Service Provider Specification for Core Lightning
Rust
3
star
34

asset_registry_testnet_db

Io
2
star
35

price-oracle

Provide signed Bitcoin to Fiat currency conversion rates
2
star
36

dvb-apps

C
1
star
37

docs-theme

CSS
1
star
38

ur-c

C
1
star