Skip to main content

Creating, Signing and Posting transactions

It's super easy to create, sign and upload transactions.

Create a Bundlr instance

import Bundlr from "@bundlr-network/client";

const privateKey = "<your-private-key>";

const bundlr = new Bundlr("https://node1.bundlr.network", "<currency>", privateKey);
note

Remember to replace <currency> with the crypto you want to use.

Create a transaction

Add the contents of data.txt to the Transaction's data as well as tags.

const data = fs.readFileSync("data.txt");

const tags = [{name: "Content-Type", value: "text/plain"}];

const transaction = bundlr.createTransaction(data, { tags: tags });

Sign + upload the transaction to the Bundlr node

await transaction.sign();
await transaction.upload();

Get the transaction's ID

This can be done after signing or after uploading

// after signing 
await transaction.sign()
transaction.id
// after uploading
const id = (await transaction.upload()).data.id

Now your content can be instantly accessed via https://arweave.net/[id]!