Code Monkey home page Code Monkey logo

app-ethereum's Introduction


app-ethereum

Ethereum wallet application for Ledger Blue, Nano S, Nano S Plus and Nano X
« Explore the docs »

Report Bug · Request Feature · Request New Network


Table of Contents

About the project

Ethereum wallet application framework for Nano S, Nano S Plus and Nano X. Ledger Blue is not maintained anymore, but the app can still be compiled for this target using the branch blue-final-release.

Documentation

This app follows the specification available in the doc/ folder.

To compile it and load it on a device, please check out our developer portal.

Plugins

We have the concept of plugins in the ETH app. Find the documentations here:

Quick start guide

With VSCode

You can quickly setup a convenient environment to build and test your application by using Ledger's VSCode developer tools extension which leverages the ledger-app-dev-tools docker image.

It will allow you, whether you are developing on macOS, Windows or Linux, to quickly build your apps, test them on Speculos and load them on any supported device.

  • Install and run Docker.
  • Make sure you have an X11 server running:
    • On Ubuntu Linux, it should be running by default.
    • On macOS, install and launch XQuartz (make sure to go to XQuartz > Preferences > Security and check "Allow client connections").
    • On Windows, install and launch VcXsrv (make sure to configure it to disable access control).
  • Install VScode and add Ledger's extension.
  • Open a terminal and clone app-ethereum with git clone [email protected]:LedgerHQ/app-ethereum.git.
  • Open the app-ethereum folder with VSCode.
  • Use Ledger extension's sidebar menu or open the tasks menu with ctrl + shift + b (command + shift + b on a Mac) to conveniently execute actions:
    • Build the app for the device model of your choice with Build.
    • Test your binary on Speculos with Run with Speculos.
    • You can also run functional tests, load the app on a physical device, and more.

The terminal tab of VSCode will show you what commands the extension runs behind the scene.

With a terminal

The ledger-app-dev-tools docker image contains all the required tools and libraries to build, test and load an application.

You can download it from the ghcr.io docker repository:

sudo docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest

You can then enter this development environment by executing the following command from the root directory of the application git repository:

Linux (Ubuntu)

sudo docker run --rm -ti --user "$(id -u):$(id -g)" --privileged -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest

macOS

sudo docker run  --rm -ti --user "$(id -u):$(id -g)" --privileged -v "$(pwd -P):/app" ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest

Windows (with PowerShell)

docker run --rm -ti --privileged -v "$(Get-Location):/app" ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest

The application's code will be available from inside the docker container, you can proceed to the following compilation steps to build your app.

Compilation and load

To easily setup a development environment for compilation and loading on a physical device, you can use the VSCode integration whether you are on Linux, macOS or Windows.

If you prefer using a terminal to perform the steps manually, you can use the guide below.

Compilation

Setup a compilation environment by following the shell with docker approach.

Be sure you checkout the submodule:

git submodule update --init

From inside the container, use the following command to build the app:

make DEBUG=1  # compile optionally with PRINTF

You can choose which device to compile and load for by setting the BOLOS_SDK environment variable to the following values:

  • BOLOS_SDK=$NANOS_SDK
  • BOLOS_SDK=$NANOX_SDK
  • BOLOS_SDK=$NANOSP_SDK
  • BOLOS_SDK=$STAX_SDK

Loading on a physical device

This step will vary slightly depending on your platform.

Your physical device must be connected, unlocked and the screen showing the dashboard (not inside an application).

Linux (Ubuntu)

First make sure you have the proper udev rules added on your host. See udev-rules

Then once you have opened a terminal in the app-builder image and built the app for the device you want, run the following command:

# Run this command from the app-builder container terminal.
make load    # load the app on a Nano S by default

Setting the BOLOS_SDK environment variable will allow you to load on whichever supported device you want.

macOS / Windows (with PowerShell)

It is assumed you have Python installed on your computer.

Run these commands on your host from the app's source folder once you have built the app for the device you want:

# Install Python virtualenv
python3 -m pip install virtualenv
# Create the 'ledger' virtualenv
python3 -m virtualenv ledger

Enter the Python virtual environment

  • macOS: source ledger/bin/activate
  • Windows: .\ledger\Scripts\Activate.ps1
# Install Ledgerblue (tool to load the app)
python3 -m pip install ledgerblue
# Load the app.
python3 -m ledgerblue.runScript --scp --fileName bin/app.apdu --elfFile bin/app.elf

Tests

The Ethereum app comes with different tests:

  • Functional Tests implemented with Ledger's Ragger test framework.
  • Unit Tests, allowing to test basic simple functions

Functional Tests (Ragger based)

Linux (Ubuntu)

On Linux, you can use Ledger's VS Code extension to run the tests. If you prefer not to, open a terminal and follow the steps below.

Install the tests requirements:

pip install -r tests/ragger/requirements.txt

Then you can:

Run the functional tests (here for nanos but available for any device once you have built the binaries):

pytest tests/ragger/ --tb=short -v --device nanos

Please see the corresponding ducomentation USAGE

Or run your app directly with Speculos

speculos --model nanos build/nanos/bin/app.elf

macOS / Windows

To test your app on macOS or Windows, it is recommended to use Ledger's VS Code extension to quickly setup a working test environment.

You can use the following sequence of tasks and commands (all accessible in the extension sidebar menu):

  • Select build target
  • Build app

Then you can choose to execute the functional tests:

  • Use Run tests.

Or simply run the app on the Speculos emulator:

  • Run with Speculos.

Unit Tests

Those tests are available in the directory tests/unit. Please see the corresponding README to compile and run them.

Contributing

Contributions are what makes the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag enhancement.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/my-feature)
  3. Commit your Changes (git commit -m 'feat: my new feature)
  4. Push to the Branch (git push origin feature/my-feature)
  5. Open a Pull Request

Please try to follow Conventional Commits.

app-ethereum's People

Contributors

abonnaudet-ledger avatar apaillier-ledger avatar benjyskan avatar bigspider avatar cbouvet-ledger avatar cedelavergne-ledger avatar clementperon avatar cseguret-ledger avatar dependabot[bot] avatar fbeutin-ledger avatar github-actions[bot] avatar greenknot avatar hackmod avatar jibeee avatar jingxu85 avatar jmartins-ledger avatar joelamouche avatar lpascal-ledger avatar mkrufky avatar oto-ledger avatar pscott avatar raredata avatar saltari avatar sgliner-ledger avatar tamtamhero avatar tdejoigny-ledger avatar thanhson1085 avatar tjulien-ledger avatar vforgeoux-ledger avatar xchapron-ledger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

app-ethereum's Issues

Support for signing old tx/message before EIP155

I tried some method for signing a transaction/message before EIP155 (chainid=0 or without chainid) but it doesn't work. The signed TX can recover but with different Address.
I'm using Ledger Nano X

Display chain id when signing transactions

With it being more and more common that users interact with multiple chains it is extremely important that the ledger display some unique identifier so that chains can be differentiated.

As a user I need to know whether I'm signing a transaction for mainnet, ropsten, binance smart chain or xDai. Am I sending 2 ETH (~4500$), 2 BNB (~1000$) or 2 xDAI (~2$)? While additionally displaying the symbol of the specific chain instead of 'ETH' simply showing the chain id would likely be enough. Something like "Chain ID: 0x56".

The fact that one cannot discern for which chain a transaction is being signed is a major security risk.

Can't load the app

make -f Makefile.genericwallet BOLOS_ENV=/home/rstorm/ledger_ubuntu/ledger/bolos_env BOLOS_SDK=/home/rstorm/ledger_ubuntu/ledger/nanos-secure-sdk CHAIN=ethereum

TARGET_NAME=TARGET_NANOS TARGET_ID=0x31100002
[GLYPH] Compiling...
/home/rstorm/ledger_ubuntu/ledger/nanos-secure-sdk/Makefile.glyphs:29: recipe for target 'src/glyphs.h' failed
make: [src/glyphs.h] Error 1 (ignored)
An error occured
An error occured
Prepare directories
[DEP]  dep/usbd_ioreq.d
[DEP]  dep/usbd_hid_impl.d
[DEP]  dep/usbd_hid.d
[DEP]  dep/usbd_ctlreq.d
[DEP]  dep/usbd_core.d
[DEP]  dep/usbd_conf.d
[DEP]  dep/usbd_ccid_if.d
[DEP]  dep/usbd_ccid_core.d
[DEP]  dep/usbd_ccid_cmd.d
[DEP]  dep/uint256.d
[DEP]  dep/u2f_transport.d
[DEP]  dep/u2f_service.d
[DEP]  dep/u2f_processing.d
[DEP]  dep/u2f_io.d
[DEP]  dep/tokens.d
[DEP]  dep/syscalls.d
[DEP]  dep/pic_internal.d
[DEP]  dep/pic.d
[DEP]  dep/os_printf.d
[DEP]  dep/os_io_seproxyhal.d
[DEP]  dep/os.d
[DEP]  dep/main.d
src_genericwallet/main.c:29:10: fatal error: 'glyphs.h' file not found
#include "glyphs.h"
         ^~~~~~~~~~
1 error generated.
[DEP]  dep/glyphs.d
[DEP]  dep/ethUtils.d
[DEP]  dep/ethUstream.d
TARGET_NAME=TARGET_NANOS TARGET_ID=0x31100002
[CC]	  obj/ethUstream.o
[CC]	  obj/ethUtils.o
[CC]	  obj/glyphs.o
[CC]	  obj/main.o
src_genericwallet/main.c:1758:6: warning: initializing 'const char *' with an expression of type 'volatile char [43]'
      discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
     fullAddress,
     ^~~~~~~~~~~
src_genericwallet/main.c:2213:18: warning: passing 'volatile char [43]' to parameter of type 'char *' discards
      qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        snprintf(fullAddress, sizeof(fullAddress), "0x%.*s", 40,
                 ^~~~~~~~~~~
/home/rstorm/ledger_ubuntu/ledger/nanos-secure-sdk/include/os.h:862:20: note: passing argument to parameter 'str' here
int snprintf(char *str, size_t str_size, const char *format, ...);
                   ^
src_genericwallet/main.c:2217:9: warning: incompatible pointer types assigning to 'bagl_element_callback_t' (aka
      'const struct bagl_element_e *(*)(const struct bagl_element_e *)') from 'unsigned int (const bagl_element_t *)'
      (aka 'unsigned int (const struct bagl_element_e *)') [-Wincompatible-pointer-types]
        UX_DISPLAY(ui_address_nanos, ui_address_prepro);
        ^                            ~~~~~~~~~~~~~~~~~
/home/rstorm/ledger_ubuntu/ledger/nanos-secure-sdk/include/os_io_seproxyhal.h:343:30: note: expanded from macro
      'UX_DISPLAY'
    ux.elements_preprocessor = preprocessor;                                   \
                             ^ ~~~~~~~~~~~~
src_genericwallet/main.c:2233:14: warning: initializing 'uint8_t *' (aka 'unsigned char *') with an expression of type
      'const uint8_t [5]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    uint8_t *ticker = TICKER_ETH;
             ^        ~~~~~~~~~~
src_genericwallet/main.c:2283:32: warning: incompatible integer to pointer conversion initializing
      'tokenDefinition_t *' (aka 'struct tokenDefinition_t *') with an expression of type 'unsigned int'
      [-Wint-conversion]
            tokenDefinition_t *currentToken = PIC(&TOKENS[i]);
                               ^              ~~~~~~~~~~~~~~~
src_genericwallet/main.c:2319:16: warning: passing 'volatile char [43]' to parameter of type 'char *' discards
      qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        strcpy(fullAddress, "Contract");
               ^~~~~~~~~~~
/usr/include/string.h:125:39: note: passing argument to parameter '__dest' here
extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
                                      ^
src_genericwallet/main.c:2374:5: warning: incompatible pointer types assigning to 'bagl_element_callback_t' (aka
      'const struct bagl_element_e *(*)(const struct bagl_element_e *)') from 'unsigned int (const bagl_element_t *)'
      (aka 'unsigned int (const struct bagl_element_e *)') [-Wincompatible-pointer-types]
    UX_DISPLAY(ui_approval_nanos, ui_approval_prepro);
    ^                             ~~~~~~~~~~~~~~~~~~
/home/rstorm/ledger_ubuntu/ledger/nanos-secure-sdk/include/os_io_seproxyhal.h:343:30: note: expanded from macro
      'UX_DISPLAY'
    ux.elements_preprocessor = preprocessor;                                   \
                             ^ ~~~~~~~~~~~~
src_genericwallet/main.c:2431:40: warning: passing 'const char [27]' to parameter of type 'unsigned char *' discards
      qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        cx_hash((cx_hash_t *)&sha3, 0, SIGN_MAGIC, sizeof(SIGN_MAGIC) - 1,
                                       ^~~~~~~~~~
/home/rstorm/ledger_ubuntu/ledger/nanos-secure-sdk/include/cx.h:403:51: note: passing argument to parameter 'in' here
                    int mode, unsigned char WIDE *in PLENGTH(len),
                                                  ^
src_genericwallet/main.c:2444:40: warning: passing 'char [11]' to parameter of type 'unsigned char *' converts between
      pointers to integer types with different sign [-Wpointer-sign]
        cx_hash((cx_hash_t *)&sha3, 0, tmp, pos, NULL);
                                       ^~~
/home/rstorm/ledger_ubuntu/ledger/nanos-secure-sdk/include/cx.h:403:51: note: passing argument to parameter 'in' here
                    int mode, unsigned char WIDE *in PLENGTH(len),
                                                  ^
src_genericwallet/main.c:2465:22: warning: passing 'volatile char [43]' to parameter of type 'char *' discards
      qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        array_hexstr(fullAddress, hashMessage, HASH_LENGTH / 2);
                     ^~~~~~~~~~~
src_genericwallet/main.c:164:25: note: passing argument to parameter 'strbuf' here
void array_hexstr(char *strbuf, const void *bin, unsigned int len) {
                        ^
src_genericwallet/main.c:2469:22: warning: passing 'volatile char *' to parameter of type 'char *' discards qualifiers
      [-Wincompatible-pointer-types-discards-qualifiers]
        array_hexstr(fullAddress + HASH_LENGTH / 2 * 2 + 3,
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src_genericwallet/main.c:164:25: note: passing argument to parameter 'strbuf' here
void array_hexstr(char *strbuf, const void *bin, unsigned int len) {
                        ^
src_genericwallet/main.c:2477:9: warning: incompatible pointer types assigning to 'bagl_element_callback_t' (aka
      'const struct bagl_element_e *(*)(const struct bagl_element_e *)') from 'unsigned int (const bagl_element_t *)'
      (aka 'unsigned int (const struct bagl_element_e *)') [-Wincompatible-pointer-types]
        UX_DISPLAY(ui_approval_signMessage_nanos,
        ^
/home/rstorm/ledger_ubuntu/ledger/nanos-secure-sdk/include/os_io_seproxyhal.h:343:30: note: expanded from macro
      'UX_DISPLAY'
    ux.elements_preprocessor = preprocessor;                                   \
                             ^ ~~~~~~~~~~~~
12 warnings generated.
[CC]	  obj/os.o
[CC]	  obj/os_io_seproxyhal.o
[CC]	  obj/os_printf.o
[CC]	  obj/pic.o
[CC]	  obj/pic_internal.o
[CC]	  obj/syscalls.o
[CC]	  obj/tokens.o
[CC]	  obj/u2f_io.o
[CC]	  obj/u2f_processing.o
src_genericwallet/u2f_processing.c:32:22: warning: unused variable 'SW_SUCCESS' [-Wunused-const-variable]
static const uint8_t SW_SUCCESS[] = {0x90, 0x00};
                     ^
src_genericwallet/u2f_processing.c:33:22: warning: unused variable 'SW_PROOF_OF_PRESENCE_REQUIRED'
      [-Wunused-const-variable]
static const uint8_t SW_PROOF_OF_PRESENCE_REQUIRED[] = {0x69, 0x85};
                     ^
src_genericwallet/u2f_processing.c:37:22: warning: unused variable 'DUMMY_ZERO' [-Wunused-const-variable]
static const uint8_t DUMMY_ZERO[] = {0x00};
                     ^
src_genericwallet/u2f_processing.c:44:22: warning: unused variable 'NOTIFY_USER_PRESENCE_NEEDED'
      [-Wunused-const-variable]
static const uint8_t NOTIFY_USER_PRESENCE_NEEDED[] = {
                     ^
src_genericwallet/u2f_processing.c:71:22: warning: unused variable 'DUMMY_USER_PRESENCE' [-Wunused-const-variable]
static const uint8_t DUMMY_USER_PRESENCE[] = {SIGN_USER_PRESENCE_MASK};
                     ^
5 warnings generated.
[CC]	  obj/u2f_service.o
In file included from src_genericwallet/u2f_service.c:26:
src_genericwallet/u2f_timer.h:27:16: warning: redefinition of typedef 'u2fTimer_t' is a C11 feature
      [-Wtypedef-redefinition]
typedef void (*u2fTimer_t)(struct u2f_service_t *service);
               ^
src_genericwallet/u2f_service.h:34:16: note: previous definition is here
typedef void (*u2fTimer_t)(struct u2f_service_t *service);
               ^
src_genericwallet/u2f_service.c:79:5: warning: implicit declaration of function 'u2f_io_send' is invalid in C99
      [-Wimplicit-function-declaration]
    u2f_io_send(buffer, len, service->packetMedia);
    ^
src_genericwallet/u2f_service.c:80:5: warning: implicit declaration of function 'u2f_io_close_session' is invalid in
      C99 [-Wimplicit-function-declaration]
    u2f_io_close_session();
    ^
src_genericwallet/u2f_service.c:117:13: warning: implicit declaration of function 'os_memset' is invalid in C99
      [-Wimplicit-function-declaration]
            os_memset(service->outputBuffer, 0, USB_SEGMENT_SIZE);
            ^
src_genericwallet/u2f_service.c:118:13: warning: implicit declaration of function 'os_memmove' is invalid in C99
      [-Wimplicit-function-declaration]
            os_memmove(service->outputBuffer + offset, service->channel, 4);
            ^
5 warnings generated.
[CC]	  obj/u2f_transport.o
src_genericwallet/u2f_transport.c:37:9: warning: implicit declaration of function 'os_memmove' is invalid in C99
      [-Wimplicit-function-declaration]
        os_memmove(channel, buffer, 4);
        ^
src_genericwallet/u2f_transport.c:41:5: warning: implicit declaration of function 'u2f_io_open_session' is invalid in
      C99 [-Wimplicit-function-declaration]
    u2f_io_open_session();
    ^
src_genericwallet/u2f_transport.c:67:18: warning: implicit declaration of function 'os_memcmp' is invalid in C99
      [-Wimplicit-function-declaration]
                (os_memcmp(channel, service->lastContinuationChannel, 4) !=
                 ^
src_genericwallet/u2f_transport.c:190:9: warning: implicit declaration of function 'u2f_io_close_session' is invalid
      in C99 [-Wimplicit-function-declaration]
        u2f_io_close_session();
        ^
src_genericwallet/u2f_transport.c:204:5: warning: implicit declaration of function 'os_memset' is invalid in C99
      [-Wimplicit-function-declaration]
    os_memset(service->outputBuffer, 0, MAX_SEGMENT_SIZE);
    ^
5 warnings generated.
[CC]	  obj/uint256.o
[CC]	  obj/usbd_ccid_cmd.o
[CC]	  obj/usbd_ccid_core.o
[CC]	  obj/usbd_ccid_if.o
[CC]	  obj/usbd_conf.o
[CC]	  obj/usbd_core.o
[CC]	  obj/usbd_ctlreq.o
[CC]	  obj/usbd_hid.o
[CC]	  obj/usbd_hid_impl.o
src_genericwallet/usbd_hid_impl.c:461:30: warning: passing 'volatile u2f_service_t *' (aka
      'volatile struct u2f_service_t *') to parameter of type 'u2f_service_t *' (aka 'struct u2f_service_t *')
      discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        u2f_transport_handle(&u2fService, buffer,
                             ^~~~~~~~~~~
src_genericwallet/u2f_transport.h:71:42: note: passing argument to parameter 'service' here
void u2f_transport_handle(u2f_service_t *service, uint8_t *buffer,
                                         ^
1 warning generated.
[CC]	  obj/usbd_ioreq.o
[LINK] bin/app.elf

then with generated app.hex file:

make -f Makefile.genericwallet BOLOS_ENV=/home/rstorm/ledger_ubuntu/ledger/bolos_env BOLOS_SDK=/home/rstorm/ledger_ubuntu/ledger/nanos-secure-sdk CHAIN=ethereum load
TARGET_NAME=TARGET_NANOS TARGET_ID=0x31100002
python -m ledgerblue.loadApp --path "44'/60'" --path "44'/61'" --appFlags 0x40 --path "44'/1'" --curve secp256k1 --targetId 0x31100002 --fileName bin/app.hex --appName Ethereum `ICONHEX=\`python /home/rstorm/ledger_ubuntu/ledger/nanos-secure-sdk/icon.py nanos_app_ethereum.gif hexbitmaponly 2>/dev/null\` ; [ ! -z "$ICONHEX" ] && echo "--icon $ICONHEX"`
Generated random root public key : 026a5a56114684bdc6ac1411d0bcba43de5865c4894c8822894c41e330854a2531bb957289421901cbbe927b5342f1dc6694da83274b4d05c5f7a0f6d44989104a
Using test master key 046a5a56114684bdc6ac2411d0bcba33de5865c4894c8822894c41e330854a2531bb957289421901cbbe927b5342f1dc6694da84274b4d05c5f7a0f6d44989104a
Using ephemeral key 0432f25de130bfd4529ae1a8ea0020dd70b1ebaba49c3653e2d01f5a781ff5c4732fcbeb211dc1f4912b6b6773f9453f4b6283283ea8db06b36c1bb3e61bc9f5b0
Broken certificate chain - loading from user key
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/ledgerblue/loadApp.py", line 174, in <module>
    loader.createApp(args.appFlags, appLength, args.appName, icon, path, None, None, args.appVersion)
  File "/usr/local/lib/python2.7/dist-packages/ledgerblue/hexLoader.py", line 163, in createApp
    data = self.encryptAES(data)
  File "/usr/local/lib/python2.7/dist-packages/ledgerblue/hexLoader.py", line 95, in encryptAES
    encryptedData = cipher.encrypt(paddedData)
  File "/usr/local/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py", line 244, in encrypt
    return self._cipher.encrypt(plaintext)
TypeError: argument must be string or read-only buffer, not bytearray
Makefile.genericwallet:108: recipe for target 'load' failed
make: *** [load] Error 1

Option to allow access to all derivation paths regardless of the app

A while ago (this commit) a change was made so you can no longer access non-Ethereum derivation paths when using the ETH application. I'm assuming this was done for privacy reasons, e.g. to not allow an application to get addresses for other coins when a user connects their Ledger device.

The issue with this however is that it makes it impossible to recover coins sent to the wrong address. It happens a lot that people send, for example, ETC or EWT tokens to their ETH address, and as far as I know the only way to recover those funds is to use the recovery phrase. That defeats the security of the device, and we generally recommend moving all funds to a temporary address and resetting the Ledger device to get a new recovery phrase.

Trying to sign a transaction on the Ledger device for a ETC derivation path (m/44'/61'/...) currently results in Invalid data received (0x6a80). This problem could be fixed by having an option to allow all derivation paths (and chain IDs) to be used regardless of the app that is used. If there's better solutions for this (that don't involve using the recovery phrase) please let me know.

Ledger nano S can`t interact with Eth2 Staking Smart Contract (Metamask)

Ledger Live Version and Operating System

  • tested on Ledger Live Ledger nano X, firmware 1.2.4-5 , ETH 1.6.1
  • Platform and version: Windows 10

Expected behavior

Actual behavior

Steps to reproduce the behavior

Ledger cannot interact with the Eth2 SmartContrat (launchpad), the contract is not signed.

Contract data: Allow contract data in transactions -> Allowed
Ledger nano X,
Firmware 1.2.4-5 , 
App ETH 1.6.1

I have tried with different browsers, with Brave, Chrome + Metamask and with another usb cable.

the problem is happening to many people with the latest firmware.

MetaMask - RPC Error: Error: TransportStatusError: Ledger device: Condition of use not satisfied (denied by the user?) (0x6985) {code: -32603, message: "Error: TransportStatusError: Ledger device: Condit… use not satisfied (denied by the user?) (0x6985)", stack: "Error: Error: TransportStatusError: Ledger device:… use not satisfied (denied by the user?) (0x6985)"}

image

image

More people with the same problem:
https://www.reddit.com/r/ledgerwallet/comments/k0l294/unable_to_interact_with_eth2_staking_contract/

Fail to compile the code if enable "HAVE_TOKENS_LIST"

There is one line from Makefile
"DEFINES += HAVE_TOKENS_LIST # Do not activate external ERC-20 support yet"
Does it mean the ledger cannot add token transaction for the other Ethereum-like chains? Do you have any plan to add this feature?

Remove BIP32 path lock for generic wallet app

I’d like to request that the BIP32 path lock for the generic Ethereum wallet app be removed or made less restrictive. In particular, we want to be able to export information for m/45' and any children m/45'/* (to arbitrary depth).

There are several reasons I am requesting this change:

  1. The existing Bitcoin app does not have any similar BIP32 path restrictions and we are already reliant on this functionality. This proposed change would make the Ethereum app more consistent with the Bitcoin app.

  2. We use the m/45'/* BIP32 space for multisig so that our users do not need to expose the m/44'/* space used by their single-sig wallets when working with us. This standard was proposed in BIP45, and is used by Electrum.

  3. To generate addresses, we need to export xpubs at m/45'/*. Since the Ledger API only allows exporting public keys, to get the xpub at (say) m/45'/60', we need to be able to export the public key for both m/45'/60' and m/45' (just m/45'/* would be insufficient for us).

So the minimum request for our use-case is to open up m/45'/*, though for consistency with the bitcoin ledger app and other hardware wallets, removing the BIP32 path lock entirely would be ideal.

We suspect the required change may be as simple as changing the Makefile to remove the path restriction. In particular, changing

ifeq ($(CHAIN),ethereum)
#APP_LOAD_PARAMS += --path "44'"
...

to

ifeq ($(CHAIN),ethereum)
#APP_LOAD_PARAMS += --path "44'"
#APP_LOAD_PARAMS += --path "45'"
...

Ledger Firefox U2F support

I ran across a very interesting issue while trying to add firefox support for ledger on MEW since now firefox natively supports U2F
it seems like Firefox sends u2f.register request to ledger instead of u2f.sign. I was able to verify this by using Fido U2F app on ledger nano s. The moment I try to send a sign request, firefox for some reason convert it to a register request and sends it out. This might be due to the fact that the browser remembers whether the device is registered before or not, and based on u2f standard flow you cannot sign without registering first. In order to solve this issue, ledger-app-eth might have to catch the register event as well

you can verify this issue by using ledgerjs lib on firefox. Or refer to our branch
MyEtherWallet/etherwallet#2135

My main adress from my Ledger Nano S is not showing up in MEW or mycrypto

Need your help guys.
I have been using my ledger with MEW for the past 3years but since I updated firmware my main address does not show up in MEW/Mycrypto/LL anymore.
I tried looking for the address on findeth but noting to be found, its like my adress never existed.

I checked the wallet on etherscan and my funds are still there but I have no way to access.

I also tried different derivation paths but it still doesn't show up.

Hope you guys can help me out or all my eth will be lost in nirvana......

Add support for chain `1` (testnet).

According to SLIP44, all test networks are supposed to use a BIP44 path with the chain ID set to 1. At the moment, the Ethereum Ledger app will reject anything that isn't chain 60 or 61.

Add support for chain 1 as a valid BIP44 derivation path.

"Show address" doesn't show last character on a Nano S

When using MEW and clicking the link/button to show the address on the device, the last nibble is not displayed.

So, for example, if my address was

0x04b3fAAA7c8127A80eB6D24672CfdAF4AeCABbF8

the device scroll-shows

0x04b3faaa7c8127a80eb6d24672cfdaf4aecabbf

[Metamask] TransportError: Failed to sign with Ledger device: U2F DEVICE_INELIGIBLE

Trying to sign a transaction interacting with a smart contract, I get this error:

"message": "Error: TransportError: Failed to sign with Ledger device: U2F DEVICE_INELIGIBLE",
"stack": "Error: TransportError: Failed to sign with Ledger device: U2F DEVICE_INELIGIBLE\n    
at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:1227754\n    
at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:1229201\n   
at n (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:205012)"

[Metamask] TransportError: Failed to sign with Ledger device: U2F DEVICE_INELIGIBLE

Trying to sign a transaction interacting with a smart contract, I get this error:

"message": "Error: TransportError: Failed to sign with Ledger device: U2F DEVICE_INELIGIBLE",
"stack": "Error: TransportError: Failed to sign with Ledger device: U2F DEVICE_INELIGIBLE\n    
at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:1227754\n    
at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:1229201\n   
at n (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:205012)"

ETC app connection issue on different "devices" (0x6804)

Probably it is a good idea to make another bug report here, that is related to LedgerHQ/ledger-live-desktop#1753 (comment)

Ledger Nano S
Wallets: Ledger Live 12.7, 1.30, 1.32, MyEtherWallet, MyCrypto.AppImage
Platform and version: Windows 10 64bit and Ubuntu 18.04 64bit
ETC and ETH apps v1.1.8
Secure element 1.5.5 MCU 1.7

I'm not able to use ETC app on different platforms and wallets.
In all cases I'm not able to establish any connection with ETC app. If there is any error explanation available I can see an error code 0x6804
Like: Ledger device: UNKNOWN_ERROR (0x6804)

message hash unreadable during sign message

20180125_031658
20180125_031712_burst01

Started the process to sign the message "onetwothree"

Expected: SHA-256 message hash displayed as 4592092e1061c7ea85af2aed194621cc17a2762bae33a79bf8ce33fd0168b801

Actual: The message hash is unreadable

Please push 1.0.24 version code updates for compat against SDK 1.4.2

It looks like this repo is only current as of version 1.0.22, can only build against SDK 1.4, and needs updates for the latest SDK:

src_common/ethUstream.c:49:62: error: too few arguments to function call, expected 6, have 5
        cx_hash((cx_hash_t *)context->sha3, 0, &data, 1, NULL);
        ~~~~~~~                                              ^
/home/mk/git/nanos-secure-sdk/include/cx.h:329:9: note: 'cx_hash' declared here
SYSCALL int cx_hash(cx_hash_t *hash PLENGTH(scc__cx_scc_struct_size_hash__hash),
        ^
src_common/ethUstream.c:64:21: error: too few arguments to function call, expected 6, have 5
                NULL);
                    ^
/home/mk/git/nanos-secure-sdk/include/cx.h:329:9: note: 'cx_hash' declared here
SYSCALL int cx_hash(cx_hash_t *hash PLENGTH(scc__cx_scc_struct_size_hash__hash),
        ^
2 errors generated.
src_genericwallet/main.c:1884:79: error: too few arguments to function call, expected 8, have 7
                      sizeof(tmpCtx.transactionContext.hash), signature, &info);
                                                                              ^
/home/mk/git/nanos-secure-sdk/include/cx.h:2301:9: note: 'cx_ecdsa_sign' declared here
SYSCALL int cx_ecdsa_sign(const cx_ecfp_private_key_t WIDE *pvkey PLENGTH(
        ^
src_genericwallet/main.c:1972:68: error: too few arguments to function call, expected 8, have 7
        sizeof(tmpCtx.messageSigningContext.hash), signature, &info);
                                                                   ^

Transaction signing is not correctly working for specific data length

Signing transactions is not working for transactions with specific data length.

The transaction data is send in chunks to the nano ledger. If the last chunk
only contains EIP155 data (For example 018080 for the ethereum mainnet), the signature
is returned before this data is send to the nano ledger.

Support for eth_getEncryptionPublicKey and eth_decrypt (EIP-1024)

These methods, as implemented by Metamask respectively allow a Dapp to obtain a public key appropriate for encryption, and decrypt an encrypted payload using a private key derived from an Ethereum account's private key.

At least one Dapp already makes use of these methods; Tornado.cash, which uses these to encrypt a backup copy (which is stored on-chain) of private notes required to redeem deposits.

It would be great if we could use these methods with our Ledger-backed keys :)

References:
ethereum/EIPs#1098
https://docs.metamask.io/guide/rpc-api.html#other-rpc-methods

can use ledger nano s to decrypt sign with public key ?

example

i use public key encrypt message with asynchronous encryption
encryption(
"public key",
"ManZer"
);
//023828382398a.......123213

how to use private key in ledger nano s decrypt 023828382398a.......123213 to get ManZer ?

can custom nano ledger for this case ?

Make clearer error code

Currently the code throws 0x6a80 in lots of different situations, making it hard to wallets / end users to understand what is the real problem.

Ideally we'd want a different code for every different error scenario :D

Changelog 1.6.3

Could we have the changelog of 1.6.3 ?

Seems to be a little patch regarding to #119 but it would be nice

[MyCrypto] TransportInterfaceNotAvailable: The interface number provided is not supported by the device in its current configuration.

Ledger Live Version and Operating System

Device: Ledger Nano S
Firmware: 1.4.2
Ledger Live Version: 1.20.0
Platform and version: Mac 10.14.5
Ledger Ethereum App: 1.1.8

Expected behavior

Select Ethereum wallet based on depravation path.

Actual behavior

Actual Behavior

Steps to reproduce the behavior

Try connecting ledger wallet with MyCrypto.

Notes

This was working when using 1.1.4 version of the Ethereum App.

Support for Interacting with Custom RPCs in Metamask

Info:

  • Ledger Nano X (Firmware 1.2.4-5)
  • Ethereum App 1.6.2
  • OS: Windows 10 (20H2)

Error:
Currently, when I try to sign a transaction through Metamask on the xDai chain RPC with my Ledger Nano X, this happens:
Screenshot 2020-12-09 125932
In the past, an error sometimes shows up saying that the Ledger can't sign it. I looked up the issue and other people talked about it on other websites, but couldn't seem to find a solution. I hope you can find a way to solve this as I would like to have the security of my Ledger while interacting with the xDai chain and I would like to move those tokens as well.
Thanks,
Nano X user

Latest ledger ethereum app upgrade to 1.2.13 blows away user's contract data setting

Contract data is turned off even if it was previously on, when updating the ledger nano s or ledger x . Thus, many interactions that were working for the user will no longer work, until somehow they figure out the cryptic error message and then manually allow contract data on the ledger device.

Instead, existing settings should be preserved where they are still supported in the new version.

Price display

Can we shoehorn a price ticker similar to blue-app-btc?

Cannot derive the path if start geth first using Mist wallet

Env,
Ledger with firmware 1.4.1
OS - Mac 10.13.3
Mist Wallet - 0.9.3

Steps,

  1. Start the Mist Ethereum Wallet and wait for the geth sync
  2. Plug the Ledger and input the pin
  3. Open the eth app from Ledger

Actual,
Fails to derive the eth path, with the error message "err="reply lacks public key entry""

Expected,
Should derive the path successfully

Notes,
If connect Ledger first and then start the wallet, everything is OK!

Move `v` in `chainID` field

Currently we have the function get_chain_id() which fetches the chainId either from v or from chainID depending on the transaction type.
Ideally we'd like to move v to chainID, set chainID.length to vLength. I don't know if they share the same endianness.

This would simplify get_chain_id(), and allow us to call get_chain_id() in the plugins (this function would need to be exported in the ethereum-plugin-sdk).

ETC confirmation show ETH

Hi, when confirming a ETC transaction, the recap showed on the Nano's screen show it like it is a ETH transaction, ("Amount ETH 0.5" instead of "Amount ETC 0.5").

Ledger blue: User interface for signing message/data

The UI is very difficult to handle when signing messages. This is a great security risk. A normal interacting with smart contract is about 40 - 70 pages on the Ledger Blue until you reach the last page to confirm the transaction. This leads to possible uncertainty when you don't know what you confirming. Maybe extracting data that is most importing, like the different addresses you are interacting, and maybe a better way to see how much pages there a left.

Outdated Makefile not generating Glyhphs

Apparently the Makefile for this project is outdated in regards with the new SDK, more specifically there is a problem with generating the needed glyphs.c/glyphs.h.
The issue comes from using log commands in the SDK without referring to Makefile.definitions of log which causes GNU make to break and just output

file is up to date

with no error or anything from that regards, i played with the makefile and was able to generate the needed glyphs by using the terminal shell to execute instead of log

Breaking changes between v1.0.24 and v1.1.4

The recent update to the Ethereum Ledger app introduced some breaking changes for our users trying to stake in the SpankBank.

v1.0.24 still works for users staking SPANK on the SpankBank (https://bank.spankchain.com), users that are using v1.1.4 are not able to stake even with Contract Data 'On' and Display Data both 'On' or 'Off'.

Any guidance would be appreciated.
If necessary, here is our web3 repo for the SpankBank: https://github.com/SpankChain/spankbank-web3

Add test for starkware

It would be nice to have tests for the starkware plugin (at least the main selectors)

can sign transaction including "type" property?

I use ethereum app in ledger device and want to sign transaction including property "type" for klaytn network.

It throw error message "EthAppPleaseEnableContractData: Please enable Contract data on the Ethereum app Settings" and it seems to be related to error code 0x6a80 (Invalid data)

Is it not possible to sign transaction including type property with ledger ethereum app?

Transaction is like this.

chainId: 8217
data: "0x1b2ba1140000000000000000000000009eaefb09fe4aabfbe6b1ca316a3c36afc83a393f000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
from: "0x02e31a6132d338995e3236d2422318110540392c"
gasLimit: "0x8162c"
gasPrice: "0x05d21dba00"
nonce: 66
to: "0xc6a2ad8cc6e4a7e08fc37cc5954be07d499e7654"
type: "FEE_DELEGATED_SMART_CONTRACT_EXECUTION"
value: "0x9184e72a000"

EIP-1559 Support

Greetings.

I am working on EIP-1559 support at MetaMask and am doing discovery & identifying unknowns. When we pass a transaction to hw-app-ethereum for signing we send it a serialized transaction. We use @ethereumjs/tx to generate the serialized transaction which will take into consideration all of the rlp encoding needed for the new fields. When we get the v, r, s values back from ledger we append them to the transaction.

What work is required by Ledger to be able to support EIP-1559 and is there a tracking issue? I assume that ledger unserializes the transaction to display the data to the user on the hardware wallet. A similar question could be asked about EIP-2930 and any future transaction type added under the EIP-2718 Typed transaction envelope.

Python examples do not run under Python 3

I'm trying to use the ledger in a Python project that uses the new web3.py version, which can no longer run under Python 2.

Is there any chance somebody could do a quick and dirty update to the examples getPublicKey.py, ethBase.py and signTx.py so that they work under Python 3? Or perhaps include alternative versions of these files that do work under Python 3, in case you want to still keep around versions that work on Python 2?

It would be an enormous help!

Ledger device: Invalid data received(0x6a80)

Contract data -> YES
Display data -> YES

When an Ethereum transaction's input data is not sufficiently padded it rejects the transaction.

For example, a transaction with the input data 0x123 would fail, while a transaction with the input data 0x123000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 would succeed.

In both cases, when display data -> NO
The transaction is accepted

Also related MyEtherWallet/etherwallet#2044

Amount of ETH to be sent not displaying on Ledger Nano S (bug)

Ledger Live Version and Operating System
tested on Ledger Live 2.26.1
Platform and version: ** Mac 10.13.5 **
Expected behavior
When sending ETH you should be able to see the amount of ETH being sent on the Ledger Nano S device (2.0.0)

Actual behavior
When sending ETH the Amount section shows a partial address of the destination rather than the quantity of ETH, the destination address is then shown in full as expected on the following screen.

Steps to reproduce the behavior:
ETH app version 1.7.5

Problem with mul256 function in uint256.c

If you use mul256 to multiply two numbers and the result is greater than 2^128 the answer is erroneous. I believe I have traced the error to line 411 in uint256.c:

UPPER(UPPER(target2)) = UPPER(third64);

should be

LOWER(UPPER(target2)) = UPPER(third64);

Example: 307629525872148480000 x 1118770292985239888 = 6277101735386680763839673831077621941891705667786836541440 before the change.
307629525872148480000 x 1118770292985239888 = 344166774790893989252724830754570240000 after the change.

Invalid ChainID when trying to swap tokens

Device: Ledger Nano X
Firmware: 1.3.0
Ethereum app: 1.7.8
OS: Ubuntu 18.04
MetaMask: 9.5.3

I'm experiencing a weird behavior when trying to swap a larger quantity of tokens on multiple DEXes on the Fantom blockchain.

For example, for the FTM/DAI pair on SushiSwap and SpookySwap and for the FTM/USDC pair on SpiritSwap, if I try to swap 4722 FTM, the ChainID being displayed on the Ledger device is the correct one (250). However, if I try to swap 4723 or more FTM on all of those 3 exchanges, I'm seeing a ChainID of 0 on the device and subsequently the transaction doesn't go through.

The error being shown is the same in all cases: Error: TransportStatusError: Ledger device: Condition of use not satisfied (denied by the user?) (0x6985)

A similar issue with the ChainID set to 0 was reported here for Matic/Polygon: MetaMask/metamask-extension#9510 and it seems like the 1.7.8 release has resolved it, however the Fantom issue still persists.

I have only observed the above while trying to do swaps of larger quantities of tokens using MetaMask and Ledger. If I use a MetaMask account, the private key for which is stored locally, I do not have any issue with these transactions, which leads me to believe it's a problem with the Ledger Ethereum app.

Does anyone have an insight as to what might be causing it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.