This software is deprecated please see https://github.com/LayerTwo-Labs/bip300301_enforcer for the new version
Mainchain is an implementation of Bitcoin that extends it with Drivechain capabilities.
Drivechain allows Bitcoin to create, delete, send BTC to, and receive BTC from “Layer-2”s called “sidechains”. Sidechains are Altcoins that lack a native “coin” – instead, BTC must first be sent over.
BIP 300: https://github.com/bitcoin/bips/blob/master/bip-0300.mediawiki
BIP 301: https://github.com/bitcoin/bips/blob/master/bip-0301.mediawiki
Learn more about Drivechain here: http://drivechain.info
For an example sidechain implementation, see: https://github.com/LayerTwo-Labs/testchain
Mainchain is built and released for Linux, macOS and Windows. The only supported
way of building Mainchain is through cross-compiling from Linux. If you only want
to build node binaries, you can disable building the UI through passing NO_QT=1
to the make -C ./depends
call. If the build crashes unexpectedly, try reducing
the amount of concurrency by removing the -j
parameter.
These instructions have been tested with Ubuntu 20.04 (Focal).
# install build dependencies
$ sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3
# compile dependencies
$ make -C ./depends -j
# Compile binaries
$ ./autogen.sh
$ export CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site
$ ./configure
$ ./make -j
# binaries are located in src/drivechaind, src/drivechain-cli and src/qt/drivechain-qt
Building Mainchain requires a very old version of Ubuntu. A version that is known to work is 14.04 (Jerry). An old version of the macOS SDK is also required. For convenience, a Docker image is provided that has all the required build dependencies pre-installed. If you want to set up your local environment to match this, it is recommended to take a look at the Dockerfile that produced this image.
# start the Docker container that will build the binaries
$ docker run --rm -it \
--workdir /mainchain -v $PWD:/mainchain \
barebitcoin/mainchain-macos-builder bash
# from within the Docker container shell
# compile dependencies
$ make -C ./depends -j
# compile the binaries
$ export CONFIG_SITE=$PWD/depends/x86_64-apple-darwin11/share/config.site
$ ./autogen.sh
$ ./configure.sh
$ make -j
# binaries are located (on the host machine)
# at src/mainchaind, src/mainchain-cli and src/qt/mainchain-qt
These instructions have been tested with Ubuntu 20.04 (Focal).
# install dependencies
$ sudo apt install g++-mingw-w64-x86-64 \
build-essential libtool autotools-dev automake \
libssl-dev libevent-dev \
pkg-config bsdmainutils curl git \
python3-setuptools python-is-python3
# configure the Windows toolchain
$ sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
# compile dependencies
$ make -C ./depends HOST=x86_64-w64-mingw32 -j
# compile the binaries
$ export CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site
$ ./autogen.sh
$ ./configure.sh
$ make -j
# binaries are located at src/mainchaind.exe, src/mainchain-cli.exe and
# src/qt/mainchain-qt.exe
Bitcoin Core (and Drivechain) are released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT.