Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Permissionless-Software-Foundation/bch-js-examples

Repository files navigation

This repository has been deprecated

These code examples have been moved to the psf-js-examples code repository. They are maintained there. This bch-js-examples repository has been frozen and is no longer maintained.


This repository contains a series of small example apps that illustrate how to code up common use cases for a Bitcoin Cash application using the bch-js JavaScript library and the bch-api REST API, offered by FullStack.cash

Here are two YouTube walk-through videos to help you get started:

The low-level directory 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.

The applications directory contains example applications like wallets, tokens, voting, and other ideas.

For a full-blown wallet app, check out the following libraries:

  • minimal-slp-wallet is a single-address wallet library that has been optimized for web apps. It's the wallet engine that powers wallet.FullStack.cash.
  • slp-cli-wallet is both a command-line wallet as well as an NPM JavaScript library for providing high-level wallet functionality to your own applications. It's primarily used as a sand-box for rapid prototyping of ideas. It support HD wallet functionality.
  • psf-bch-wallet is a single-address command line wallet used by the PSF community to access 'freedom-enforcing' software.

If you want to chat with other developers interested in Bitcoin Cash, be sure to join our Telegram channel.

Installation

Prior to running these examples, you need to setup this code repository. In the root directory run this commands to install the required dependencies.

npm install

These examples (and all PSF code) target the Ubuntu operating system. If you're trying to get setup on Windows, check out this video.

Running Examples

You can run each example script by entering its directory and executing npm start

More Information

If you're new to Bitcoin Cash or need to brush up on your fundamentals, here are some resources:

Basic BCH Wallet Functions

These basic examples in the bch/applications/wallet directory are used to bootstrap a BCH wallet for use with the other examples. Recommended path:

  1. Create a wallet
  2. Check the balance
  3. Send some BCH

A note about testnet

Testnet isn't just a network for software developers. Many mining pools, research labs, and even malicious miners, use the testnet and can disrupt the development workflow. Most professional developers on the Bitcoin Cash network prefer to use mainnet. They use 1000 satoshi transactions (a fraction of a penny) to test their software, or use SLP tokens to test large transaction amounts, and thus avoid using the disruptive testnet.

FullStack.cash does not provide any testnet support. It's expensive and disruptive, and very few professional developers use it.

About

Quick-start examples for using bch-js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published