To develop and run this project locally, ensure you have the following tools installed.
- Ensure you have the
bitcoindandbitcoin-clibinaries either compiled from source or downloaded. - We need to create a
bitcoin.conffile, 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
- Run the bitcoin in regtest using below command.
./bitcoind -conf="{folder_path}/Bitcoin/bitcoin.conf"
- Create Wallet.
./bitcoin-wallet -chain=regtest -wallet=mywallet -datadir="{folder_path}/Bitcoin/" create
- Load wallet.
./build/src/bitcoin-cli -rpcport=18443 -rpcuser=test123 -rpcpassword=test123 loadwallet "mywallet"
- Mine block using bleow command.
./build/src/bitcoin-cli -rpcport=18443 -rpcuser=test123 -rpcpassword=test123 -generate 200
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.
- create two folder in your home directory
Node0andNode1as shown below
mkdir -p ~/federation/node0/ ~/federation/node1/
-
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.
-
Create
.envinside 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/node0directory that was previously created inNODE_1_DIR& NODE_2_DIR, along with the Bitcoin RPC username, RPC password, and Bitcoin port.
- 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
- 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.
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.
- Ensure you have the 'cometbft' binaries either compiled from source or downloaded.
- Using below code which create 2 nodes
node0andnode1with config and genesis file.
./build/cometbft testnet --o {directory_path} --v 2
- 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" |
- 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.