# Setting up Client Node

This guide(along with next few pages in this section) provides an example of how to use the CoFHE (Collaborative Fully Homomorphic Encryption) library to perform computations over encrypted data using the provided API. We will walk through setting up a client node, encrypting data, creating compute requests, and interpreting the responses.

### Prerequisites

* **CoFHE Library**: The CoFHE library and its dependencies should be properly installed and included in your project.

#### 1. Include Necessary Headers

Begin by including the necessary headers:

```cpp
#include <iostream>
#include <chrono>
#include "cofhe.hpp"
#include "node/network_details.hpp"
#include "node/client_node.hpp"
#include "node/compute_request_handler.hpp"
```

Make sure these headers correspond to the CoFHE library's files in your project.

#### 2. Set Up the Client Node

We need to initialize a `ClientNode` that will communicate with the network.

```cpp
int main(int argc, char* argv[]) {
    // Check for the required number of command-line arguments
    if (argc < 5) {
        std::cerr << "Usage: " << argv[0] << " <client_ip> <client_port> <setup_ip> <setup_port>" << std::endl;
        return 1;
    }

    // Parse node details from command-line arguments
    auto self_details = NodeDetails{argv[1], argv[2], NodeType::CLIENT_NODE};
    auto setup_node_details = NodeDetails{argv[3], argv[4], NodeType::SETUP_NODE};

    // Create the client node
    auto client_node = make_client_node<CPUCryptoSystem>(setup_node_details);

    // Get the CryptoSystem instance from the client node
    auto& cs = client_node.crypto_system();
```

**Explanation:**

* We parse the client and setup node details from the command-line arguments.
* `make_client_node<CPUCryptoSystem>` creates a client node using the CPU-based cryptosystem.
* We obtain a reference to the cryptosystem to perform local cryptographic operations.


---

# 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://openvector.gitbook.io/docs/quick-start/editor.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.
