Skip to content
DogeJS-DevPublic

About

Ledger hardware-wallet support for Dogecoin over WebHID (legacy Bitcoin-app protocol). Not yet confirmed on a real device.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

DogeJS

DogeJS Ledger

Ledger hardware-wallet support for Dogecoin over WebHID, built to Ledger's published protocol.

Live demo · Documentation · All DogeJS projects

The Ledger package connecting to its simulator and reading the account key

What it does

  • Talks to the Ledger Dogecoin app (Ledger's legacy Bitcoin-app protocol) over WebHID, in Chrome or Edge on a computer.
  • Reads public keys and the account key, and shows an address on the device so you can compare it with the screen.
  • Signs transactions (P2PKH) and checks every returned signature against the sighash computed on your side before anything is assembled.
  • Signs messages in Dogecoin Core's signmessage format and verifies the result.
  • Comes with a simulator (@dogejs/ledger/simulator) so the whole flow can be tested with no device.

Try it

The DogeJS Wallet uses this package for its hardware-wallet beta: https://dogejs.com/wallet/

npm install github:DogeJS-Dev/ledger#v0.1.0

Screenshots

The package's own tests: 58 tests against recorded device transcripts and the simulator.

The package's own tests: 58 tests against recorded device transcripts and the simulator.

Install

Nothing is on npm yet, so install straight from this repository (it needs a public repository, or a GitHub login that can read it). The prepare script builds dist as part of the install. It needs core, which npm installs for you from its git tag.

npm install github:DogeJS-Dev/ledger#v0.1.0

This runs against the simulator, so no device is needed:

import { generateMnemonic, testnet } from '@dogejs/core';
import { DogecoinLedger } from '@dogejs/ledger';
import { SimulatedLedger, FakeHid } from '@dogejs/ledger/simulator';

// A simulated Dogecoin app behind a fake navigator.hid (for tests only).
const hid = new FakeHid(new SimulatedLedger({ mnemonic: generateMnemonic(256) }));
const ledger = await DogecoinLedger.connect({ hid });
console.log((await ledger.checkApp()).name); // Dogecoin
const account = await ledger.getAccount(testnet);
console.log(account.path, account.xpub.slice(0, 4)); // m/44'/3'/0' tpub

With a real Ledger, call DogecoinLedger.connect() from a click handler instead: the browser shows its own device chooser.

How it works

Three layers. ApduChannel builds the APDU messages and turns status words into plain errors (LOCKED, WRONG_APP, USER_REJECTED and so on). WebHidTransport does the 64-byte HID framing and the browser's device chooser. DogecoinLedger is the client: it refuses any app that is not the Dogecoin app (version 2.1.0 up to 3.0.0), derives keys only under m/44'/3'/account'/change/index, and verifies what the device returns using core. Every point that is not yet confirmed on a real device is listed in docs/PROTOCOL.md, section 9.

The full reference is in docs/REFERENCE.md.

Works with

  • Built on core.
  • Used by the wallet (More, Hardware wallet, with a built-in device check you can run if you own a Ledger).

Status

Version 0.1.0. It is not published to npm yet, so you install it from git. It has had no external security review, and it has not been confirmed on a real Ledger device: nobody on the project has one. It follows Ledger's published protocol and is tested against recorded Bitcoin-app transcripts and a simulator written by the same author, which cannot catch a misreading of the protocol. Do not use it with real funds until someone has run the device check on a real Ledger.

Contributing

Bug reports, ideas and pull requests are welcome. Read the contributing guide first: small, tested, explained.

npm install
npm run build
npm run typecheck
npm test

Report a security problem privately to hello@dogejs.com, never in a public issue. See SECURITY.md.

The maintainers keep one combined development workspace for all DogeJS projects and publish each project from it as a repository of its own. An accepted pull request is applied there and appears here with the next release.

Licence

MIT, see LICENSE.

About

Ledger hardware-wallet support for Dogecoin over WebHID (legacy Bitcoin-app protocol). Not yet confirmed on a real device.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages