DEVELOPER DOCS
Conecting To A Node

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.

The Bundlr constructor accepts three arguments:

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

Uploads to nodes 1 and 2 are permanent. Uploads to Devnet are kept for approximately 60 days.

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}`);

Custom RPC

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",
	},
);
ℹ️

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>”);