Skip to main content
Version: IOTA

Getting Started With Node.js

Requirements

Before you can get started with the Node.js binding for the iota.rs client library, please make sure that you have installed Node, Rust and Cargo, and NPM or Yarn.

Installing the Library

NPM

If you are using NPM, you can install the binding in your project by running the following command:

npm i @iota/client

Yarn

If you are using Yarn, you can install the binding in your project by running the following command:

yarn add @iota/client

Using the Library

The following example shows you how to include the library and connect to a devnet node.

const { ClientBuilder } = require('@iota/client');
const client = new ClientBuilder()
.node('https://api.lb-0.h.chrysalis-devnet.iota.cafe')
.build();
client.getInfo().then(console.log).catch(console.error);