Skip to main content

Ledger

Namespace: IotaSdk

A connection to the IOTA app on a Ledger device.

Every call completes once the device answers, which for address verification includes waiting for the user to confirm on the device. Calls on the same Ledger, including through the LedgerSigners created from it, run one at a time.

public class Ledger : ILedger, System.IDisposable

Inheritance Object → Ledger
Implements ILedger, IDisposable
Attributes NullableContextAttribute, NullableAttribute

Constructors​

Ledger(UInt64)​

public Ledger(ulong pointer)

Parameters​

pointer UInt64

Methods​

Destroy()​

public void Destroy()

Dispose()​

public void Dispose()

ExitApp()​

Close the app running on the device and return to the dashboard.

On Speculos, this ends the emulated app.

public async Task ExitApp()

Returns​

Task

Exceptions​

LedgerException

GetPublicKey(String)​

Read the public key at a derivation path such as m/44'/4218'/0'/0'/0'.

public async Task<Ed25519PublicKey> GetPublicKey(string path)

Parameters​

path String

Returns​

Task<Ed25519PublicKey>

Exceptions​

LedgerException

IsAppOpen()​

public async Task<bool> IsAppOpen()

Returns​

Task<Boolean>

OpenApp()​

Open the IOTA app, from the dashboard or by closing another app first.

Does nothing if the IOTA app is already running, or on a speculos connection.

public async Task OpenApp()

Returns​

Task

Exceptions​

LedgerException

Signer(String)​

Create a signer for the key at a derivation path such as m/44'/4218'/0'/0'/0', reading its public key from the device.

The signer shares this Ledger's connection, which stays usable.

public async Task<LedgerSigner> Signer(string path)

Parameters​

path String

Returns​

Task<LedgerSigner>

Exceptions​

LedgerException

VerifyAddress(String)​

Show the address at a derivation path on the device for the user to confirm, and return its public key.

public async Task<Ed25519PublicKey> VerifyAddress(string path)

Parameters​

path String

Returns​

Task<Ed25519PublicKey>

Exceptions​

LedgerException

Version()​

Read the version of the IOTA app.

public async Task<LedgerAppVersion> Version()

Returns​

Task<LedgerAppVersion>

Exceptions​

LedgerException

FromTransport(LedgerTransport)​

public static Ledger FromTransport(LedgerTransport transport)

Parameters​

transport LedgerTransport

Returns​

Ledger

NativeHid()​

Connect to the first Ledger device attached over USB.

Fails in builds of the SDK without USB support, such as those for Android, iOS and the web.

public static Ledger NativeHid()

Returns​

Ledger

Exceptions​

LedgerException

Speculos(String, UInt16)​

Connect to the APDU port of a Speculos emulator (by default this is 127.0.0.1:9999 in the emulator).

Calls through this connection block the thread running them until the emulator answers, and fail in the WASM bindings, which have no TCP sockets.

public static Ledger Speculos(string host, ushort port)

Parameters​

host String

port UInt16

Returns​

Ledger