# Execute the validator client

Please make sure you have [initialized the account](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/validator-operations/pages/hNaa0872paxM1cz2JFjs#id-1.-initiate-the-validator-account) and [configured the BTC RPC node](/guides-of-data-consensus/others/operation-references/common-operations/set-btc-rpc-node.md).

### **Simple Execution**

You can start the Validator Client with the following command:

```
yarn start-validator
```

Since the Validator Client requires the private key of the Validator account (encrypted in the keystore file) to sign the transactions, you need to provide the keystore file's password at runtime. There are many ways to input the password:

1. **Using the `--pwdFile` parameter**\
   Save the password in a file, then pass the file path using the `--pwdFile` parameter when starting the client.\
   For example, if the password `123456` is saved in `/home/exsat/password`, you can start the client with:

   ```bash
   yarn start-validator --pwdFile=/home/exsat/password
   ```
2. **Storing it in the `.env` file**\
   Save the keystore password directly in the `.env` file. For example:

   ```bash
   VALIDATOR_KEYSTORE_PASSWORD=123456
   ```

   Then directly start the Client：

   ```bash
   yarn start-validator
   ```
3. **Inputting it during runtime**\
   Simply run the Client:

   ```bash
   yarn start-validator
   ```

   The Client will prompt you to enter the keystore file password manually.

**Considerations**

* Options 1 and 2 expose the keystore password directly, making them less secure.
* Option 3 does not expose the password but requires manual input each time the client is restarted, which is complicated for auto execution.

Choose the password input method that best suits your security and operational requirements.

{% hint style="info" %}
While running the Client directly is straightforward, it is rarely used in practice. This is because processes running on Linux can sometimes be terminated by the system for various reasons. To ensure the Client runs continuously over an extended period, it is recommended to use tools that keep programs running in the background. Common tools for this purpose include **pm2** and **screen**.
{% endhint %}

### Using pm2

PM2 is a process manager for Node.js applications on Linux, allowing you to easily manage, monitor, and keep applications running in the background. You could execute below command to run the Validator client using pm2.

Please ensure that the password of the keystore is properly configured in the .env file by setting VALIDATOR\_KEYSTORE\_PASSWORD.

```
pm2 start ecosystem.config.js --only validator
```

### Using Screen

The `Screen` command in Linux allows you to run commands in the background, keeping them active even after you disconnect from the terminal session.&#x20;

You could execute below command to run the Validator client , and manully input the password of the keystore. This approach helps prevent your password from appearing in plain text in configuration files or command lines, reducing the risk of password exposure.

```
screen -R validator
yarn start-validator
#input the password
```

You can also start the Validator Client using Screen with the keystore password saved in a file or in the .env file. Take using `--pwdFile`parameter as an example:

```
screen -R validator
yarn start-validator --pwdFile=/root/.exsat/validator/password
```

### Execution verification

If your Validator Client is running correctly, the following logs should appear on your screen:

```
2025-02-28T12:25:23.325+00:00 info: ExsatApi initialized successfully.
2025-02-28T12:25:24.051+00:00 info: Validator[btcval.sat] client configurations are correct, and the startup was successful
2025-02-28T12:25:25.499+00:00 info: Endorse task is running
2025-02-28T12:25:26.158+00:00 info: Endorse task is finished
```

### View Logs

Refer to [this guide](/guides-of-data-consensus/others/operation-references/common-operations/view-logs.md) to learn how to save logs to file.


---

# 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.exsat.network/guides-of-data-consensus/others/operation-references/validator-operations/execute-the-validator-client.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.
