This directory contains a series of small example apps that illustrate how to code up common use cases for a Bitcoin Cash application.
contains low-level applications exercising a single feature of bch-js. Think of
these examples like lego blocks that can be used to build a bigger app.
applications directory contains example applications like wallets, voting,
and other ideas.
Prior to running these examples, you need to setup this code repository. In the root directory run this commands to install the required dependencies.
You can run each example script by entering its directory and executing
If you're new to Bitcoin Cash or need to brush up on your fundamentals, be sure to read this free book: Mastering Bitcoin Cash
Basic BCH Wallet Functions
These basic examples in the
applications/wallet directory are used to bootstrap
a BCH wallet for use with the other examples. Recommended path:
- Create a wallet
- Fund it. If targeting testnet, fund it with the testnet faucet
- Check the balance
- Send some BCH
Taking it further
Because these examples are included in the bch-js repository, they instantiate bch-js a little strangely:
const BCHJS = require("../../../../src/bch-js")
In your own apps, the line above should look like this:
const BCHJS = require('@chris.troutner/bch-js')