Skip to content

Latest commit

 

History

History
134 lines (93 loc) · 4.91 KB

File metadata and controls

134 lines (93 loc) · 4.91 KB

Installation and Local Setup Guide

Requirements

To develop and run this project locally, ensure you have the following tools installed.

  1. Rust.
  2. Bitcoin.
  3. CometBFT.

Project Execution Steps

Setup Bitcoin Node & Run in Regtest Mode

  1. Ensure you have the bitcoind and bitcoin-cli binaries either compiled from source or downloaded.
  2. We need to create a bitcoin.conf file, regtest configuration file. You can find the details below.
  datadir=[FolderPath/Bitcoin/]
  regtest=1
  rpcuser=test123
  rpcpassword=test123
  server=1
  txindex=1
  fallbackfee=0.00001
  1. Run the bitcoin in regtest using below command.
./bitcoind -conf="{folder_path}/Bitcoin/bitcoin.conf"
  1. Create Wallet.
 ./bitcoin-wallet -chain=regtest -wallet=mywallet -datadir="{folder_path}/Bitcoin/" create
  1. Load wallet.
./build/src/bitcoin-cli -rpcport=18443 -rpcuser=test123 -rpcpassword=test123 loadwallet "mywallet"
  1. Mine block using bleow command.
 ./build/src/bitcoin-cli -rpcport=18443 -rpcuser=test123 -rpcpassword=test123 -generate 200

Setup MacBeth Node

To run a local federation, we may need to operate multiple nodes, which include both a bitcoin server and a reth node. Each node must be configured individually for proper operation.Please note that federation on reth node consists of at least two federation members.

  1. create two folder in your home directory Node0 and Node1 as shown below
 mkdir -p ~/federation/node0/ ~/federation/node1/
  1. Create a file named federation.toml and copy the contents of the Federational.Toml file and save it Node0 and Node1 folders. Which contains federation members keys.

  2. Create .env inside project macbeth folder and add below env config.

cd ~/macbeth
 BITCOIND_NETWORK=regtest
 BITCOIND_URL=http://localhost:18443
 BITCOIND_USER=test123
 BITCOIND_PWD=test123


 NODE_1_DIR= {folder_path}/federation/node0
 NODE_2_DIR= {folder_path}/federation/node1
  • Ensure that you provide the correct path for the federation/node0 directory that was previously created in NODE_1_DIR & NODE_2_DIR, along with the Bitcoin RPC username, RPC password, and Bitcoin port.
  1. Now we need to start 2 btcoin-server-client below is command, make sure you execute below command in two separate terminal.
  make start-btc-server-1
  make start-btc-server-2
  1. We need to start 2 reth server below is command. make sure you execute below command in two separate terminal.
 make start-poa-server-1
 make start-poa-server-2

Note: Make sure 2 btc-server running properly and conncected to bitcoind regtest node & make sure 2 reth node is running and established the connection by participating signature sharing. For more env variable details and for clearing db refer macbeth MakeFile.

Setup CometBFT Node

We will be running two CometBFT nodes that will synchronize with each other via peer-to-peer communication and connect to an reth ABCI client.

  1. Ensure you have the 'cometbft' binaries either compiled from source or downloaded.
  2. Using below code which create 2 nodes node0 and node1 with config and genesis file.
./build/cometbft testnet --o {directory_path} --v 2
  1. After creating cometbft nodes, we must update cometbft config files of both node as mention below.
node0 node1
config.toml config.toml
proxy_app = "tcp://127.0.0.1:26658" proxy_app = "tcp://127.0.0.1:36658"
laddr = "tcp://127.0.0.1:26657" laddr = "tcp://127.0.0:36657"
allow_duplicate_ip = true allow_duplicate_ip = true
under[p2p] = laddr = "tcp://0.0.0.0:26656", under[p2p] = laddr = "tcp://0.0.0.0:36656"
persistent_peers = "{node_id_0}@127.0.0.1:26656, persistent_peers = {node_id_0}@127.0.0.1:36656"
{node_id_1}@127.0.0.1:36656" {node_id_1}@127.0.0.1:36656"
  1. Run the two nodes using the command below and ensure that their block heights are synchronized.
./build/cometbft --home={{folder_path}}/node0 start

./build/cometbft --home={folder_path}/testnet/node1 start

Note: Make sure all the 6 nodes with bitcond in regtest are running and producing empty blocks with proper heights.