# Installation

## **Requirements** <a href="#software-requirements" id="software-requirements"></a>

### Hardware

* Recommended 4 CPUs *(minimum 2)*
* Recommended 16GB Memory *(minimum 8)*

{% hint style="info" %}
Translated to [EigenLayer Node Classes](https://docs.eigenlayer.xyz/eigenlayer/operator-guides/eigenlayer-node-classes), we recommend using a **General Purpose XL** node class
{% endhint %}

### Software

* Docker
* Blockchain Web RPC Provider *(i.e. Quicknode or your own custom endpoint)*

### Private Keys

* A private key representing your operator node

### Network Ports

* Port `10000` is used for the inspection interface
* Port `20000` is used for P2P communication
* Port `30000` is used for the Management API

{% hint style="info" %}
Depending on host provider and network setup, you may choose to remap external points to these internal ones.

For example, if your server's external IP is `1.2.3.4`, you can choose to map port `80` on that external IP to port `10000` of your server's internal IP.
{% endhint %}

## Quick Setup

Venn's node client software is called **BlockBeat**.

Written in GoLang, and released as a Docker image, BlockBeat provides unparalleled performance internally, while keeping **Operator Experience** in mind for easy setup and maintenance.<br>

Simply copy and paste the following command in your terminal:

{% code title="get-venn.sh" overflow="wrap" fullWidth="false" %}

```sh
curl "https://storage.googleapis.com/venn-engineering/get-venn.sh" | bash -s my-venn-operator
```

{% endcode %}

This script will:

1. Create a new folder named `my-venn-operator`
2. Create a `Makefile` with helper commands to start, stop, update, and test your node
3. Create a `config.yaml` file in that folder with recommended defaults to get started
4. Create a `protocols.yaml` file in that folder, with whitelisted protocols your node will be allowed to inspect
5. Create a `test-tx.json` file in that folder, which is used for locally validating your node's basic setup

{% hint style="warning" %}
During Venn's testnet phase, only these whitelisted protocols will be inspected.\
\
See [Testnet Guide](https://docs.venn.build/venn-network/getting-started/node-operators/testnet-guide) for more info.
{% endhint %}

After running this script, you should see the following output:

<figure><img src="https://3846821720-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzXHI30GOto7mKwe9T56F%2Fuploads%2Fpblp7lzZEgk2zCMb320J%2Fimage.png?alt=media&#x26;token=9108ff61-9dea-4e98-8369-06083d8eb435" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Make sure to update `config.yaml` with your `Private Key` and `Web3 Provider` URLs&#x20;
{% endhint %}

### First Run

After adding your `Private Key` and `Web3 Provider` URLs to `config.yaml`, run the following command to start the node:

```sh
make venn-start
```

{% hint style="warning" %}
Running this command will start the BlockBeat docker image in foreground, streaming all logs to the terminal, as well as capturing the logs in the `operator.log` file.\
\
This mode is intended for testing purposes only.\
Running this mode in a production environment may result in `operator.log` growing beyond the system's available size, causing various issues.\
\
**For production environments, make sure to run BlockBeat in the background**.
{% endhint %}

### Testing

Now that you have a node running, let's test it by sending it a test transaction to inspect.\
Run the following command in a new terminal window:

```sh
make venn-test
```

This will trigger a test transaction to your local node, and you should see output similar to the following:

{% code overflow="wrap" lineNumbers="true" %}

```json
{
  "requestId": "1dd1ada2-f515-46dd-9a2a-fb55200927f1",
  "approved": true,
  "signature": {
    "x": "0x14a975d4905b39ce015a7ac7694420ca12fa0899053b949fe4f8d209fb568f01",
    "y": "0x26da9f44b2767939945d07ad9af70b7964fb5e82e299e905a8d8952978e7f71c"
  },
  "metadata": [
    {
      "operator": "my-venn-operator/a80cab03a3e9",
      "approved": true,
      "signature": {
        "x": "0x14a975d4905b39ce015a7ac7694420ca12fa0899053b949fe4f8d209fb568f01",
        "y": "0x26da9f44b2767939945d07ad9af70b7964fb5e82e299e905a8d8952978e7f71c"
      }
    }
  ]
}
```

{% endcode %}

{% hint style="success" %}
Success!

Our test transaction is approved by Venn, and our node setup verification is complete.
{% endhint %}

## What's in the box?

### config.yaml

A basic node operator configuration file.

{% code title="config.yaml" lineNumbers="true" %}

```yaml
venn:
  name: my-venn-operator

signer:
  signerPrivateKey: YOUR PRIVATE KEY HERE

detectors:
  detectionThreshold: 0.5
  detectors:
    - name: venn-testnet
      endpoint: http://detectors2.testnet.venn.build/services/detection/detect
      weight: 1

nodes:
  - chainId: 1
    nodes:
      - wsUrl: YOUR WEB-SOCKET PROVIDER URL HERE
        jsonUrl: YOUR HTTP PROVIDER URL HERE

protocolsFile: "/bb/protocols.yaml"

```

{% endcode %}

* `name` - can be anything you like, and will be used for identifying your node on the network, along with a unique-id that is auto-generated for you by BlockBeat<br>
* `signerPrivateKey` - this is the key that represents your node on the Venn Network, which signs inspections results for transactions processed by your node<br>
* `nodes` - the chains, blockchain nodes, and their respective Web3 Provider URLs. Multiple nodes can be configured per chain for redundancy, ensuring high-availability for your Venn node.<br>
* `detectors` - these are the threat modeling mechanisms that the node uses to scan and analyze incoming transactions. During the current testnet phase, we recommend using Venn's external detector.<br>
* `protocolsFile` - this is used during our current testnet phase to indicate which assets are protected by the node. Once Venn goes live on mainnet, this field will be deprecated in favor of an on-chain protocol-registration mechanism

{% hint style="info" %}
See [Configuration](https://docs.venn.build/venn-network/getting-started/node-operators/configuration) for more info
{% endhint %}

### Makefile

Used as a helper file to start, stop, test, and update BlockBeat.

{% hint style="info" %}
Using a Makefile is optional.\
Feel free to use any other method that is best suited for you and your team for running these shell commands
{% endhint %}

{% code title="Makefile" lineNumbers="true" %}

```makefile
# Just some configs for easier Docker wrangling
#
VERSION ?= latest
IMAGE_NAME = us-docker.pkg.dev/ironblocks/images/blockbeat:$(VERSION)
PORT_MAPPING = -p 10000:10000 -p 20000:20000 -p 30000:30000
CONTAINER_NAME = venn-operator
ENV_CONFIG_FILE = /bb/config.yaml
CONFIG_FILE_PATH = $(PWD)/config.yaml
PROTOCOLS_FILE_PATH = $(PWD)/protocols.yaml

# Default value for "background" is false
background ?= false

# Start the Venn node
#
# If "background" is set to true, the container will run in the background
# Otherwise,the container will run in the foreground and logs will be printed to stdout and captured into "operator.log"
venn-start:
	@if ! command -v docker > /dev/null; then \
		echo "Docker is not installed. Please install Docker first."; \
		exit 1; \
	fi
ifeq ($(background), true)
	docker run -d --rm \
		--name $(CONTAINER_NAME) \
		$(PORT_MAPPING) \
		-v $(CONFIG_FILE_PATH):/bb/config.yaml \
		-v ${PROTOCOLS_FILE_PATH}:/bb/protocols.yaml \
		-e CONFIG_FILE=$(ENV_CONFIG_FILE) \
		$(IMAGE_NAME)
else
	docker run -it --rm \
		--name $(CONTAINER_NAME) \
		$(PORT_MAPPING) \
		-v $(CONFIG_FILE_PATH):/bb/config.yaml \
		-v ${PROTOCOLS_FILE_PATH}:/bb/protocols.yaml \
		-e CONFIG_FILE=$(ENV_CONFIG_FILE) \
		-e ENV=dev \
		$(IMAGE_NAME) \
		| tee operator.log
endif

# Run a test transaction on the Venn node
#
venn-test:
	@if command -v jq > /dev/null; then \
		curl -X POST -H "Content-Type: application/json" -d @test-tx.json http://localhost:10000/signer | jq; \
	elif command -v python3 > /dev/null; then \
		curl -X POST -H "Content-Type: application/json" -d @test-tx.json http://localhost:10000/signer | python3 -m json.tool; \
	else \
		curl -X POST -H "Content-Type: application/json" -d @test-tx.json http://localhost:10000/signer; \
	fi

# Stop a running Venn node
#
venn-stop:
	docker stop $(CONTAINER_NAME)

# Update to the latest version of the Venn client software
#
venn-update:
	docker pull us-docker.pkg.dev/ironblocks/images/blockbeat:${VERSION}

```

{% endcode %}

### test-tx.json

A simple test transaction you can use to make sure everything is up and running.

{% hint style="info" %}
This transaction interacts with protocols that were whitelisted for Venn testnet phase.\
Once Venn goes live, and protocol whitelisting will be deprecated, you will be able to test your setup with any transaction data.
{% endhint %}

{% code title="venn-test-tx.json" lineNumbers="true" %}

```json
{
    "from": "0xfE6BB1654227fA21b8A65A6A89F6489fc3CC2fcD",
    "to": "0x47Ddb6A433B76117a98FBeAb5320D8b67D468e31",
    "data": "0xf2fde38b00000000000000000000000004b26cc3b326c22b4ed307c550296d102c23a06c",
    "value": "0x0",
    "gasPrice": "0x45574C259",
    "gas": "0xDA31",
    "blockNumber": "0x12CE79E",
    "chainId": 1
}
```

{% endcode %}

## Running In Production

To run BlockBeat in production, run the following command:

```sh
make venn-start background=true
```

{% hint style="info" %}
This runs the BlockBeat Docker image in the background, without streaming the output logs, and without writing logs to the `operator.log` file.

\
See [Monitoring](https://docs.venn.build/venn-network/getting-started/node-operators/monitoring) for more information
{% endhint %}
