Zondax / ledger-filecoin

Filecoin app for Ledger Nano S and X
Apache License 2.0
26 stars 17 forks source link
filecoin ledger

Ledger Filecoin app

License GithubActions


zondax_light zondax_dark

Please visit our website at zondax.ch


This repository contains:

ATTENTION

Please:

Download and install

Once the app is approved by Ledger, it will be available in their app store (Ledger Live). You can get builds generated by CircleCI from the release tab. THESE ARE UNVETTED DEVELOPMENT RELEASES

Download a release from here (https://github.com/Zondax/ledger-filecoin/releases). You only need installer_s.sh

If the file is not executable, run

chmod +x ./installer_s.sh

then run:

./installer_s.sh load

Development

Preconditions

Warning: Some IDEs may not use the same python interpreter or virtual enviroment as the one you used when running pip. If you see conan is not found, check that you installed the package in the same interpreter as the one that launches cmake.

How to build ?

We like clion or vscode, however, he we describe reproducible command line steps that can be used anywhere

Running tests

Building and running fuzz tests

How to test with Zemu?

What is Zemu?? Great you asked!! As part of this project, we are making public a beta version of our internal testing+emulation framework for Ledger apps.

Npm Package here: https://www.npmjs.com/package/@zondax/zemu

Repo here: https://github.com/Zondax/zemu

Let's go! First install everything:

At this moment, if you change the app you will need to run make before running the test again.

make zemu_install

Then you can run JS tests:

make zemu_test

To run a single specific test:

At the moment, the recommendation is to run from the IDE. Remember to run make if you change the app.

How to debug a ledger app?

You can use vscode or clion to debug the app. We recommend using CLion but we provide a vscode (unsupported) configuration too.

Preconditions

If you are using CLion, you need to a configuration file in your home directory: $HOME/.gdbinit with the following content:

set auto-load local-gdbinit on
add-auto-load-safe-path /

Warnings

There are a few things to take into account when enabling Ledger App debugging:

Using a real device

How to prepare your DEVELOPMENT! device:

You can normally use an emulated device for development purposed. This is only required if you are working on some integration that requires a physical device.

Please do not use a Ledger device with funds for development purposes.

Have a separate and marked device that is used ONLY for development and testing

There are a few additional steps that increase reproducibility and simplify development:

1 - Ensure your device works in your OS

2 - Set a test mnemonic

Many of our integration tests expect the device to be configured with a known test mnemonic.

3 - Add a development certificate

Building the Ledger App

Loading into your development device

The Makefile will build the firmware in a docker container and leave the binary in the correct directory.

APDU Specifications