> For the complete documentation index, see [llms.txt](https://piertwo.gitbook.io/lantern.discv5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://piertwo.gitbook.io/lantern.discv5/settings.md).

# Settings

> **Please note the customization and settings of mentioned options are optional and only recommended for certain scenarios, as it may affect the performance of the application during runtime.**

### Connection Options

`ConnectionOptions` allows you to adjust settings related to the connection manager:

* `Port`: Specifies the port for the local node. Default value is `9000` milliseconds&#x20;
* `IpAddress`: Indicates the IP address of the local machine on which the node is running
* `ReceiveTimeoutMs`: Specifies the timeout in milliseconds for receiving a response to a request message. Default value is `1000` milliseconds&#x20;
* `RequestTimeoutMs`: Specifies the timeout in milliseconds to remove pending messages for which a response has not been received. Default value is `2000` milliseconds&#x20;
* `CheckPendingRequestsDelayMs`: Specifies the time interval in milliseconds to check for pending messages. Default value is `500` milliseconds
* `RemoveCompletedRequestsDelayMs`: Specifies the time interval in milliseconds for the removal of completed requests. Default value is `1000` milliseconds

**Example**

```csharp
var connectionOptions = new ConnectionOptions()
                        .SetPort(9000)
                        .SetIpAddress(IPAddress.Parse("192.168.1.100"))
                        .SetReceiveTimeoutMs(1000)
                        .SetRequestTimeoutMs(2000)
                        .SetCheckPendingRequestsDelayMs(500)
                        .SetRemoveCompletedRequestsDelayMs(1000);
```

### Session Options

`SessionOptions` allows you to adjust settings related to the session manager:

* `Signer`: The signer for the identity scheme (v4 as per the [ENR](https://github.com/ethereum/devp2p/blob/master/enr.md#v4-identity-scheme) Specification)
* `Verifier`: The verifier for the identity scheme (v4 as per the [ENR](https://github.com/ethereum/devp2p/blob/master/enr.md#v4-identity-scheme) Specification)
* `SessionKeys`: The private keys used for securing the session
* `SessionCacheSize`: Specifies the size of the cache for storing session objects. Default value is `1000`

**Example**

```csharp
byte[] privateKey = ...; // Random 32 byte private key
ISessionKeys sessionKeys = new SessionKeys(privateKey);
IIdentitySchemeV4Signer signer = new IdentitySchemeV4Signer(privateKey);
IIdentitySchemeV4Verifier verifier = new IdentitySchemeV4Verifier();
SessionOptions sessionOptions = new()
                                .SetSigner(signer)
                                .SetVerifier(verifier)
                                .SetSessionKeys(sessionKeys)
                                .SetCacheSize(1500);
```

### Table Options

`TableOptions` allows you to configure the settings related to the node table manager:

* `PingIntervalMilliseconds`: Specifies the time interval in milliseconds at which ping messages are sent to active peers. Default value is `5000`&#x20;
* `RefreshIntervalMilliseconds`: Specifies the time interval in milliseconds at which the node table is refreshed by performing a lookup to ensure that the knowledge of active peers is up-to-date. Default value is `300000`&#x20;
* `LookupTimeoutMilliseconds`: Specifies the maximum time in milliseconds to perform a lookup operation. Default value is `10000`&#x20;
* `ConcurrencyParameter`: Specifies the concurrency factor (k) when performing lookups. This is the number of nodes that are queried each `FINDNODE` request during the lookup. Default value is `3`
* `LookupParallelism`: Specifies the maximum number of lookup operations (path buckets) that can be performed in parallel while maintaining the concurrency parameter (k). Default value is `2`.
* `MaxAllowedFailures`: Specifies the maximum number of allowed unsuccessful interaction attempts with a peer before it is considered as non-responsive and added to the blacklisting mechanism. Default value is `3`
* `BootstrapEnrs`: Specifies an array of ENRs (Ethereum Node Record)  for bootstrap peers.

```csharp
TableOptions tableOptions = new()
                            .SetPingIntervalMilliseconds(6000)
                            .SetRefreshIntervalMilliseconds(360000)
                            .SetLookupTimeoutMilliseconds(12000)
                            .SetMaxAllowedFailures(4)
                            .SetReplacementCacheSize(250)
                            .SetConcurrencyParameter(4)
                            .SetLookupParallelism(3)
                            .SetBootstrapEnrs(new string[] { "enr:...", "enr:..." });
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://piertwo.gitbook.io/lantern.discv5/settings.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
