Skip to content

Bitcoin CashDevelopment Framework

Built for Javascript/NodeJS

LibCash

Note

DANGER

LibCash is still under heavy development and IS NOT safe for Production use. API's will be continually changing and evolving until the V1.0 release.

Quick Start

LibCash is intended to be easy to install and easy to use. To get started, simply install it using NPM (or your package manager of choice).

sh
# Install the LibCash Framework from NPM
npm install @libcash/framework

# Or, if you only want to use LibCash's Templates:
# npm install @libcash/templates

# Or, if you only want to use LibCash's Primitives:
# npm install @libcash/primitives

And then compose the LibCash components together to achieve your flow:

ts
// Import the components you wish to use.
import { BlockchainElectrum, BlockchainInMemory, Mnemonic, WalletHD } from '@libcash/framework';

// Initialize a connection to the Bitcoin Cash Network using Electrum.
const blockchain = await BlockchainElectrum.from();

// ... or, for testing, use a temporary "InMemory" Blockchain Adapter.
// const blockchain = await BlockchainInMrmory.from();

// Generate a Random Mnemonic.
const mnemonic = Mnemonic.generateRandom();

// Instantiate a HD Wallet.
const wallet = await WalletHD.from({
  blockchain
}, {
  mnemonic,
});

// Get the balance of the wallet.
const balanceSats = await wallet.getBalanceSats();

// And then print it to the console.
console.log(balanceSats);