Wallet implementation
As a wallet provider, implementing Clear Signing involves integrating with Ledger’s Device Management Kit (DMK) and Device Signer Kit (DSK) to fetch and display human-readable transaction information for Ethereum transactions.
Quick Start Guide
Step 1: Install Required Packages
Install the Device Management Kit and Ethereum signer:
# Core DMK and transport
npm install @ledgerhq/device-management-kit @ledgerhq/device-transport-kit-web-hid
# Ethereum signer for Clear Signing
npm install @ledgerhq/device-signer-kit-ethereum
Step 2: Initialize DMK Instance
import { DeviceManagementKitBuilder, ConsoleLogger } from "@ledgerhq/device-management-kit";
import { webHidTransportFactory } from "@ledgerhq/device-transport-kit-web-hid";
const dmk = new DeviceManagementKitBuilder()
.addLogger(new ConsoleLogger())
.addTransport(webHidTransportFactory)
.build();
Step 3: Connect to Device
// Discover and connect to device
const discoveredDevices = dmk.startDiscovering();
const device = /* select device from discovery */;
const sessionId = await dmk.connect({
deviceId: device.id,
});
Step 4: Initialize Ethereum Signer with Clear Signing
import { SignerEthBuilder } from "@ledgerhq/device-signer-kit-ethereum";
const signerEth = new SignerEthBuilder({
dmk,
sessionId,
originToken: "your-origin-token", // Required for Clear Signing
}).build();
Step 5: Sign Ethereum Transaction with Clear Signing
// Sign transaction - Clear Signing happens automatically
const signature = await signerEth.signTransaction(/* transaction params */);
Complete Implementation Guide
For detailed implementation steps including device discovery, connection management, error handling, and advanced configuration, see the Device Interaction section.
Key resources:
Implementation Approaches
Recommended: Device Management Kit + Device Signer Kit
The DMK/DSK approach provides built-in Clear Signing support and is the recommended implementation for new integrations.
Benefits:
- Built-in Clear Signing support for Ethereum
- Modern architecture with observables
- Active development and new features
- Support for EVM-compatible chains
Legacy: LedgerJS
The LedgerJS approach is maintained for backward compatibility, but Ledger strongly recommends migrating to the DMK/DSK approach for complete Clear Signing support and future compatibility. New features may only be available in the DMK/DSK implementation.
If you must continue using LedgerJS, ensure you’re using the latest version for compatibility and security.