Skip to content
A hacker-friendly, command line BCH wallet built with BITBOX
Branch: master
Clone or download
Pull request Compare This branch is 53 commits ahead of Bitcoin-com:master.
christroutner Merge pull request #20 from christroutner/unstable
fix(console.logs): Removing console logs
Latest commit fc6a6eb Sep 18, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin manually forked from Chris Troutners repo Feb 22, 2019
config fix(bch-js): Forwarding RESTAPI env var to bch-js Sep 7, 2019
docs Update Apr 3, 2019
src fix(console.logs): Removing console logs Sep 18, 2019
test fix(245 derivation): 245 token derivation path instead of 145 bch-onl… Sep 4, 2019
wallets manually forked from Chris Troutners repo Feb 22, 2019
.editorconfig manually forked from Chris Troutners repo Feb 22, 2019
.eslintrc manually forked from Chris Troutners repo Feb 22, 2019
.gitignore manually forked from Chris Troutners repo Feb 22, 2019
.travis.yml Adding travis yaml file Apr 1, 2019
LICENSE fix(sem ver): minor change to test semantic versioning Jun 6, 2019 Updating README Sep 4, 2019
package-lock.json fix(bch-js): updated bch-js to fix issue with minted tokens Sep 17, 2019
package.json fix(bch-js): updated bch-js to fix issue with minted tokens Sep 17, 2019


This is an npm library and Bitcoin Cash (BCH) wallet that runs on the command line. Add this library to your app to instantly give it the ability to transact on the BCH network!

This project has the following goals:

  • Create a code base for a wallet that is easily forkable and extensible by JavaScript developers.
  • Explore the potential for bounty-tagged development

If you want a wallet with a graphical user interface, check out Badger Wallet. BCH functionality is implemented in both wallets with BITBOX, and the command line interface for this project is built with oclif.

Also, be sure to check out the design decisions and trade-offs that went into the creation of this project in the docs directory

Build Status Coverage Status semantic-release Greenkeeper badge

NPM Usage

The npm library can be included in your own app to instantly give it the ability to send and receive BCH transactions. Here is an example of how to include it in your own app. This example will generate a new HD wallet.

// Instantiate the Create Wallet class from this library.
const CreateWallet = require('bch-cli-wallet/src/commands/create-wallet')
const createWallet = new CreateWallet()

const walletFile = './wallet.json'

async function makeNewWallet() {
  const wallet = await createWallet.createWallet(walletFile)

  console.log(`wallet: ${JSON.stringify(wallet,null,2)}`)

Install Dev Environment

While this npm library can be used globally, the intended audience is developers familiar with the usage of npm and git. Here is how to set up your own developer environment:

  • Clone this repo with git clone.
  • Install npm dependencies with npm install
  • Execute the commands like this: ./bin/run help

Running the wallet this way, you can edit the behavior of the wallet by making changes to the code in the src/commands directory.

Command Line Usage

$ npm install -g bch-cli-wallet
$ bch-cli-wallet COMMAND
running command...
$ bch-cli-wallet (-v|--version|version)
bch-cli-wallet/1.3.1 linux-x64 node-v10.16.0
$ bch-cli-wallet --help [COMMAND]
  $ bch-cli-wallet COMMAND


bch-cli-wallet create-wallet

Generate a new HD Wallet.

  $ bch-cli-wallet create-wallet

  -n, --name=name  Name of wallet
  -t, --testnet    Create a testnet wallet

See code: src/commands/create-wallet.js

bch-cli-wallet get-address

Generate a new address to recieve BCH.

  $ bch-cli-wallet get-address

  -n, --name=name  Name of wallet
  -t, --token      Generate a simpledger: token address

See code: src/commands/get-address.js

bch-cli-wallet get-key

Generate a new private/public key pair.

  $ bch-cli-wallet get-key

  -n, --name=name  Name of wallet

See code: src/commands/get-key.js

bch-cli-wallet hello

Example command from oclif

  $ bch-cli-wallet hello

  -n, --name=name  name to print

  Leaving it here for future reference in development.

See code: src/commands/hello.js

bch-cli-wallet help [COMMAND]

display help for bch-cli-wallet

  $ bch-cli-wallet help [COMMAND]

  COMMAND  command to show help for

  --all  see all commands in CLI

See code: @oclif/plugin-help

bch-cli-wallet list-wallets

List existing wallets.

  $ bch-cli-wallet list-wallets

See code: src/commands/list-wallets.js

bch-cli-wallet remove-wallet

Remove an existing wallet.

  $ bch-cli-wallet remove-wallet

  -n, --name=name  Name of wallet

See code: src/commands/remove-wallet.js

bch-cli-wallet send

Send an amount of BCH

  $ bch-cli-wallet send

  -a, --sendAddr=sendAddr  Cash address to send to
  -b, --bch=bch            Quantity in BCH
  -n, --name=name          Name of wallet

See code: src/commands/send.js

bch-cli-wallet send-all

Send all BCH in a wallet to another address. Degrades Privacy

  $ bch-cli-wallet send-all

  -a, --sendAddr=sendAddr  Cash address to send to
  -n, --name=name          Name of wallet

  Send all BCH in a wallet to another address.

  This method has a negative impact on privacy by linking all addresses in a
  wallet. If privacy of a concern, CoinJoin should be used.
  This is a good article describing the privacy concerns:

See code: src/commands/send-all.js

bch-cli-wallet send-tokens

Send SLP tokens.

  $ bch-cli-wallet send-tokens

  -a, --sendAddr=sendAddr  Cash or SimpleLedger address to send to
  -n, --name=name          Name of wallet
  -q, --qty=qty
  -t, --tokenId=tokenId    Token ID

See code: src/commands/send-tokens.js

bch-cli-wallet sweep

Sweep a private key

  $ bch-cli-wallet sweep

  -a, --address=address  Address to sweep funds to.
  -b, --balanceOnly      Balance only, no claim.
  -t, --testnet          Testnet
  -w, --wif=wif          WIF private key

  Sweeps a private key in WIF format.

See code: src/commands/sweep.js

bch-cli-wallet update-balances

Poll the network and update the balances of the wallet.

  $ bch-cli-wallet update-balances

  -n, --name=name  Name of wallet

See code: src/commands/update-balances.js

You can’t perform that action at this time.