# Running Watchtower: for DePIN/Validator Node provider

The PoL Challenger Client Node is a DePIN Challenger node that participates in the PoL (Proof-of-Location) protocol and measures the location claims made by a DePIN Prover.

PoL Challenger Client Nodes can be run on community members’ laptops, desktops or even on cloud instances. As long as the node is running, there is a probabilistic algorithm (based on stake in the upcoming releases) that determines if the node will participate in a PoL challenge from the network.&#x20;

Before a node can participate as PoL Challenger, it has to prove it's own capabilities (run a prover to prove it's own location - this mechanism is inbuilt in the challenger client container)

#### 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**), though we recommend 2 cores, 4 GB RAM and 10 GB of storage.<br>

## Running your Challenger client

{% hint style="info" %}
Explorer: <https://blue-orangutan-blockscout.eu-north-2.gateway.fm/>&#x20;

Our chain is gasless, so you do **NOT** have to fund either or the operator or challenger account with tokens.
{% endhint %}

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

{% hint style="warning" %}
Note: For **EigenLayer** operators, it's important to maintain the distinction between Operator Key and Challenger Key. Refer the correct docs for setup as an EL operator [here](https://docs.witnesschain.com/infinity-watch/proof-of-location-mainnet/run-a-watchtower/eigenlayer-operators/running-a-pol-watchtower)
{% endhint %}

1. Generate a **dedicated watchtower key - ECDSA KeyPair** ( This [video](https://www.youtube.com/watch?v=ke9j2wuYhPE) demonstrates how you can use MetaMask to export one ). This will be used for registration & signing purposes.&#x20;
2. **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
```

### 1. 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, 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 --testnet --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 %}

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

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

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
country=US
region=Virginia
city=Ashburn
radius=1000
privateKey=<my_super_secret_private_key>
walletPublicKey=<my_open_public_address>
keyType=ethereum
saveResultsInDatabase=false
submitResultsToContract=true
rpcUrl=https://blue-orangutan-rpc.eu-north-2.gateway.fm
projectName=<my_DePIN_project_name/my_validator_network_name>
```

\
**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
      
      "country": "US", // Optional. Country in which the machine is located
      "region": "Virginia", // Optional. State/Region in which the machine is located
      "city": "Ashburn", // Optional. City in which the machine is located
      "radius": 1000 // Optional. Accuracy in meters
      
  ```
* `privateKey` is your PoL signing key (Watchtower/Challenger Key)
* `walletPublicKey` is the wallet addresses where your contributions go&#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/pol-multiclient:0.4-alpha
```

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

```sh
docker ps 
```

**Explanation**:

1. `docker run -d`: Runs the container in detached mode (in the background).
   * ```
     --network=host
     Uses the host's network stack.
     ```
   * ```
     --name pol-challenger
     Names the container as 'pol-challenger'.
     ```
   * ```
     --env-file ./watchtower.env
     The container's environment is set using the attributes specified in 'watchtower.env' file
     ```
   * ```
     witnesschain/pol-multiclient:0.4-alpha: The name of the Docker image to run.
     ```

{% hint style="danger" %}
You may observe the following errors in the docker container&#x20;

"registration is required on DCL contract. Please register your challenger publicKey:"

Don't worry, this is normal. if you [COMPLETE STEP 1](#id-1.-registering-the-challenger-key), these logs should disappear
{% endhint %}

## Post Setup

Once the setting up and registration is successful, you can check the logs from the challenger client ready for challenges. (`docker logs pol-challenger`). Congratulations, you are now a part of our DePIN family!

## 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 reach out to us over Telegram—we're happy to help. :D
