Cross-Platform
Designed to work across frontends, backends, dapps, and any JavaScript environment - from Vue apps to Node.js servers to Web3 applications.
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.
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).
# 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:
// 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);