Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »


0.6.1 • Public • Published

This repository hosts the library to communicate with the Ledger Nano S IOTA app.


Basic example

import Transport from "@ledgerhq/hw-transport-node-hid";
// import Transport from "@ledgerhq/hw-transport-u2f"; // for browser
import Iota from 'hw-app-iota';
const getAddress = async () => {
  const transport = await Transport.create();
  const iota = new Iota(transport);
  await iota.setActiveSeed("44'/4218'/0'/0'");
  return await iota.getAddress(0, {checksum: true});
getAddress().then(a => console.log(a));

Transaction example

import Transport from "@ledgerhq/hw-transport-node-hid";
// import Transport from "@ledgerhq/hw-transport-u2f"; // for browser
import Iota from 'hw-app-iota';
const prepareTransfers = async () => {
  const transport = await Transport.create();
  const iota = new Iota(transport);
  await iota.setActiveSeed("44'/4218'/0'/0'");
  const transfers = [{
    address: 'ANADDRESS',
    value: 10000,
    tag: 'ATAG'
  const inputs = [{
    address: 'INPUTADDRESS',
    balance: 10000,
    keyIndex: 4
  return await iota.prepareTransfers(transfers, inputs);
prepareTransfers().then(t => console.log(t));

API Reference


Class for the interaction with the Ledger IOTA application.

iota.setActiveSeed(path, [security])

Prepares the IOTA seed to be used for subsequent calls.

Param Type Default Description
path String String representation of the BIP32 path. At most 5 levels.
[security] Number 2 IOTA security level to use


iota.setActiveSeed("44'/4218'/0'/0'", 2);

iota.getAddress(index, [options]) ⇒ Promise.<String>

Generates an address index-based. The result depends on the initalized seed and security level.

Returns: Promise.<String> - Tryte-encoded address

Param Type Default Description
index Integer Index of the address
[options] Object
[options.checksum] Boolean false Append 9 tryte checksum
[options.display] Boolean false Display generated address on display


iota.getAddress(0, { checksum: true });

iota.prepareTransfers(transfers, inputs, [remainder]) ⇒ Promise.<Array.<String>>

Prepares the array of raw transaction data (trytes) by generating a bundle and signing the inputs.

Returns: Promise.<Array.<String>> - Transaction trytes of 2673 trytes per transaction

Param Type Description
transfers Array.<Object> Transfer objects
transfers[].address String Tryte-encoded address of recipient, with or without the 9 tryte checksum
transfers[].value Integer Value to be transferred
transfers[].tag String Tryte-encoded tag. Maximum value is 27 trytes.
inputs Array.<Object> Inputs used for funding the transfer
inputs[].address String Tryte-encoded source address, with or without the 9 tryte checksum
inputs[].balance Integer Balance of that input
inputs[].keyIndex String Index of the address
[remainder] Object Destination for sending the remainder value (of the inputs) to.
remainder.address String Tryte-encoded address, with or without the 9 tryte checksum
remainder.keyIndex Integer Index of the address

iota.getAppVersion() ⇒ Promise.<String>

Retrieves version information about the installed application from the device.

Returns: Promise.<String> - Semantic Version string (i.e. MAJOR.MINOR.PATCH)

iota.getAppMaxBundleSize() ⇒ Promise.<Integer>

Retrieves the largest supported number of transactions (including meta transactions) in one transfer bundle from the device.

Returns: Promise.<Integer> - Maximum bundle size


npm i hw-app-iota

Downloadsweekly downloads









last publish


  • avatar
Report a vulnerability