Cookbook Community Meetup - 12pm ET / 5pm GMT every week on Wednesdays



Contributors: Luke Cassady-Dorion, bobinstein
Last Updated:

Posting Transactions using Irys (Previously Bundlr)

Posting transactions to can be accomplished using the JavaScript package. Bundling services enable guaranteed confirmation of posted transactions as well as supporting many thousands of transactions per block though the use of transaction bundles.

Installing the

To install run

npm install @irys/sdk
yarn add @irys/sdk

Initializing Irys Network Client

A difference between posting Layer 1 and bundled Layer 2 transactions is that when using Irys you must make a deposit on the Irys nodeopen in new window ahead of time. This deposit can be made using AR tokens or a variety of other crypto currencies. Another difference is that Irys guarantees your data will arrive on chain.

import Irys from "@irys/sdk";
import fs from "fs";

const url = "";
const token = "arweave";
// load the JWK wallet key file from disk
let key = JSON.parse(fs.readFileSync("walletFile.txt").toString());

const irys = new Irys({
	url, // URL of the node you want to connect to
	token, // Token used for payment and signing
	key, // Arweave wallet

Using ArDrive Turbo with Irys

The Irys SDK can post transactions to Turbo, and use Turbo Credits to pay for upload, by setting as the upload url when initializing.

const irys = new Irys({
	url: '',
	token: 'arweave',
	key //Arweave Wallet

Posting a Bundled Transaction

// Your file
const fileToUpload = "./myImage.png";

// Add a custom tag
// NOTE: The Content-Type tag will be added automatically
const tags = [{ name: "application-id", value: "MyNFTDrop" }];

// Upload the file
try {
	const receipt = await irys.uploadFile(fileToUpload, { tags });
	console.log(`File uploaded ==>${}`);
} catch (e) {
	console.log("Error uploading file ", e);