---
sidebar_position: 1
slug: .
title: Requirements
---

# Background

A Switchboard oracle is a Node.js container that sits between the Solana blockchain and the internet and waits for update requests from its assigned oracle queue.

You can find the latest Switchboard oracle image on [DockerHub](https://hub.docker.com/r/switchboardlabs/node/tags).

## Hardware Requirements

A Switchboard oracle should be hosted in a highly available environment with some level of redundancy and fail over to prevent outages, although oracles are not deducted for being offline.

At the very minimum a node should have:

- 4gb RAM
- 3.0 Ghz CPU
- 100+ Mbps connection

## RPC Endpoint

A Switchboard oracle should have a reliable RPC endpoint with no rate limiting in order to respond in a timely manner. RPC providers will need to have `--full-rpc-api` enabled in their validator config, along with the ability to support fetching 100 program accounts in a single getProgramAccounts request.

Switchboard recommends the following RPC providers:

- RPC Pool
- GenesysGo
- Syndica

## Environment Variables

```bash env title=".env"
# Solana Config
CLUSTER=""
RPC_URL=""
WS_URL=""
BACKUP_MAINNET_RPC=""
# Oracle Config
ORACLE_KEY=""
HEARTBEAT_INTERVAL=15
GCP_CONFIG_BUCKET=""
UNWRAP_STAKE_THRESHOLD=""
# Keypair Config
PAYER_SECRET_PATH=""
PAYER_SECRETS=""
GOOGLE_PAYER_SECRET_PATH=""
# Monitoring Config
METRICS_EXPORTER
PAGERDUTY_EVENT_KEY=""
VERBOSE=1
```

### Solana Config

<table>
  <thead>
    <tr>
      <th>Env Variable</th>
      <th>Definition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>CLUSTER</td>
      <td>
        <b>
          <u>Required</u>
        </b>
        <br />
        <b>Type</b> - String (devnet / mainnet-beta)
        <br />
        <b>Description</b> - Solana cluster you will be running an oracle on
        (mainnet-beta/devnet)
      </td>
    </tr>
    <tr>
      <td>RPC_URL</td>
      <td>
        <b>
          <u>Required</u>
        </b>
        <br />
        <b>Type</b> - URL
        <br />
        <b>Description</b> - Solana RPC URL that must be capable of supporting
        websockets. The default RPC pools should be avoided at all cost as you
        will quickly hit the rate limits and risk being slashed
      </td>
    </tr>
    <tr>
      <td>WS_URL</td>
      <td>
        <b>
          <u>Optional</u>
        </b>
        <br />
        <b>Type</b> - URL
        <br />
        <b>Default</b> - RPC_URL
        <br />
        <b>Description</b> - Websocket URL to connect to a Solana RPC server. If
        not provided, oracle will fallback to RPC_URL
      </td>
    </tr>
    <tr>
      <td>BACKUP_MAINNET_RPC</td>
      <td>
        <b>
          <u>Optional</u>
        </b>
        <br />
        <b>Type</b> - URL
        <br />
        <b>Default</b> - https://api.mainnet-beta.solana.com
        <br />
        <b>Description</b> - Backup RPC URL in case of network congestion
      </td>
    </tr>
  </tbody>
</table>

### Oracle Config

<table>
  <thead>
    <tr>
      <th>Env Variable</th>
      <th>Definition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>ORACLE_KEY</td>
      <td>
        <b>
          <u>Required</u>
        </b>
        <br />
        <b>Type</b> - Public Key
        <br />
        <b>Description</b> - Public key of the oracle account that has been
        granted permissions to use an oracle queue <br />
      </td>
    </tr>
    <tr>
      <td>HEARTBEAT_INTERVAL</td>
      <td>
        <b>
          <u>Optional</u>
        </b>
        <br />
        <b>Type</b> - Number (seconds)
        <br />
        <b>Default</b> - 30
        <br />
        <b>Description</b> - Seconds between oracle heartbeats. Queues have
        different oracle heartbeat requirements. Recommended value is 15
      </td>
    </tr>
    <tr>
      <td>GCP_CONFIG_BUCKET</td>
      <td>
        <b>
          <u>Optional</u>
        </b>
        <br />
        <b>Type</b> - GCP Resource Path
        <br />
        <b>Default</b> - Looks for configs.json in the current working
        directory. If not found, no config is loaded.
        <br />
        <b>Description</b> - Contains API keys for private API endpoints
      </td>
    </tr>
    <tr>
      <td>UNWRAP_STAKE_THRESHOLD</td>
      <td>
        <b>
          <u>Optional</u>
        </b>
        <br />
        <b>Type</b> - Number (SOL amount, Ex. 1.55)
        <br />
        <b>Default</b> - 0, disabled.
        <br />
        <b>Description</b> - The Solana balance amount to trigger an unwrap stake action. When an oracle's Solana balance falls below the set threshold, the node will automatically unwrap funds from the oracle's staking wallet, leaving at least 0.1 wSOL or 10% more than the queue's minimum stake requirement. 
      </td>
    </tr>
  </tbody>
</table>

### Keypair Config

You must provide one of the following environment variables, which is the same keypair that is the authority for the given `$ORACLE_KEY` and will pay for any on-chain transactions.

<table>
  <thead>
    <tr>
      <th>Env Variable</th>
      <th>Definition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>PAYER_SECRET_PATH</td>
      <td>
        <b>Type</b> - Filesystem Path
        <br />
        <b>Description</b> - Local filesystem path to keypair file that will pay
        for on-chain transactions and is the authority for the oracle
      </td>
    </tr>
    <tr>
      <td>PAYER_SECRETS</td>
      <td>
        <b>Type</b> - Docker Secret
        <br />
        <b>Description</b> - Docker Secret path to keypair file that will pay
        for on-chain transactions and is the authority for the oracle
      </td>
    </tr>
    <tr>
      <td>GOOGLE_PAYER_SECRET_PATH</td>
      <td>
        <b>Type</b> - GCP Resource Path
        <br />
        <b>Description</b> - Google cloud resource to manage your keypair
        securely.
      </td>
    </tr>
  </tbody>
</table>

### Monitoring Config

<table>
  <thead>
    <tr>
      <th>Env Variable</th>
      <th>Definition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>METRICS_EXPORTER</td>
      <td>
        <b>
          <u>Optional</u>
        </b>
        <br />
        <b>Type</b> - prometheus / gcp / opentelemetry-collector*
        <br />
        <b>Default</b> - prometheus
        <br />
        <b>Description</b> - Dictates which metric suite to aggregate resource
        metrics, as defined in:
        <br />
        <a href="./operator/monitoring">Oracle - Monitoring</a>
        <br />
        *opentelemetry-collector only supports the default endpoint
        localhost:55681/v1/metric
      </td>
    </tr>
    <tr>
      <td>PAGERDUTY_EVENT_KEY</td>
      <td>
        <b>
          <u>Optional</u>
        </b>
        <br />
        <b>Type</b> - String
        <br />
        <b>Default</b> - Paging disabled
        <br />
        <b>Description</b> - Token provided by pagerduty for sending pages about
        various alerts.
        <br />
        <a href="./operator/monitoring#alerts">Oracle - Alerts</a>
      </td>
    </tr>
    <tr>
      <td>VERBOSE</td>
      <td>
        <b>
          <u>Optional</u>
        </b>
        <br />
        <b>Type</b> - Flag (0 or 1)
        <br />
        <b>Default</b> - 0, normal logging
        <br />
        <b>Description</b> - Set to 1 to increase the level of logging
      </td>
    </tr>
  </tbody>
</table>
