tx-bundler

raw JSON →
0.1.2 verified Sat Apr 25 auth: no javascript

An MVP-level library for batching multiple Ethereum transactions into one, reducing gas costs for exchanges and high-volume senders. Current version 0.1.2 is in active development and only supports the Sepolia testnet. It bundles transfers of native ETH (called coins) to multiple recipients in a single on-chain transaction. Key differentiator is simplicity: just provide an RPC URL, recipient list, amounts, and a private key. Not yet production-ready and not economical for single transfers. No published cadence; no TypeScript support.

error TypeError: pkg.sendBatchedCoins is not a function
cause Incorrect import: using default import from CommonJS module.
fix
Use const { sendBatchedCoins } = require('tx-bundler');
error Error: insufficient funds for gas * price + value
cause The account does not have enough ETH to cover the batched transfers and gas.
fix
Ensure the sending account has sufficient ETH on Sepolia (or use a faucet).
breaking The package only works on Sepolia testnet. Mainnet and other chains are not supported.
fix Wait for future versions that support mainnet or use an alternative batch transaction solution.
gotcha Batching only saves gas when sending many transactions (e.g., dozens). For a single transaction, it costs more due to overhead.
fix Use only when sending multiple transfers in one go. For single transfers, use direct ETH transfer.
gotcha The package does not export ESM; only CommonJS require() works. Using import may cause errors.
fix Use require() in Node.js. For ESM projects, use dynamic import() or wait for an ESM update.
npm install tx-bundler
yarn add tx-bundler
pnpm add tx-bundler

Demonstrates sending a batched ETH transfer to two recipients on Sepolia testnet using an Infura RPC URL and a private key. Requires ethers as a peer dependency.

const { sendBatchedCoins } = require('tx-bundler');
const RPC_URL = process.env.RPC_URL ?? 'https://sepolia.infura.io/v3/YOUR-PROJECT-ID';
const recipients = ['0xRecipient1...', '0xRecipient2...'];
const amounts = [0.001, 0.002];
const privateKey = process.env.PRIVATE_KEY ?? '';
async function main() {
  const txHash = await sendBatchedCoins(RPC_URL, recipients, amounts, privateKey);
  console.log('Batch transaction hash:', txHash);
}
main().catch(console.error);