Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @ledgerhq/hw-transport-node-speculos #458

merged 2 commits into from Feb 8, 2020

Add @ledgerhq/hw-transport-node-speculos #458

merged 2 commits into from Feb 8, 2020


Copy link

gre commented Feb 8, 2020

to work with , fixes #429

  • it is already published on NPM @ledgerhq/hw-transport-node-speculos
  • I was able to test it correctly for the APDU transport (tcp) protocol: I did test it with Ledger Live (cli) and correctly was able to do Bitcoin accounts synchronisation
  • the master branch of live-common have the CLI working with it too. SPECULOS_APDU_PORT=40000 ledger-live sync -c btc


  • I was not able to test any device "validation" because I can't make speculos button working => it's working INSIDE the docker but not from outside and i can't figure out why. in theory, the button(command) should work tho.


In the future, we need a third channel to be able to "await & expect a text" so we can get notified when text changes and don't need to do timeouts to await before triggering a device button action.

I was not able to understand if "VNC" would fit with this need (not familiar with it, is it pixel based or text based?)

Getting started

import SpeculosTransport from "@ledgerhq/hw-transport-node-speculos";

const apduPort = 40000;

async function exampleSimple() {
  const transport = await{ apduPort });
  const res = await transport.send(0xE0, 0x01, 0x00, 0x00);

async function exampleAdvanced() {
  const transport = await{ apduPort });
  setTimeout(() => {
    // in 1s i'll click on right button and release
  }, 1000); // 1s is a tradeoff here. In future, we need to be able to "await & expect a text" but that will need a feature from speculos to notify us when text changes.
  // derivate btc address and ask for device verification
  const res = await transport.send(0xE0, 0x40, 0x01, 0x00, Buffer.from("058000002c8000000080000000000000000000000f"));

With ledger-live CLI

It's working with SPECULOS_APDU_PORT and SPECULOS_HOST envs.

SPECULOS_APDU_PORT=40000 ledger-live sync -c btc

To make it work with Docker, I had to expose some port and do this:

docker run -it -p 40000:40000 -v "$(pwd)"/apps:/speculos/apps speculos /bin/bash

$ pipenv shell
$ ./ -m nanos ./apps/btc.elf --sdk 1.6 --seed "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" --display headless --apdu-port 40000
gre added 2 commits Feb 8, 2020
Copy link

meriadec left a comment


@gre gre merged commit 2a24372 into master Feb 8, 2020
2 checks passed
2 checks passed
ci/circleci: build Your tests passed on CircleCI!
workflow Workflow: workflow
@gre gre deleted the speculos branch Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.