Installation
This step guides you to install and run all necessary components.
By default, all pages in this guide install the required repos and their dependencies using Docker. A single container called bitcoin-ipc downloads the bitcoin-ipc and ipc repos, installs dependencies and builds the repos, runs bitcoin-core , and runs ipc-cli . The bitcoin wallets and Bitcoin-IPC configuration files also live in the container. Nothing is installed on your local machine (apart from Docker). This is the simplest and the recommended option.
Alternatively, you can clone the repos bitcoin-ipc and ipc, and run bitcoin-core and ipc-cli on your local machine, but then you need to locally install all dependencies. This is setup is described in Alternative: Install on the host machine on this page, and all following pages contain an "Alternative" approach, which you need to follow if you opt for the alternative setup.
In both cases, the validator nodes will run in separate Docker containers on your host machine — the difference is that with the default option these containers will be started from inside the bitcoin-ipc container, while with the alternative option the containers will be started from your host machine.
All pages titled "Optional" describe ways to further parametrize this guide, or additional scripts that can give you more background information.
Background
The bitcoin-ipc repo
The bitcoinscalinglabs/bitcoin-ipc repo contains the following two binaries.
Monitor: It monitors the Bitcoin network for new blocks and transactions. It processes transactions with IPC-related data. It saves the data in a local database, configurable by the
DATABASE_URLenvironment variable.Provider: It exposes an HTTP endpoint with a JSON RPC to interact with Bitcoin, and reads data from the local database. It's primarily intented to be used by the ipc-cli, which we will introduce later. It listens on the port configurable by
PROVIDER_PORT, defaulting to 3030. It requires an Authorization header with a bearer token to be match the value ofPROVIDER_AUTH_TOKENenv var, defaulting to"validator1_auth_token".
The ipc repo
The bitcoinscalinglabs/ipc repo is a fork of the standard (Filecoin-based) IPC repo. It contains the consensus and execution engines used by Bitcoin-IPC validators, and a tool call ipc-cli, which helps validators and clients interact with subnets. For information about what ipc-cli is and how to use it, see the ipc docs.
Bitcoin Regtest network
This guide is using Regtest, a local Bitcoin chain created on your local machine (or in a Docker container).
Deployment instructions
Install Docker on your machine. This guide has been tested with Docker version 29.1.5. We recommend allowing Docker to use at least 12 GB of RAM.
Delete the
~/.ipcdirectory, if it exists (the directory is bind-mounted and auto-generated upon starting thebitcoin-ipccontainer).Download the bitcoinscalinglabs/bitcoin-ipc repo.
Run the
bitcoin-ipccontainer
The script starts a
Bitcoin Monitorand aBitcoin Providerinstance for four validators (these validators will later in this guide join Bitcoin-IPC subnets), with log files stored in/root/logs/in the container. See Optional: Helper scripts for more information on the log files.If in the future you need to delete the data generated in the container, you can run:
Attention, this will delete:
- All bitcoin regtest data
- All non-default Bitcoin-IPC and bitcoin accounts - All Bitcoin-IPC subnets
More information
The bitcoin-ipc container contains/runs:
Bitcoin Core in
regtestmode with the required configuration in/root/.bitcoin/bitcoin.conf.The required repos cloned in
/workspace/ipcand/workspace/bitcoin-ipc.The
ipc-clitool.Bitcoin wallets and IPC configuration (under
/root/.ipc/) for all 5 validators and 2 users, generated using thesrc/bin/quickstart.rsscript upon container creation — the/root/.ipc/container directory is bind-mounted to the~/.ipchost directory, for both technical and debugging purposes.The
monitorandproviderbinaries for each validator (validator1–validator5) and user (user1,user2), automatically started upon container creation (in thedocker-deploy-local/docker-entrypoint.shscript).The captured logs for each monitor and provider instance in the
/root/logs/directory inside the container.Sets the required environment variables for the demo (see
docker-compose.ymlin thebitcoin-ipcrepo).The script
/workspace/bitcoin-ipc/scripts/miner.shthat mines regtest blocks every 10 seconds (started automatically upon container creation).A script to quickly create, join, and fund a subnet in
/usr/local/bin/bootstrap_subnet_from_container.sh(not run automatically - we will use it in a following step).Scripts to spin up docker containers for the validator nodes of two subnets:
/usr/local/bin/spin_up_subnet_a_from_container.shand/usr/local/bin/spin_up_subnet_b_from_container.sh(not run automatically - we will use them in a following step).It exposes ports 3030-3034 and 3040-3041, where the Bitcoin provider instances of the validators and users are listening — these will be used by the Docker containers of each validators.
It persists bitcoin data (directory
/root/.bitcoin) and IPC data (directory/root/.ipc) to a Docker volume, so they survive restarts of the container).The host Docker socket (`/var/run/docker.sock`) is mounted into this container, so we can later build and run host-managed containers (i.e., the containers
cometbft,fendermint, andethapifor each validator) from inside this container.
More information about the bitcoin-ipc container can be found in the docker-deploy-local/README.md file of the bitcoin-ipc repo.
Alternative: Install on the host machine
If you follow this way to install the required repos, in all following steps you must run the commands on your host machine when the instructions ask to run them on the bitcoin-ipc container.
Before we start creating subnets, let's set up the necessary components.
We'll start by setting up a local Bitcoin Regtest network, setting up Bitcoin IPC components, and finally installing the IPC Client that supports Bitcoin.
Step 1: Install, configure, and start Bitcoin Core
Follow the installation instructions for your operating system provided on the Bitcoin Core download page.
To verify the installation: Open a terminal or command prompt and verify that bitcoind and bitcoin-cli are installed correctly:
Ensure that the Bitcoin data directory exists. The default locations for different operating systems are:
Create or edit the bitcoin.conf file in the Bitcoin data directory and add the following configuration to enable regtest, your own local network. The contents of the bitcoin.conf file should be:
You can replace user and pass with your desired username and password (in which case you will have to change these values for each validator and user of this demo — this documentation will guide you).
Start Bitcoin Core daemon:
To verify bitcoind is running:
The output should show the chain as regtest.
Step 2: Bitcoin-ipc repo
Install Rust
The project is build on Rust, do first we need to install it. For this, follow the official instructions. We require version at least 1.87.0.
To verify the Rust installation:
Download and build the bitcoin-ipc repo
In this step we will download and build the bitcoinscalinglabs/bitcoin-ipc repo. As we will explain, this contains the components that interact with the Bitcoin Network.
Add binaries to path
After building the project, both monitor and provider binaries are available in bitcoin-ipc/target/release directory. For ease of use let's add both binaries to our path:
By default, the monitor and provider read the .env file in the current directory. For a full list of env variables see the .env.example file. You can specify a different file by passing a relative path to the --env flag, like so: monitor --env=custom.env and provider --env=custom.env .
We do not need to run the monitor and provider yet, we will do so in a later step. When running for the first time, make sure to run the monitor before the provider, since the monitor will create the necessary database.
More details on the monitor and provider
The bitcoin monitor connects to a bitcoin chain (variables RPC_USER, RPC_PASS , RPC_URL , and WALLET_NAME in the .env file are used for this). It processes each confirmed block and searches it for IPC-related transactions, such as the creation of a new subnet, validators joining a subnet, sending funds to an L2 subnet, subnet checkpoint transactions, and so on. The monitor stores related information on a local database (variable DATABASE_URL ).
The bitcoin provider exposes RPC endpoints to obtain information about L2 subnets over bitcoin and to create bitcoin transactions for interacting with the subnets, such as create a new subnet, join an existing, transfer funds into and L2 subnet, create a checkpoint given an L2 state, and so on. Variables PROVIDER_PORT and PROVIDER_AUTH_TOKEN are used for this.
In this demo, both validators and users of L2 subnets run one instance of the monitor and one of the provider each. The bitcoin provider can also sign transactions on behalf of the callers, i.e., it functions as a bitcoin wallet. Specifically for validators, the bitcoin provider has access to the secret key of the validator, as it needs to sign bitcoin multisig transactions with it (variable VALIDATOR_SK_PATH is used for this).
With both monitor and provider installed, it's time to setup ipc-cli.
Step 3: IPC repo and ipc-cli
In this step we will download and build the bitcoinscalinglabs/ipc repo.
Download and build the ipc repo
Install the basic requirements for IPC:
Install system packages:
sudo apt install build-essential clang cmake pkg-config libssl-dev protobuf-compiler git curl.Install Rust. See instructions.
Install cargo-make:
cargo install --force cargo-make.Install Docker. See instructions.
Install Node.js. See instructions.
Install Foundry. See instructions.
Also install the following dependencies (details)
Install Xcode from App Store or terminal:
xcode-select --installInstall Homebrew. See instructions.
Install dependencies:
brew install jqInstall Rust. See instructions. (if you have homebrew installed rust, you may need to uninstall that if you get errors in the build)
Install Cargo make:
cargo install --force cargo-makeInstall docker. See instructions.
Install Node.js. See instructions.
Install foundry. See instructions.
Building the repo:
NOTE: this step may take a while to compile, depending on OS version and hardware build
After following the instructions, you should now have the following binaries available:
Add the binaries to path
For ease of use we can make aliases for these binaries. You can use
Build docker images
One final thing is to build the fendermint local docker image:
To verify the image is available:
Step 4: Generate wallets and config files
We provide a script that automates the setup for wallets and configuration files for five validators and two users.
Before running it:
Make sure that
~/.ipcdoes not exist. The script will not override it.
From within the bitcoin-ipc repo run:
If you changed the "rpcuser" and/or "rpcpassword" fields in Step 1: Install, configure, and start Bitcoin Core, then you need to update these values in the following files:
~/.ipc/validator1/.env~/.ipc/validator2/.env~/.ipc/validator3/.env~/.ipc/validator4/.env~/.ipc/validator5/.env~/.ipc/user1/.env~/.ipc/user2/.env
The script prints the the IPC address (aka ETH address) and the X-Only public key of each validator and user, as well as a whitelist consisting of the first four validators (to be used when creating a subnet).
In the following demo we will use the IPC address to identify users and validators in the L2 subnet, and the X-Only public key to identify validators on the bitcoin chain.
For ease of use, you can extract the IPC address and the whitelist into env variables:
The ~/.ipc directory should have the following structure:

~/.ipc directory after the quickstart script Step 5: Run Monitor and Provider for each validator
In this step we start the monitor and provider binaries, which we will use throughout the whole demo. Make sure every process is run in a separate terminal window/pane. Also make sure you are in the bitcoin-ipc repo and have run cargo build --release.
We are already starting the monitor and the provider for all validators and users. Some of them will be used in later steps of this demo. This is only done for convenience, it is also possible to start the monitor and provider for each validator later — at the latest before deploying the docker containers for that validator.
Validator 1
Validator 2
Validator 3
Validator 4
Validator 5
User 1
User 2
Last updated