Programming Bitcoin Cash
Bitcoin Cash
Additional
#SmartBch JavaScript
SmartBch wallets are designed after usual BCH mainnet.cash wallets to make it easy to reuse your developed code. Although SmartBch is based on Ethereum technology, we still use BCH (10 18 SmartBch wei) and satoshi (10 10 SmartBch wei) to denote the currency. We wrap the excellent ethers-js (opens new window)library for network communication, but you can still use it directly.
This documentation thus is mostly a duplication of a BCH mainnet.cash documentation.
#Introduction
Our Javascript library is designed so you can rapidly and easily provide secure financial services to your users using standard web development knowledge. You no longer have to be a blockchain wizard to give the powers of magic internet money to your customers.
With this library you will be able to create advanced, non-custodial, in-browser wallets.
The mainnet library is currently in a beta stage. Things may change randomly. There is no backward compatibility guarantee yet, even though we try not to break things too often.
#Let's get programming
Note that this tutorial mostly describes Browser + IndexedDB
approach, which means that the wallets will be created and persisted inside of a user browser.
See calling the REST API or Other programming languages for other approaches.
#Getting the mainnet-cash SmartBCH package
To keep the size of the packages small, both the Ethereum style SmartBch functionality and CashScript solidity contracts have been broken out into separate add-on packages (@mainnet-cash/smartbch & @mainnet-cash/contract).
#Via npm / yarn
If you are developing in node or for a webapp, import or require from @mainnet-cash/smartbch
after installing the separate package using: