> For the complete documentation index, see [llms.txt](https://docs.boom.market/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.boom.market/nodes/nodes.md).

# Nodes

## System Requirements and Prerequisites

Before starting, ensure you have the following (recommended):

* Hyperledger Besu installed on your machine. [Installation Guide](https://besu.hyperledger.org/private-networks/get-started/install).
* Java 17 or higher.
* RAM: 8GB
* Storage: 750GB

## Install Besu

<details>

<summary><strong>Prerequisites</strong></summary>

There are [multiple methods](https://besu.hyperledger.org/private-networks/get-started/install) for installing Hyperledger Besu ( from source [binary](https://github.com/hyperledger/besu/releases) or Docker image).

Install java JDK 17+ (If not installed, check: \`java -version\`).

```bash
apt install openjdk-17-jre-headless
```

```bash
apt install libjemalloc-dev unzip
```

</details>

<details>

<summary>Download Besu</summary>

You can download the latest version of Hyperledger Besu from the [official releases page](https://github.com/hyperledger/besu/releases) : [packaged binaries](https://github.com/hyperledger/besu/releases).

```bash
wget https://hyperledger.jfrog.io/artifactory/besu-binaries/besu/24.1.1/besu-24.1.1.zip
```

Once downloaded, extract the archive to a directory.

```bash
unzip besu-24.1.1.zip
```

Change into the besu- directory.

```bash
cd besu-24.1.1/
```

To confirm installation:

```bash
bin/besu --help
```

```bash
bin/besu --version
```

To run besu as a command go to .bashrc.

```bash
nano .bashrc
```

Add this line:

```bash
export PATH=$PATH:/pathTO/besu-24.1.1/bin
```

```bash
source .bashrc
```

Verify:

```bash
besu --help
```

```bash
besu --version
```

</details>

## Get Started

<details>

<summary>Initialize Node Directories</summary>

1. Create a directory

```bash
mkdir -p network/node1/data
```

```bash
cp network/node1/data
```

2. Generate a Node Key for the New Node

```bash
besu --data-path=data public-key export --to=data/key.pub
```

</details>

### Copy the Genesis File

The new node needs to be initialized with the same genesis file as the rest of the network. Copy the `genesis.json` file.

```bash
cd network/node1
```

{% tabs %}
{% tab title="Testnet" %}
Download the Testnet `genesis.json` file.

{% file src="/files/yrAI5AAHrYlETJPqLlOg" %}
Testnet Genesis
{% endfile %}
{% endtab %}

{% tab title="Mainnet" %}
Download the Mainnet `genesis.json` file.

{% file src="/files/UJEZ5u62AHxfNPV4ZKTI" %}
Mainnet Genesis
{% endfile %}
{% endtab %}
{% endtabs %}

### Create `config.toml` Configuration Files&#x20;

```bash
cd network/node1
nano config.toml 
```

{% tabs %}
{% tab title="Testnet" %}
{% code title="Exemple of Configuration" %}

```toml
# Valid TOML config file
data-path="data" # Path
#static-nodes-file="data/static-nodes.json"

# Network
bootnodes=["enode://23b6a539306cc1f3a61230e3253cebf9b6cad37fa045954fe27cef265ab232329456c786d16d6c132eaf957b75f5e87629ec7e6a7aa271e9c346b2cde2e0a4d0@95.111.219.167:30301"]
#p2p-host="0.0.0.0"
p2p-port=30305
max-peers=42
host-allowlist=["*"]

[sync]
#sync-mode="X_SNAP" # Enables Snap sync

logging="DEBUG"

min-gas-price=0

revert-reason-enabled=true

rpc-http-enabled=true
#rpc-http-host="0.0.0.0"
rpc-http-port=22005
rpc-http-cors-origins=["*"]
rpc-http-api=["ADMIN", "ETH", "NET", "WEB3", "QBFT"]

#rpc-ws-host="0.0.0.0"
rpc-ws-enabled=true
rpc-ws-port=32005
rpc-ws-api=["ADMIN", "ETH", "NET", "WEB3", "QBFT"]

# Chain
genesis-file="genesis.json" # Path to the custom genesis file
```

{% endcode %}
{% endtab %}

{% tab title="Mainnet" %}
{% code title="Exemple of Configuration" %}

```toml
# Valid TOML config file
data-path="data" # Path
#static-nodes-file="data/static-nodes.json"

bootnodes=["enode://39f394a6c9bec694d2c7dc5b1c5b20611fbfb9212a5f75c28febdff92eb290ea7ec1c5a3873d7e14a32ec3bc7072f52ef4dfbf9c7387c8315b9d3a5b48e981df@94.237.66.224:30301"]
#p2p-host="0.0.0.0"
p2p-port=30306
max-peers=42
host-allowlist=["*"]

logging="ALL"

min-gas-price=0

revert-reason-enabled=true

rpc-http-enabled=true
rpc-http-host="0.0.0.0"
rpc-http-port=22006
rpc-http-cors-origins=["*"]
rpc-http-api=["ETH", "NET", "WEB3", "QBFT", "DEBUG", "TRACE", "TXPOOL"]

rpc-ws-host="0.0.0.0"
rpc-ws-enabled=true
rpc-ws-port=32006
rpc-ws-api=["ETH", "NET", "WEB3", "QBFT", "DEBUG", "TRACE", "TXPOOL"]


# Chain
genesis-file="genesis.json" # Path to the custom genesis file

```

{% endcode %}
{% endtab %}
{% endtabs %}

<details>

<summary>Configuration with <code>static-nodes.json</code></summary>

Sync your node using static-nodes

Uncomment in the configuration file the following line  :

{% code overflow="wrap" %}

```toml
static-nodes-file="data/static-nodes.json"
```

{% endcode %}

```bash
cd network/node1/data
```

Create a `static-nodes.json` file with the following content :&#x20;

{% code title="For Testnet" overflow="wrap" %}

```json
[
  "enode://23b6a539306cc1f3a61230e3253cebf9b6cad37fa045954fe27cef265ab232329456c786d16d6c132eaf957b75f5e87629ec7e6a7aa271e9c346b2cde2e0a4d0@95.111.219.167:30301"
]
```

{% endcode %}

{% code title="For  Mainnet" overflow="wrap" %}

```json
[
  "enode://39f394a6c9bec694d2c7dc5b1c5b20611fbfb9212a5f75c28febdff92eb290ea7ec1c5a3873d7e14a32ec3bc7072f52ef4dfbf9c7387c8315b9d3a5b48e981df@94.237.66.224:30301"
]

```

{% endcode %}

</details>

### Start Node

```bash
besu --config-file=config.toml
```

### Run as a Service

<details>

<summary>Simple service</summary>

```
sudo adduser --system --no-create-home --group besu
sudo chown -R besu:besu /path/to/NodeDirectory
```

Create a service file for each node in `/etc/systemd/system/.`

```bash
sudo nano /etc/systemd/system/besu.service
```

```bash
[Unit]
Description=Hyperledger Besu Ethereum Node
After=network.target

[Service]
Type=simple
User=besu
Group=besu
WorkingDirectory=/path/to/Node1
ExecStart=/path/to/besu-24.1.1/bin/besu --config-file /path/to/Node1/config.toml
KillMode=process
KillSignal=SIGINT
TimeoutStopSec=90
Restart=on-failure
RestartSec=100

[Install]
WantedBy=multi-user.target
```

Reload the systemd daemon:

```bash
sudo systemctl daemon-reload
```

**Start and enable the service**:

```bash
sudo systemctl enable besu
sudo systemctl start besu
sudo systemctl status besu
```

Verify the status service:

```bash
journalctl -fu besu
sudo journalctl -f -u besu.service -o cat
sudo journalctl -f -u besu.service -o cat | ccze -A
```

If the ports are already used on the local machine.

Check:

```bash
sudo netstat -tulpn | grep LISTEN
```

Stop them if you can:

```bash
kill <PID>  or kill -9 <PID> (to force)
```

And restart the service:

```bash
sudo systemctl restart besu
```

</details>

<details>

<summary>Confirm the node is running</summary>

We can call the JSON-RPC API methods to confirm the node is running. [`eth_syncing`](https://besu.hyperledger.org/public-networks/reference/api#eth_syncing) return the synchronization status : returns the starting, current, and highest block, or `false` if not synchronizing (or if the head of the chain has been reached).

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":51}' http://127.0.0.1:22005
```

</details>
