Ledger® Live Developer Portal

Build secure cryptocurrency applications with Ledger's comprehensive developer tools, APIs, and SDKs. Integrate hardware wallet security into your blockchain projects with enterprise-grade development resources.

npm install @ledgerhq/hw-app-btc npm install @ledgerhq/hw-app-eth Ledger Live Embedded SDK REST API v2

Software Development Kits

Choose from our specialized SDKs for different development needs and blockchain integrations. Each SDK is designed to provide secure, reliable access to Ledger hardware wallets and blockchain networks.

JavaScript SDK

The Ledger JavaScript SDK provides comprehensive tools for web applications to interact with Ledger hardware wallets and blockchain networks. Perfect for building web-based cryptocurrency applications, DeFi platforms, and blockchain services.

// Install the SDK packages
npm install @ledgerhq/hw-transport-webhid
npm install @ledgerhq/hw-app-btc
npm install @ledgerhq/hw-app-eth

// Basic usage example
import TransportWebHID from "@ledgerhq/hw-transport-webhid";
import AppBtc from "@ledgerhq/hw-app-btc";
import AppEth from "@ledgerhq/hw-app-eth";

async function connectLedger() {
try {
// Create transport connection
const transport = await TransportWebHID.create();

// Initialize Bitcoin application
const appBtc = new AppBtc(transport);

// Get Bitcoin address
const { bitcoinAddress } = await appBtc.getWalletPublicKey("44'/0'/0'/0/0");
console.log("Bitcoin Address:", bitcoinAddress);

// Initialize Ethereum application
const appEth = new AppEth(transport);

// Get Ethereum address
const { address } = await appEth.getAddress("44'/60'/0'/0/0");
console.log("Ethereum Address:", address);

} catch (error) {
console.error("Connection failed:", error);
}
}

// Transaction signing example
async function signBitcoinTransaction() {
const transport = await TransportWebHID.create();
const appBtc = new AppBtc(transport);

const tx = await appBtc.createPaymentTransaction({
inputs: [[
"hash of input transaction",
index of the output,
"redeem script",
sequence number
]],
associatedKeysets: ["path of the input"],
outputScriptHex: "output script in hex",
lockTime: 0,
sigHashType: 1,
segwit: true
});

return tx;
}

React Components

Pre-built React components for quickly integrating Ledger functionality into your web applications with minimal setup. Perfect for modern React-based cryptocurrency applications and DeFi platforms.

import React from 'react';
import { LedgerProvider, useLedger } from '@ledgerhq/react-ledger';

// Main application component
function App() {
return (
<LedgerProvider
dappName="My Crypto App"
network="mainnet"
autoConnect={true}
>
<WalletInterface />
</LedgerProvider>
);
}

// Wallet connection component
function WalletConnection() {
const {
connect,
disconnect,
isConnected,
address,
balance,
error
} = useLedger();

return (
<div className="wallet-connection">
{isConnected ? (
<>
<div className="wallet-info">
<p>Connected: {address}</p>
<p>Balance: {balance} ETH</p>
</div>
<button onClick={disconnect} className="disconnect-btn">
Disconnect Ledger
</button>
</>
) : (
<button onClick={connect} className="connect-btn">
Connect Ledger Device
</button>
)}
{error && <p className="error">{error}</p>}
</div>
);
}

// Transaction signing component
function TransactionSigner({ to, amount }) {
const { signTransaction, isConnected } = useLedger();

const handleSign = async () => {
if (!isConnected) {
alert('Please connect your Ledger device first');
return;
}

try {
const signedTx = await signTransaction({
to: to,
value: amount,
gasLimit: '21000',
gasPrice: '20000000000'
});

console.log('Signed transaction:', signedTx);
// Broadcast transaction to network
} catch (error) {
console.error('Signing failed:', error);
}
};

return (
<button onClick={handleSign} disabled={!isConnected}>
Sign Transaction
</button>
);
}

Live Embedded SDK

Embed the full Ledger Live experience directly into your applications with customizable UI components and branding options. Perfect for exchanges, wallet services, and financial platforms.

import { LedgerLive } from '@ledgerhq/live-embedded';

// Initialize Ledger Live Embedded
const ledgerLive = new LedgerLive({
apiKey: 'your-api-key-here',
theme: 'dark', // 'dark' or 'light'
currency: 'USD',
language: 'en',
disableAccounts: false,
disableSend: false,
disableReceive: false,
disableSwap: false,
disableBuySell: false
});

// Mount to DOM element
ledgerLive.mount('#ledger-container');

// Listen for important events
ledgerLive.on('accountUpdate', (account) => {
console.log('Account updated:', account);
});

ledgerLive.on('transaction', (transaction) => {
console.log('New transaction:', transaction);
// Update your application state
});

ledgerLive.on('deviceConnection', (device) => {
console.log('Device connected:', device);
});

ledgerLive.on('error', (error) => {
console.error('Ledger Live error:', error);
});

// Programmatic controls
function showAccount(accountId) {
ledgerLive.showAccount(accountId);
}

function sendTransaction(transaction) {
ledgerLive.sendTransaction(transaction);
}

function disconnect() {
ledgerLive.unmount();
}

Mobile SDK

Build native mobile applications for iOS and Android with Ledger hardware wallet integration and secure Bluetooth communication. Perfect for mobile-first cryptocurrency experiences.

// React Native example
import React, { useEffect, useState } from 'react';
import { View, Text, Button } from 'react-native';
import LedgerModule from 'react-native-ledger-module';

function MobileWallet() {
const [devices, setDevices] = useState([]);
const [connectedDevice, setConnectedDevice] = useState(null);
const [address, setAddress] = useState('');

// Scan for Ledger devices
const scanDevices = async () => {
try {
const availableDevices = await LedgerModule.scanDevices();
setDevices(availableDevices);
} catch (error) {
console.error('Scan failed:', error);
}
};

// Connect to a device
const connectDevice = async (deviceId) => {
try {
const device = await LedgerModule.connect(deviceId);
setConnectedDevice(device);

// Get Ethereum address
const ethAddress = await LedgerModule.getEthereumAddress("44'/60'/0'/0/0");
setAddress(ethAddress);
} catch (error) {
console.error('Connection failed:', error);
}
};

// Sign transaction
const signTransaction = async (txData) => {
if (!connectedDevice) {
alert('No device connected');
return;
}

try {
const signature = await LedgerModule.signTransaction(txData);
return signature;
} catch (error) {
console.error('Signing failed:', error);
}
};

return (
<View>
<Text>Ledger Mobile Integration</Text>
<Button title="Scan for Devices" onPress={scanDevices} />
{devices.map(device => (
<Button
key={device.id}
title={`Connect to ${device.name}`}
onPress={() => connectDevice(device.id)}
/>
))}
{address && <Text>Connected: {address}</Text>}
</View>
);
}

// Android Native (Kotlin) example
/*
class LedgerService : Service() {
private lateinit var bleManager: BluetoothManager

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
bleManager = BluetoothManager(this)
bleManager.scanForLedgerDevices { device ->
// Handle discovered device
}
return START_STICKY
}
}
*/

REST API Reference

Access comprehensive RESTful APIs for blockchain data, portfolio management, and Ledger Live services integration. All endpoints are secured with industry-standard authentication.

GET
/api/v2/accounts/{accountId}/balance

Retrieve current balance and asset information for a specific cryptocurrency account. Returns comprehensive balance data including available, staked, and delegated amounts.

POST
/api/v2/transactions/sign

Sign a cryptocurrency transaction using a connected Ledger device. Supports multiple blockchain networks and transaction types with advanced signing options.

GET
/api/v2/currencies/{currencyId}/rates

Get historical exchange rates and price data for specific cryptocurrencies. Supports multiple timeframes and currency pairs with high-resolution data.

POST
/api/v2/portfolio/sync

Synchronize portfolio data across multiple devices and platforms. Ensures consistent account state and transaction history across all user devices.

GET
/api/v2/blockchain/{network}/status

Retrieve real-time blockchain network status and health information. Includes network congestion, gas prices, and synchronization status.

POST
/api/v2/webhook/subscribe

Subscribe to real-time webhook notifications for account activity, price alerts, and blockchain events with customizable delivery endpoints.

Quick Start Guide

Get started with Ledger Live development in just a few simple steps. This guide will help you set up your development environment and build your first Ledger-integrated application.

1

Set Up Development Environment

Install Node.js and create a new project. Install the necessary Ledger packages for your development needs. Ensure you have a Ledger hardware wallet for testing.

# Create new project directory
mkdir my-ledger-app
cd my-ledger-app

# Initialize npm project
npm init -y

# Install Ledger dependencies
npm install @ledgerhq/hw-transport-node-hid
npm install @ledgerhq/hw-app-btc
npm install @ledgerhq/hw-app-eth
npm install @ledgerhq/hw-app-xrp

# Install development dependencies
npm install --save-dev typescript
npm install --save-dev @types/node
2

Connect to Ledger Device

Establish communication with a connected Ledger hardware wallet using the appropriate transport method for your platform (WebHID for browsers, Node-HID for desktop).

// For web applications (browser)
import TransportWebHID from "@ledgerhq/hw-transport-webhid";

// For desktop applications (Node.js)
import TransportNodeHid from "@ledgerhq/hw-transport-node-hid";

async function initializeConnection() {
let transport;

// Choose transport based on environment
if (typeof window !== 'undefined') {
// Browser environment
transport = await TransportWebHID.create();
} else {
// Node.js environment
transport = await TransportNodeHid.create();
}

return transport;
}

// Initialize applications
const transport = await initializeConnection();
const appBtc = new AppBtc(transport);
const appEth = new AppEth(transport);
3

Implement Core Functionality

Use the SDK methods to get wallet information, create transactions, and interact with blockchain networks. Implement error handling and user feedback.

// Get wallet addresses
async function getWalletAddresses() {
try {
const transport = await initializeConnection();
const appBtc = new AppBtc(transport);
const appEth = new AppEth(transport);

// Get Bitcoin address
const { bitcoinAddress } = await appBtc.getWalletPublicKey("44'/0'/0'/0/0");

// Get Ethereum address
const { address } = await appEth.getAddress("44'/60'/0'/0/0");

return {
bitcoin: bitcoinAddress,
ethereum: address
};
} catch (error) {
console.error('Failed to get addresses:', error);
throw error;
}