# For DePIN/Validator Node provider

#### Prerequisites

Before you begin, ensure you have the following

* **Docker** (version 23.0.0 or above, refer: <https://docs.docker.com/desktop/install/linux-install/>)
* **Instance** comparable to a t2 micro (1 vcpu, 1GB RAM and 5GB harddisk)

## Running your Watchtower client

There are two aspects in setting up the watchtower,

* Registration: so the challengers are aware of it
* Running: so the challengers can engage with it

Here's how to get the watchtowers successfully running&#x20;

### <mark style="color:red;">Key Points to consider before proceeding...</mark>

1. **Ports to be opened if using public IP:**&#x20;

```
Incoming ports to be opened (TCP & UDP ):

11112
22223
33334
33335
33336
44445
44446
44447
55556

Outgoing ports: Allow all
```

## Setting up the Watchtower

You can provide the private key (for example, generated from Metamask) which will be used by the Witnesschain's PoL  Watchtower client.

{% hint style="success" %}
Use ECDSA Keypairs
{% endhint %}

### Registering the Watchtower Key

Download and install the *witness CLI:*

```bash
curl -sSfL https://witnesschain-com.github.io/install-dcl-cli | bash
```

After the installation is completed, verify the cli is installed correctly and upto date  ( WitnessChain version v0.0.12)<br>

`witness-cli --version`

Then proceed to register your watchtower key on WitnessChain's  Layer 2 Chain: Use the KeyPair that you would have exported or created using Metamask or any other wallet.

<pre class="language-bash"><code class="lang-bash"><strong>witness-cli registerWatchtower --mainnet --watchtower-private-key &#x3C;your-watchtower-private-key-without-0x-prefix>
</strong></code></pre>

{% hint style="info" %}
**Why should I register?**

Registration helps with identification of your watchtower inside Witness Chain's watchtower network
{% endhint %}

### Setting up the Watchtower keys and the config file

1. You can pass the required configuration to the docker container env via a file or directly with `-e` flag in the run command [(read more)](https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/). Prepare a configuration file `watchtower.env` with the following entries as example shown below:

```bash
latitude=37.01511676489697
longitude=-79.0392271449855
radius=1000
privateKey=<my_super_secret_private_key>
walletPublicKey=<my_open_public_address>
keyType=ethereum
saveResultsInDatabase=false
submitResultsToContract=true
rpcUrl=https://rpc.witnesschain.com
projectName=<my_DePIN_project_name/my_validator_network_name>
```

{% hint style="info" %}
**Latitude** and **Longitude** are optional. If not provided, they will be automatically determined based on the approximate location of the IP address. However it's recommended to be set for better accuracy.
{% endhint %}

**Explanation:**

* ```
   
      "latitude": 37.015, // Required. Latitude of the machine running the challenger client
      "longitude": -79.039, // Required. Longitude of the machine running the challenger client
      "radius": 1000 // Required. Range in KM
      
  ```
* `privateKey` is your PoL signing key (Watchtower Key)
* `walletPublicKey` is the PoL watchtower address (eth address)&#x20;
* `havePublicIPv4Address` (and `havePublicIPv6Address`) set them to **true** if you have a public IPv4 (or IPv6)&#x20;
* `havePrivateIPv4Address` (and `havePrivateIPv6Address`) set them to **true** if you want to force the use of private IP
* `saveResultsInDatabase` saves the login, session, and challenge related data in a `.sqlite` file within the container
* `projectName` tags the watchtower with the project - examples include "spheron", "akash", "pingpong", "eigenlayer", etc. This is an optional field

### 3. Running the watchtower

Once you have the `watchtower.env` ready, the watchtower client can be started with

```sh
docker run -d \
  --network=host \
  --name pol-watchtower \
  --env-file ./watchtower.env \
  witnesschain/infinity-watch:1.0.2
```

\
you can verify that the challenger is running by looking at the container status

```sh
docker ps 
```

**Explanation**:

* `docker run -d`: Runs the container in detached mode (in the background).
* ```
  --network=host
  Uses the host's network stack.
  ```
* ```
  --name pol-watchtower
  Names the container as 'pol-watchtower'.
  ```
* ```
  witnesschain/infinity-watch:1.0.2 The name of the Docker image to run.
  ```

\
you can verify that the watchtower is running by looking at the container status<br>

```sh
docker ps 
```

## Post Setup

Once the setting up and registration is successful, you can check the logs from the watchtower client ready for challenges. (`docker logs -f pol-watchtower`). Congratulations, you are now a part of our Infinity watch family!<br>

## Troubleshooting

As the only prerequisite is docker, make sure you are running atleast version 23.0.0 or above for the commands mentioned in the doc to work. \
\
The days might be rainy or snowy, but we've got umbrellas and sweaters!\
Join our [Discord](https://discord.gg/Y9Eu2U5s) or Telegram—we're happy to help. :D


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.witnesschain.com/infinity-watch/proof-of-location-mainnet/run-a-watchtower/for-depin-validator-node-provider.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
