Skip to content

sabledeesse/my_ledger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Build Status

Everscale app for Ledger Wallet

Overview

This app adds support for the Everscale tokens to Ledger hardware wallets.

Current Features:

  • Pubkey queries
  • Address queries
  • Sign transaction hash
  • Parse, display and sign Everscale transaction

Build and load application

  1. Pull the default image
docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
  1. Compile your app in the container
  • For Nano S
$ docker run --rm -ti -v "$(realpath .):/app" --user $(id -u $USER):$(id -g $USER) ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
root@656be163fe84:/app# BOLOS_SDK=$NANOS_SDK make
  • For Nano X
$ docker run --rm -ti -v "$(realpath .):/app" --user $(id -u $USER):$(id -g $USER) ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
root@656be163fe84:/app# BOLOS_SDK=$NANOX_SDK make
  • For Nano S+
$ docker run --rm -ti -v "$(realpath .):/app" --user $(id -u $USER):$(id -g $USER) ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
root@656be163fe84:/app# BOLOS_SDK=$NANOSP_SDK make
  1. Code static analysis The Docker images include the Clang Static Analyzer, which can be invoked with:
$ docker run --rm -ti -v "$(realpath .):/app" --user $(id -u $USER):$(id -g $USER) ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
root@656be163fe84:/app# BOLOS_SDK=$NANOS_SDK make scan-build
  1. Load the app on a physical device

⚠️ Only Nano S and Nano S+ devices allow application side-loading. This section will not work with a Nano X.

To load the app from the container, you will need additional docker arguments in order to allow Docker to access your USB port. Your physical device must be connected, unlocked and the screen showing the dashboard (not inside an application). Same as for compilation, BOLOS_SDK variable is used to specify the target device. Use the following docker command to load the app (here for Nano S device) :

$ docker run --rm -ti  -v "$(realpath .):/app" --privileged -v "/dev/bus/usb:/dev/bus/usb" --user $(id -u $USER):$(id -g $USER) ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
root@656be163fe84:/app# BOLOS_SDK=$NANOS_SDK make load

Fuzzing

  • Build docker image
cd fuzz && docker build -t ledger-app-fuzzer .
  • Build fuzzer
docker run --rm -ti -v "$(realpath .):/app" ledger-app-fuzzer:latest
root@72edae7503e3:/# cd /app/fuzz && ./build.sh
  • Run fuzzer
root@72edae7503e3:/app/fuzz/cmake-build-fuzz# cd cmake-build-fuzz && mkdir out && ./fuzzer

Example of Ledger wallet functionality

Install Rust to compile client to interact with Everscale Ledger app

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

List of Everscale wallets

cargo run --manifest-path client/Cargo.toml get-wallets

Request public key

cargo run --manifest-path client/Cargo.toml get-pubkey --account ${LEDGER_ACCOUNT_NUMBER}
# Example
cargo run --manifest-path client/Cargo.toml get-pubkey --account 0

Request address

cargo run --manifest-path client/Cargo.toml get-address --account ${LEDGER_ACCOUNT_NUMBER} --wallet ${WALLET_TYPE}
# send some EVER's to the this address (about 1 should be enough)
# Example
cargo run --manifest-path client/Cargo.toml get-address --account 0 --wallet EverWallet

Check balance

cargo run --manifest-path client/Cargo.toml get-balance --account ${LEDGER_ACCOUNT_NUMBER} --wallet  ${WALLET_TYPE}
# Example
cargo run --manifest-path client/Cargo.toml get-balance --account 0 --wallet EverWallet

Deploy wallet It only applies to Multisig wallets

cargo run --manifest-path client/Cargo.toml deploy --account ${LEDGER_ACCOUNT_NUMBER} -wallet ${WALLET_TYPE}
# Example
cargo run --manifest-path client/Cargo.toml deploy --account 0 --wallet Multisig2_1

Send EVER transaction

cargo run --manifest-path client/Cargo.toml send-transaction \
    --account ${LEDGER_ACCOUNT_NUMBER} \
    --wallet  ${WALLET_TYPE} \
    --amount  ${AMOUNT} \
    --address ${RECIPIENT_ADDRESS}
# Example
cargo run --manifest-path client/Cargo.toml send-transaction \
    --account 0 \
    --wallet Multisig2_1 \
    --amount 0.1 \
    --address 0:7094fc3cb69fa1b7bde8e830e2cd74bc9455d93561ce2c562182215686eb45e2

Get list of supported tokens

cargo run --manifest-path client/Cargo.toml get-tokens

Check token balance

cargo run --manifest-path client/Cargo.toml get-token-balance --account ${LEDGER_ACCOUNT_NUMBER} --wallet ${WALLET_TYPE} --token ${TOKEN_NAME}
# Example
cargo run --manifest-path client/Cargo.toml get-token-balance --account 0 --wallet EverWallet --token WEVER

Send token transaction

cargo run --manifest-path client/Cargo.toml send-token-transaction \
    --account ${LEDGER_ACCOUNT_NUMBER} \
    --wallet  ${WALLET_TYPE} \
    --amount  ${AMOUNT} \
    --address ${RECIPIENT_ADDRESS} \
    --token   ${TOKEN_NAME}
# Example
cargo run --manifest-path client/Cargo.toml send-token-transaction \
    --account 0 \
    --wallet  EverWallet \
    --amount  1.5 \
    --address 0:ed7439e12d67d23fcaf701ff3bd4e30d390c1e8e14f6f40d52089590e28d9c70 \
    --token   WEVER

Tests

Some tests require interactive approval on the ledger

cargo run --manifest-path tests/Cargo.toml

Documentation

This follows the specification available in the api.md

About

Everscale app for Ledger Wallet

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 49.4%
  • Rust 24.2%
  • Python 22.6%
  • Makefile 2.4%
  • CMake 0.7%
  • Dockerfile 0.6%
  • Shell 0.1%