bchd is an alternative full node bitcoin cash implementation written in Go (golang).
This project is a port of the btcd codebase to Bitcoin Cash. It provides a high powered and reliable blockchain server which makes it a suitable backend to serve blockchain data to lite clients and block explorers or to power your local wallet.
bchd does not include any wallet functionality by design as it makes the codebase more modular and easy to maintain. The bchwallet is a separate application that provides a secure Bitcoin Cash wallet that communicates with your running bchd instance via the API.
2.1 Installation
The easiest way to run the server is to download a pre-built binary. You can find binaries of our latest release for each operating system at the releases page.
2.1.1 Building From Source
If you prefer to install from source do the following:
-
Install Go according to the installation instructions here: http://golang.org/doc/install
-
Run the following commands to obtain bchd, all dependencies, and install it:
$ go get github.com/gcash/bchd
This will download and compile bchd
and put it in your path.
2.2 Configuration
bchd has a number of configuration
options, which can be viewed by running: $ bchd --help
.
2.3 Controlling and Querying bchd via bchctl
bchctl is a command line utility that can be used to both control and query bchd via RPC. bchd does not enable its RPC server by default; You must configure at minimum both an RPC username and password or both an RPC limited username and password:
- bchd.conf configuration file
[Application Options]
rpcuser=myuser
rpcpass=SomeDecentp4ssw0rd
rpclimituser=mylimituser
rpclimitpass=Limitedp4ssw0rd
- bchctl.conf configuration file
[Application Options]
rpcuser=myuser
rpcpass=SomeDecentp4ssw0rd
OR
[Application Options]
rpclimituser=mylimituser
rpclimitpass=Limitedp4ssw0rd
For a list of available options, run: $ bchctl --help
2.4 Mining
bchd supports the getblocktemplate
RPC.
The limited user cannot access this RPC.
1. Add the payment addresses with the miningaddr
option.
[Application Options]
rpcuser=myuser
rpcpass=SomeDecentp4ssw0rd
miningaddr=12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
miningaddr=1M83ju3EChKYyysmM2FXtLNftbacagd8FR
2. Add bchd's RPC TLS certificate to system Certificate Authority list.
cgminer
uses curl to fetch data from the RPC server.
Since curl validates the certificate by default, we must install the bchd
RPC
certificate into the default system Certificate Authority list.
Ubuntu
- Grant root privileges:
# sudo su -
- Copy rpc.cert to /usr/share/ca-certificates:
# cp /home/{USER}/.bchd/rpc.cert /usr/share/ca-certificates/bchd.crt
- Add "bchd.crt" to /etc/ca-certificates.conf:
# echo bchd.crt >> /etc/ca-certificates.conf
- Update the CA certificate list:
# update-ca-certificates
3. Set your mining software url to use https.
$ cgminer -o https://127.0.0.1:8334 -u rpcuser -p rpcpassword
3.1 Startup
Typically bchd will run and start downloading the block chain with no extra
configuration necessary, however, there is an optional method to use a
bootstrap.dat
file that may speed up the initial block chain download process.
3.1.1 bootstrap.dat
3.1.2 Network Configuration
- What Ports Are Used by Default?
- How To Listen on Specific Interfaces
- How To Configure RPC Server to Listen on Specific Interfaces
- Configuring bchd with Tor
- Configuring bchd with CIFS
3.1 Wallet
bchd was intentionally developed without an integrated wallet for security reasons. Please see bchwallet for more information.
- The gcash Bitcoin Cash-related Go Packages:
- pcclient - Implements a robust and easy to use Websocket-enabled Bitcoin JSON-RPC client
- btcjson - Provides an extensive API for the underlying JSON-RPC command and return values
- wire - Implements the Bitcoin wire protocol
- peer - Provides a common base for creating and managing Bitcoin network peers.
- blockchain - Implements Bitcoin block handling and chain selection rules
- blockchain/fullblocktests - Provides a set of block tests for testing the consensus validation rules
- txscript - Implements the Bitcoin transaction scripting language
- bchec - Implements support for the elliptic curve cryptographic functions needed for the Bitcoin scripts
- database - Provides a database interface for the Bitcoin block chain
- mempool - Package mempool provides a policy-enforced pool of unmined bitcoin transactions.
- bchutil - Provides Bitcoin-specific convenience functions and types
- chainhash - Provides a generic hash type and associated functions that allows the specific hash algorithm to be abstracted.
- connmgr - Package connmgr implements a generic Bitcoin network connection manager.