[BREAKGLASS] ❄️ Firmware and simulator for Coldcard Hardware Wallet http://coldcard.com
Go to file
Peter D. Gray 9ddb8a7f57
b4merge
2022-01-13 08:51:19 -05:00
cli mk4 flags 2021-09-07 08:22:28 -04:00
docs mk4 changes 2022-01-11 09:15:37 -05:00
external Follow v1.2.0 changes 2022-01-12 09:58:33 -05:00
graphics updated animation 2022-01-07 12:05:54 -05:00
hardware Some edits and corrections 2020-08-13 14:21:40 -04:00
misc Virtdisk working better 2021-11-05 10:47:24 -04:00
releases mk4 only changes? 2022-01-11 09:34:48 -05:00
shared cleanups 2022-01-07 10:48:48 -05:00
stm32 b4merge 2022-01-13 08:51:19 -05:00
testing SE2 testing, countdown feature, more 2021-12-21 08:29:26 -05:00
unix mk4 simulator look 2022-01-07 10:10:46 -05:00
.gitignore Making whole firmware public with single, signed commit. 2018-07-24 14:07:33 -04:00
.gitmodules gitmodules? 2021-09-07 08:38:01 -04:00
CONTRIBUTING.md Create CONTRIBUTING.md 2021-03-18 16:08:35 -04:00
COPYING-CC dev squashed 2020-11-18 14:19:14 -05:00
LICENSE Add clone-your-Coldcard feature 2021-03-01 09:36:26 -05:00
pull_request_template.md Prettify 2021-03-18 16:17:47 -04:00
README.md Big Sur note 2021-10-25 10:50:22 -04:00
requirements.txt Add ckcc tool 2018-07-24 14:58:57 -04:00

Coldcard Wallet

Coldcard is a Cheap, Ultra-secure & Opensource Hardware Wallet for Bitcoin. Get yours at ColdcardWallet.com

Follow @COLDCARDwallet on Twitter to keep up with the latest updates and security alerts.

coldcard logo

coldcard picture front coldcard picture back

Reproducible Builds

To have confidence this source code tree is the same as the binary on your device, you can rebuild it from source and get exactly the same bytes. This process has been automated using Docker. Steps are as follows:

  1. Install Docker and start it.

  2. Install make (GNUMake) if you don't already have it.

  3. Checkout the code, and start the process.

    git clone https://github.com/Coldcard/firmware.git cd firmware/stm32 make repro

  4. At the end of the process a clear confirmation message is shown, or the differences.

  5. Build products can be found firmware/stm32/built.

Check-out and Setup

Do a checkout, recursively to get all the submodules:

git clone --recursive https://github.com/Coldcard/firmware.git

Already checked-out and getting git errors? Do this:

git fetch
git reset --hard origin/master

Then:

  • cd firmware
  • git submodule update --init (if needed?)
  • brew install autogen virtualenv
  • virtualenv -p python3 ENV (Python > 3.5 is required)
  • source ENV/bin/activate (or source ENV/bin/activate.csh based on shell preference)
  • pip install -r requirements.txt

Setup and Run the Desktop-based Coldcard simulator:

  • cd unix; make setup && make; ./simulator.py

Building the firmware:

  • cd ../cli; pip install --editable .
  • cd ../stm32; make setup && make; make firmware-signed.dfu
  • The resulting file, firmware-signed.dfu can be loaded directly onto a Coldcard, using this command (already installed based on above)
  • ckcc upgrade firmware-signed.dfu

Which looks like this:

[ENV] [firmware/stm32 42] ckcc upgrade firmware-signed.dfu
675328 bytes (start @ 293) to send from 'firmware-signed.dfu'
Uploading  [##########--------------------------]   29%  0d 00:01:04

MacOS

You'll probably need to install at least these packages:

brew install --cask xquartz
brew install sdl2 xterm
brew install --cask gcc-arm-embedded

Used to be these were needed as well:

brew tap PX4/px4
brew search px4
brew install px4/px4/gcc-arm-none-eabi-80 (latest gcc-arm-none-eabi-XX, currently 80)

You may need to reboot to avoid a DISPLAY is not set error.

Big Sur Issues

  • defaults write org.python.python ApplePersistenceIgnoreState NO will supress a warning about Python[22580:10101559] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to... see https://bugs.python.org/issue32909

Linux

You'll probably need to install these (Ubuntu 16):

apt install libudev-dev python-sdl2 gcc-arm-none-eabi

If you get stuck on the "Skip PIN" screen after the startup, edit the pyb.py file located under /unix/frozen-modules/ and follow the instructions from line 27 to line 31:

# If on linux, try commenting the following line
addr = bytes([len(fn)+2, socket.AF_UNIX] + list(fn))
# If on linux, try uncommenting the following two lines
#import struct
#addr = struct.pack('H108s', socket.AF_UNIX, fn)

Code Organization

Top-level dirs:

shared

  • shared code between desktop test version and real-deal
  • expected to be largely in python, and higher-level

unix

  • unix (MacOS) version for testing/rapid dev
  • this is a simulator for the product

testing

  • test cases and associated data

stm32

  • embedded micro version, for actual product
  • final target is a binary file for loading onto hardware

external

  • code from other projects, ie. the dreaded submodules

stm32/bootloader

  • 32k of factory-set code that you cannot change
  • however, you can inspect what code is on your coldcard and compare to this.

hardware

  • schematic and bill of materials for the Coldcard

unix/work/MicroSD

  • files on "simulated" microSD card

Support

Found a bug? Email: support@coinkite.com