304 lines
7.4 KiB
Plaintext
304 lines
7.4 KiB
Plaintext
---
|
|
sidebar_position: 1
|
|
id: oracle
|
|
slug: /oracle
|
|
title: Introduction
|
|
---
|
|
|
|
# Introduction
|
|
|
|
A Switchboard oracle is a node container that sits between the internet and a Solana RPC node and facilitates update request when invoked by a queue. Before running an oracle you will need to:
|
|
|
|
- **Oracle Account** - Create an oracle account using the desired oracle queue public key
|
|
- **Stake Account** - Fund the staking account with the minimum staking amount set by the oracle queue
|
|
- **Grant Queue Permissions** - Submit DAO approval to the discord to join a Switchboard oracle queue
|
|
|
|
import MarkdownImage from "../../src/components/MarkdownImage";
|
|
|
|
<MarkdownImage img="/img/adding_new_oracles.png" />
|
|
|
|
## Requirements
|
|
|
|
Running an oracle allows you to contribute to the switchboard network and get compensated for your compute time. In order to run a node and avoid slashing, you should have the following:
|
|
|
|
- Dedicated RPC endpoint with reliable up-time, capable of supporting websocket connections
|
|
- Kubernetes hosting provider (preferebly Google Cloud Platform to start) or any infrastructure with reliable uptime and monitoring capabilities
|
|
- Wrapped SOL wallet to fund staking account
|
|
|
|
## Config
|
|
|
|
```bash env title=".env"
|
|
# Solana Config
|
|
LIVE=1
|
|
CLUSTER=""
|
|
RPC_URL=""
|
|
WS_URL=""
|
|
BACKUP_MAINNET_RPC=""
|
|
# Oracle Config
|
|
ORACLE_KEY=""
|
|
HEARTBEAT_INTERVAL=15
|
|
GCP_CONFIG_BUCKET=""
|
|
# Oracle Keypairs
|
|
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>LIVE</td>
|
|
<td>
|
|
<b>
|
|
<u>Required</u>
|
|
</b>
|
|
<br />
|
|
<b>Type </b> - Flag (0 or 1)
|
|
<br />
|
|
<b>Description</b> - Set to 0 for localnet, 1 for devnet/mainnet-beta
|
|
</td>
|
|
</tr>
|
|
<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 />
|
|
<a href="../oracle/account#create-oracle">
|
|
Oracle Account #Create Oracle
|
|
</a>
|
|
</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
|
|
<br />
|
|
<a href="../oracle/gcp/manual-setup#storage-bucket">
|
|
GCP Manual Setup #StorageBucket
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
### Oracle Keypairs
|
|
|
|
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.
|
|
<br />
|
|
<a href="../oracle/gcp/manual-setup#oracle-payer-secret">
|
|
GCP Manual Setup #OraclePayerSecret
|
|
</a>
|
|
</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="oracle/monitor">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="oracle/monitor#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>
|