npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bitgesell-bitcoinjs

v1.0.6

Published

Bitgesell BitcoinJS

Readme

Bitgesell + BitcoinJS

npm examples

This repository provides Bitgesell blockchain support for the BitcoinJS library.

No need to fork or modify bitcoinjs-lib — just install and use this bitgesell-bitcoinjs package!

📦 Requirements

Install dependencies:

npm install bitgesell-bitcoinjs bitcoinjs-lib@^6 ecpair bip32 bip39 @bitcoinerlab/secp256k1

IMPORTANT! Always import the Bitgesell Mainnet network configuration from this bitgesell-bitcoinjs package and pass it as the network parameter where required.

⚙️ Initial Bitgesell BitcoinJS and pass it Bitgesell Mainnet Network Configuration

import { BITGESELL_MAINNET } from 'bitgesell-bitcoinjs';

🔧 Examples list:

  • Generate random wallet
  • Import wallet from WIF
  • Generate wallet from mnemonic (BIP39 + BIP84)
  • Validate address
  • Sign a SegWit transaction (P2WPKH)

🚀 Usage

!!! ALL EXAMPLES ARE IN "examples" DIRECTORY !!!

To run examples:

npm ci
node examples

📄 Examples

0. Import necessary libraries:

import { BITGESELL_MAINNET } from 'bitgesell-bitcoinjs';
import { payments as Payments, address as Address, Psbt } from 'bitcoinjs-lib';
import ECPairFactory from 'ecpair';
import ecc from '@bitcoinerlab/secp256k1';
import { randomBytes } from 'crypto';
import BIP32Factory from 'bip32';
import * as bip39 from 'bip39';

1. Create a random wallet

const ECPair = ECPairFactory(ecc);
const rng = (size) => randomBytes(size);
const keyPair = ECPair.makeRandom({ network: BITGESELL_MAINNET, rng });
const paymentsRandom = Payments.p2wpkh({
	network: BITGESELL_MAINNET,
	pubkey: Buffer.from(keyPair.publicKey),
});
console.info('public address:', paymentsRandom.address);

2. Import from WIF

const ECPair = ECPairFactory(ecc);
const keyPair2 = ECPair.fromWIF('L2ScZnHCser7xN1FsJtc4eR1icDtmwJfqgK3q2XUwb3nmbMEDYkw', BITGESELL_MAINNET);
const paymentFromWif = Payments.p2wpkh({
	network: BITGESELL_MAINNET,
	pubkey: Buffer.from(keyPair2.publicKey),
});
console.info('public address from wif:', paymentFromWif.address);

3. Generate from mnemonic

const mnemonic = bip39.generateMnemonic(256);
console.info('seed:', mnemonic);
const seed = bip39.mnemonicToSeedSync(mnemonic);
const bip32 = BIP32Factory(ecc);
const root = bip32.fromSeed(seed, BITGESELL_MAINNET);
const path = 'm/84\'/0\'/0\'/0/0';
const child = root.derivePath(path);
const paymentsFromSeed = Payments.p2wpkh({
    network: BITGESELL_MAINNET,
    pubkey: Buffer.from(child.publicKey),
});
console.info('public address from seed:', paymentsFromSeed.address);

4. Validate address

const isValidAddress = (address) => {
	try {
		Address.toOutputScript(address, BITGESELL_MAINNET);
		return true;
	} catch (_) {
		return false;
	}
}

isValidAddress(paymentsFromSeed.address) ? console.info('valid address') : console.info('invalid address');

5. Sign a transaction

const psbt = new Psbt({ network: BITGESELL_MAINNET });
const utxoValue = 100000000;
psbt.addInput({
	hash: '3d2e4113a0a2bb94aed0eef1e7a21a8d6dbda399b048330cb55853befe82a8ed',
	index: 0,
	witnessUtxo: {
		script: paymentFromWif.output,
		value: utxoValue,
	},
});
psbt.addOutput({
	address: 'bgl1q8j64v07nhzgs4rwyrv664zd4vx70xk7fe25npf',
	value: utxoValue - 10000,
});
psbt.signInput(0, keyPair2);
psbt.finalizeAllInputs();
const rawTx = psbt.extractTransaction().toHex();
console.info('signed transaction hex:', rawTx);

🙌 Contributions are welcome!

📄 License MIT