Skip to main content

Connecting To A Node

To connect to a Bundlr node, provide your private key to allow for access to stored funds and for signing transactions.

const bundlr = new Bundlr("http://node1.bundlr.network", "arweave",<arweave_private_key>);

const bundlr = new Bundlr("http://node2.bundlr.network", "matic",<polygon_private_key>);

The Bundlr constructor accepts three arguments:

  1. Node address: Address of the node you’ll connect to, current options are:
    1. https://node1.bundlr.network
    2. https://node2.bundlr.network
    3. https://devnet.bundlr.network
  2. Currency: Name of the currency used to pay.
  3. Key: Your private key.

You can optionally specify a custom RPC:

const bundlr = new Bundlr("https://devnet.bundlr.network", "solana", "<solana_private key>", {
providerUrl: "https://api.devnet.solana.com",
});

Code example:

import Bundlr from "@bundlr-network/client";
const myPrivateKey = ""; // Change to match your private key
const bundlr = new Bundlr("http://node1.bundlr.network", "matic", myPrivateKey);

// Print your wallet address
console.log(`wallet address = ${bundlr.address}`);
note

As of the 0.11.0 SDK release, it is no longer required to use the following format when instantiating a Bundlr object via JavaScript. If your code still uses the .default() format, you will need to update it when upgrading your SDK.

const bundlr = new Bundlr.default("http://node1.bundlr.network", "matic", “<polygon_private_key>”);