Skip to main content

IOTA TypeScript SDK Quick Start

The IOTA TypeScript SDK is a modular library of tools for interacting with the IOTA blockchain. Use it to send queries to RPC nodes, build and sign transactions, and interact with a IOTA or local network.

Installation

npm i @iota/iota-sdk

Network locations

The following table lists the locations for IOTA networks.

info

It is suggested to use dedicated nodes/shared services rather than public endpoints for production apps with high traffic volume.

You can either run your own Full nodes, or outsource this to a professional infrastructure provider (preferred for apps that have high traffic).

IOTA Testnet

Base TokenIOTA Token (no value)
Explorer URL
https://explorer.rebased.iota.org/?network=testnet
JSON RPC URL
https://api.testnet.iota.cafe
Indexer RPC
https://indexer.testnet.iota.cafe
GraphQL RPC
https://graphql.testnet.iota.cafe
RPC Websocket URL
wss://api.testnet.iota.cafe
Faucet URL
https://faucet.testnet.iota.cafe

IOTA Devnet

Base TokenIOTA Token (no value)
Explorer URL
https://explorer.rebased.iota.org/?network=devnet
JSON RPC URL
https://api.devnet.iota.cafe
Indexer RPC
https://indexer.devnet.iota.cafe
GraphQL RPC
https://graphql.devnet.iota.cafe
RPC Websocket URL
wss://api.devnet.iota.cafe
Faucet URL
https://faucet.devnet.iota.cafe

IOTA Localnet

To create a local IOTA network, you can refer to Local Development page.

Base TokenIOTA Token
JSON RPC URL
http://127.0.0.1:9000
Indexer RPC
http://127.0.0.1:9124
GraphQL RPC
http://127.0.0.1:8000
RPC Websocket URL
ws://127.0.0.1:9000
Faucet URL
http://127.0.0.1:9123/gas

Migrate to version 0.38.0

The IOTA TypeScript SDK was refactored beginning with version 0.38.0. If you are updating from an earlier version of the SDK, there are some changes you should consider when updating your code.

Module structure

The IOTA TypeScript SDK is now divided into modular components. Before version 0.38.0, you imported the complete SDK module. Now, you upload the individual packages of the SDK module instead. See the Module Packages section for the list of packages.

Signing transactions

Signing and sending transactions changes slightly with the deprecation of the Signer pattern. For an example of transaction signing, see the IOTA Programmable Transaction Blocks Basics topic.

Faucet requests

The ability to request IOTA from a faucet is not part of IotaClient as it was with JsonRpcProvider. Instead, you must use the requestIotaFromFaucetV0 method from @iota/iota-sdk/faucet. The @iota/iota-sdk/faucet import also provides a getFaucetHost method to retrieve the faucet URL for localnet, testnet, or devnet networks.

import { getFaucetHost, requestIotaFromFaucetV0 } from '@iota/iota-sdk/faucet';

await requestIotaFromFaucetV0({
host: getFaucetHost('devnet'),
recipient: '<IOTA_ADDRESS>',
});

Module packages

The SDK contains a set of modular packages that you can use independently or together. Import just what you need to keep your code light and compact.