irisnet / ledger-cosmos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ledger Cosmos app

License CircleCI CodeFactor

This repository contains:

  • Ledger Nano S/X Cosmos app
  • Specs / Documentation
  • C++ unit tests

Installing

Cosmos app

The Cosmos app is already available in Ledger Live. Our preferred and recommended hardware wallet!

  • Open Ledger Live and go to Settings (gear icon on the right):

  • Enable developer mode (last option):

  • Now go back to manager and search for Cosmos:

Building

Please only use a TEST DEVICE!

We strongly recommend using Linux as your development environment.

Get source

Apart from cloning, be sure you get all the submodules:

git submodule update --init --recursive

Dependencies

Ledger Nano S

  • This project requires Ledger firmware 1.6

  • The current repository keeps track of Ledger's SDK but it is possible to override it by changing the git submodule.

Docker CE

Ubuntu Dependencies

  • Install the following packages:
    sudo apt update && apt-get -y install build-essential git wget cmake \
    libssl-dev libgmp-dev autoconf libtool
    

Other dependencies

  • You need Python 3. In most cases, make deps will be able to install all additional dependencies:

    make deps
  • You also need to install Conan

    pip install conan

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.

Prepare your development device

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

Have a second 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

All our tests expect the device to be configured with a known test mnemonic.

  • Plug your device while pressing the right button

  • Your device will show "Recovery" in the screen

  • Double click

  • Run make dev_init. This will take about 2 minutes. The device will be initialized to:

    PIN: 5555
    Mnemonic: equip will roof matter pink blind book anxiety banner elbow sun young
    

3 - Add a development certificate

  • Plug your device while pressing the right button

  • Your device will show "Recovery" in the screen

  • Click both buttons at the same time

  • Enter your pin if necessary

  • Run make dev_ca. The device will receive a development certificate to avoid constant manual confirmations.

Building the Ledger App

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

  • Build

    The following command will build the app firmware inside a container and load to your device:

    make                # Builds the app
    
  • Upload to a device The following command will upload the application to the ledger. Warning: The application will be deleted before uploading.

    make load          # Builds and loads the app to the device
    

Development (building C++ Code / Tests)

This is useful when you want to make changes to libraries, run unit tests, etc. It will build all common libraries and unit tests.

Building unit tests

While we recommend you configure your preferred development environment, the minimum steps are as follows:

mkdir build
cd build
cmake .. && make

Run unit tests

export GTEST_COLOR=1 && ctest -VV

Specifications

About

License:Apache License 2.0


Languages

Language:C 45.8%Language:C++ 45.5%Language:Makefile 3.9%Language:CMake 2.6%Language:Shell 2.2%