BitcoinJS: JavaScript Bitcoin library for applications
A TypeScript-based Bitcoin library providing cryptographic functions and transaction handling for Node.js and browsers.
Learn more about BitcoinJS
BitcoinJS is a comprehensive JavaScript library that implements Bitcoin protocol functionality for both Node.js and browser environments. The library is written in TypeScript and provides APIs for creating transactions, managing addresses, handling cryptographic operations, and working with Bitcoin data structures. It uses tiny-secp256k1 for elliptic curve operations and implements RFC6979 for secure nonce generation. The library is commonly used for building Bitcoin wallets, payment processors, and blockchain applications that require Bitcoin protocol integration.
Cross-Platform Compatibility
Runs natively in both Node.js and browser environments through browserify compilation. Maintains consistent API across different JavaScript runtime environments.
Modular Architecture
Separates key management libraries (ECPair, bip32) from core functionality to reduce bundle size. Allows developers to include only required components for their specific use case.
Comprehensive Test Coverage
Maintains over 95% test coverage with extensive validation of Bitcoin protocol implementations. Includes continuous integration testing across multiple Node.js versions.
const bitcoin = require('bitcoinjs-lib');
const ECPair = require('ecpair');
// Create a key pair
const keyPair = ECPair.makeRandom();
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey });
// Create a new transaction builder
const psbt = new bitcoin.Psbt({ network: bitcoin.networks.testnet });
// Add an input (previous transaction output)
psbt.addInput({
hash: 'e9b542c176808992facac58c46e36ccd2b2e0c7ae0b5c2e4e6b8f0a6e8b5c2d1',
index: 0,
witnessUtxo: {
script: bitcoin.address.toOutputScript(address, bitcoin.networks.testnet),
value: 100000 // satoshis
}
});
// Add an output
psbt.addOutput({
address: 'tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx',
value: 90000 // leaving 10000 satoshis for fee
});
// Sign the transaction
psbt.signInput(0, keyPair);
psbt.validateSignaturesOfInput(0);
psbt.finalizeAllInputs();
// Extract the transaction
const tx = psbt.extractTransaction();
console.log('Transaction hex:', tx.toHex());
console.log('Transaction ID:', tx.getId());Top in Crypto
Related Repositories
Discover similar tools and frameworks used by developers
Freqtrade
Python trading bot with backtesting, strategy optimization, and live trading across crypto exchanges.
Uniswap V3 Core
Core smart contracts for the Uniswap V3 decentralized exchange protocol on Ethereum.
Chainlink
Node software for operating in Chainlink's decentralized oracle network, connecting blockchain smart contracts to real-world data.
Aave V3 Core
Smart contracts for Aave Protocol V3, a decentralized liquidity market for lending and borrowing cryptocurrencies.
Cosmos SDK
Open-source framework for building customizable Layer 1 blockchains with native interoperability support.
Related Reading
Guides and comparisons from the Greptile content library
Choosing the Right Code Review Tool: Better Alternatives to Graphite AI
A breakdown of the best alternatives to Graphite for code reviews. Compare AI tools like Trag, open-source solutions like Gerrit, and database-focused platforms like Visual Expert.
How to Evaluate Code Review Tools: The 4 Step Framework
A 4-step framework for evaluating code review tools on large teams with complex codebases: define what you need, build a shortlist, run a live test, and get developer feedback. Plus a shortlist of tools and how to future-proof your review process.
What is Source Code Management (SCM): Everything Engineering Leaders Need to Know
Source code management is more than branching and merging. Here is how SCM works, the top tools, the best practices, and why good code review is the foundation of source control in an agentic era.
Automated Code Review: How It Works & Best Tools [2026]
What automated code review is, how it differs from traditional and AI code review, the six types of code review automation tools, and why linters and SAST alone are no longer enough as agentic coding grows.