Pyth Stream is a real-time data streaming service that provides access to price data from the pythnet blockchain. It allows users to subscribe to price feeds over websocket and get the data pushed to them as it is published.
- Pyth Reader: Listens for price updates from the pythnet blockchain and pushes to NATS jetstream.
- NATS Jetstream: High performance queue that deduplicates and stores updates from the pyth reader.
- Websocket Server: Consumes data from NATS jetstream and forwards to clients over websocket.
Configuration is done either through a config.toml file or environment variables. Example configurations for the Pyth Reader and Websocket Server can be found at example.reader.config.toml and example.websocket.config.toml.
Pyth Reader Options:
PYTH_READER_CONFIG_FILE: Path to the configuration file (optional)PYTH__NATS__URL: NATS server URL (e.g., "nats://localhost:4222")PYTH__PYTH__HTTP_ADDR: Pythnet HTTP API addressPYTH__PYTH__WEBSOCKET_ADDR: Pythnet WebSocket addressPYTH__PYTH__PROGRAM_KEY: Pyth oracle program public keyPYTH__PRICE_UPDATE__MAX_SLOT_DIFFERENCE: Maximum allowed slot difference for price updates
Note: The double underscore (__) in the variable names represents nesting in the configuration structure.
Websocket Server Options:
WEBSOCKET_SERVER_CONFIG_FILE: Path to the configuration file (optional)PYTH__NATS__URL: NATS server URLPYTH__WEBSOCKET__ADDR: WebSocket server address and port
Note: The double underscore (__) in the variable names represents nesting in the configuration structure.