> ## Documentation Index
> Fetch the complete documentation index at: https://docs.towns.com/llms.txt
> Use this file to discover all available pages before exploring further.

# System Configuration

> The following guide describes steps and best practices for configuring a Towns Stream Node after meeting the [system requirements](/node-operator/tutorials/system-requirements-installation).

## Node FE & Storage Configuration

<Steps>
  <Step title="Generate configuration associated with the Node Storage">
    Generate an ECDSA wallet that will serve as the Node identity to the storage layer and network. On Node FE startup, this wallet will be used to access the appropriate
    database schema and to authenticate the Node FE to the Towns Chain during registration.

    <Note>Only one unique Node FE (by wallet identity) can be associated with a Node Storage instance at a given time.</Note>

    <AccordionGroup>
      <Accordion title="Generate node wallet identity with cast">
        Wallets can quickly be generated on the command line with `cast`.

        ```bash theme={null}
        # generate a new wallet to console in json format
        $ cast wallet n -j
        ```
      </Accordion>

      <Accordion title="Generate node wallet identity with ethers.js">
        Wallets can also be generated with [ethers.js](https://github.com/ethers-io/ethers.js) package in javascript.
        See below for an example in javascript.

        ```bash theme={null}
        # check if node is installed
        $ node -v
        # installs ethers.js
        $ npm i ethers
        ```

        Then copy-paste the below into a file, `address.js`. Run with `node address.js` to generate a new wallet and print key to console.

        ```javascript theme={null}
        var ethers = require('ethers');
        var crypto = require('crypto');

        var id = crypto.randomBytes(32).toString('hex');
        var privateKey = "0x"+id;
        console.log("SAVE BUT DO NOT SHARE THIS:", privateKey);

        var wallet = new ethers.Wallet(privateKey);
        console.log("Address: " + wallet.address);
        ```
      </Accordion>
    </AccordionGroup>
  </Step>

  <Step title="Generate configuration associated with the Node FE">
    During this step, configure your Node FE image or binary
    to run in your networked environment that has connectivity to the Node Storage instance
    and set your Node FE environment variables, such as RPC\_URL's, logging level, contract addresses.

    Some of the required environment variables will be secrets as described in [system requirements](/node-operator/tutorials/system-requirements-installation#node-fe-environment-variables) that will need to be stored and injected in your runtime securely.
    Choices around secret storage depend largely on the cloud or on-premise hosting environment for the Node FE, which is left up
    to the node operator.
  </Step>

  <Step title="Node Front End (FE)">
    Configure your Node FE with a publicly addressable, static IPv4 host, ensuring it can serve HTTP1.1 & HTTP2 requests.
    If behind a termination proxy, configure accordingly. Ensure your network does not proxy traffic through an ALB as this
    has been known to cause issues with client connectivity.

    Configure DNS with a hostname and either an A record or CNAME record to your static IPv4 address.

    <Note>By convention, it is reccommended that hostnames for nodes in mainnet be defined on a per operator address basis with a subdomain using an airport code prefix distinct from other node operators as in `<airport-code>-<node_number>.<domain>`. See [mainnet node list](https://haneda-1.nodes.towns-u4.com/debug/multi) for additional examples of the convention. </Note>

    <Warning>
      Application level load balancers (ALBs) require a very specific configuration to handle
      gRPC traffic as well as ALPN with HTTP1/2 and therefore are not supported at this time.

      Terminate TLS at your origin server and use a static IPv4 address for your Node FE. Network load balancers
      are supported assuming 1 LB instance per origin.
    </Warning>
  </Step>

  <Step title="Node Storage Setup">
    Set up Node Storage (e.g., Postgres), ensuring your Node FE can connect within your hosting network.

    Run network probes on the Node FE in [info mode](https://github.com/towns-protocol/towns/tree/main/core/node#checking-on-gamma-status-from-local-host) to ensure network connectivity, TLS termination, and that the node is publicly addressable over DNS.
  </Step>
</Steps>
