Overview
This tutorial walks through the typical flow for a Ledger "live" application: prerequisites → project setup → device connection → app logic → testing → publishing checklist. Code samples are minimal, focused on structure — adapt them to your stack and the official Ledger SDKs and APIs.
Prerequisites
- Node.js (LTS) and npm / pnpm / yarn installed
- A Ledger hardware device (Ledger Nano S / X / Plus) with developer mode access where applicable
- Familiarity with JavaScript/TypeScript or Rust (depending on target SDK)
- Official Ledger developer tools & SDKs (install from Ledger Developer docs)
1. Project setup
Create a new project and install dependencies. This example uses Node + a Web UI that communicates with the Ledger device.
// create project
mkdir ledger-live-app
cd ledger-live-app
// initialize
npm init -y
// install common deps (example)
npm install @ledgerhq/hw-transport-webusb @ledgerhq/hw-app-eth
Note: the packages above are examples. Use the official Ledger-maintained transport and app libraries that match the platform and target currency you work with.
2. Connect to the device (example: WebUSB)
Typical flow: request a transport, open a connection, send APDU/commands through a language-specific library.
// example: browser-side JavaScript using WebUSB transport
import TransportWebUSB from "@ledgerhq/hw-transport-webusb";
import AppEth from "@ledgerhq/hw-app-eth";
async function connect() {
// request permission to access the Ledger via WebUSB
const transport = await TransportWebUSB.create();
const eth = new AppEth(transport);
// ask the device for the address at path m/44'/60'/0'/0/0
const result = await eth.getAddress("44'/60'/0'/0/0", false, true);
console.log("address:", result.address);
}
Always handle user permissions, device disconnections and errors gracefully. On desktop you may use platform-specific transports (HID, U2F, BLE) depending on supported stacks.
3. Implement app logic
Your live app will typically:
- Discover and authenticate a Ledger device
- Query the device for account public keys / addresses
- Construct transactions off-device, present them to the user, and request the device to sign
- Broadcast signed transactions to the network (via your chosen node / API)
// pseudo-code: sign + broadcast
const unsignedTx = buildTx({to, value, gas});
const hexPayload = serialize(unsignedTx);
const signature = await eth.signTransaction(path, hexPayload);
// combine signature with tx and broadcast via provider
4. Testing & Debugging
- Test on a development network (testnet) before mainnet
- Verify UX flows: device connection, rejection, timeouts, and retries
- Use Ledger's official tooling & device logs for debugging (follow their docs)
5. Security considerations
When building an app that interacts with a hardware wallet, follow strict security practices:
- Never request or transmit user private keys or recovery phrases.
- Respect user confirmations on-device; always present clear transaction details before signing.
- Validate and sanitize all user inputs and external data used when building transactions.
- Use HTTPS for any network communication; pin or validate endpoints where appropriate.
6. Publishing checklist
- Confirm compatibility with target Ledger devices and firmware versions
- Document supported networks, derivation paths & API endpoints
- Provide clear onboarding steps for end users
- Consider a security audit before mainnet release
Further resources
Always consult the Ledger Developer documentation for the most current SDKs, transports, sample apps and device-specific guidelines. The docs will contain secure examples and authoritative installation instructions.