|
|
преди 2 години | |
|---|---|---|
| .. | ||
| src | преди 2 години | |
| .gitignore | преди 2 години | |
| Cargo.lock | преди 2 години | |
| Cargo.toml | преди 2 години | |
| Dockerfile | преди 2 години | |
| README.md | преди 2 години | |
| buf.gen.yaml | преди 2 години | |
| build.rs | преди 2 години | |
| go.mod | преди 2 години | |
| go.sum | преди 2 години | |
| shell.nix | преди 2 години | |
Hermes is a highly available and versatile software that defines the Pyth P2P network. It also provides the public Pyth API and connects with the Pyth Geyser node software to listen for Pythnet events. Hermes offers both REST and WebSocket APIs for seamless integration and interaction with the Pyth network stack. Anyone can run the Node to:
To set up and run a Hermes node, follow the steps below:
Clone the repository: Clone the Pyth Crosschain repository to your local machine using the following command:
git clone https://github.com/pyth-network/pyth-crosschain.git
Build the project: Navigate to the project directory and run the following command to build the project:
cd hermes
cargo build --release
This will create a binary in the target/release directory.
Run the node: To run Hermes, use the following command:
./target/release/hermes run --geyser-socket /tmp/geyser.ipc
Your Hermes node will now start and connect to the specified networks. You
can interact with the node using the REST and Websocket APIs as described
in the [API Documentation](). You can leave off the --geyser-socket arg
if you are planning to run the node without a Pythnet validator, it will
extract data only from the Pyth P2P network. Running a Pythnet node will
improve the speed and accuracy of network observations.
For users who simply want to run the software, this section can be skipped. However, for those interested in understanding Pyth's architecture, this section explains the old and new architecture, as well as our motivation for the design.
The Pyth project offers a cross-chain price oracle service for real-time access to current prices of real-world assets. These prices are aggregated on Pythnet, where core Pyth contracts are hosted, and pricing information is generated. The Wormhole project currently sends these prices to other chains.
To share these prices, the Pyth project provides a standalone application called the Price Service, which queries the message API provided by Wormhole to look for Pyth prices.
The original communication flow can be visualized in the following graph:
+--------+ +--------+ +--------+
| User 3 | | User 2 | | User 1 |
+--------+ +--------+ +--------+
| | |
| | |
+--------------+--------------+
|
v
+---------------------+
| Price Service | (Weakly Decentralised)
+----------+----------+
|
v
+---------------------+
| Wormhole | (Decentralised)
+---------------------+
^
|
v
+ - - - - - - - - - + - - - - - - - - - - - +
' Pythnet '
' '
' +----------------+ '
' | Pythnet Node 1 | ------+ '
' +----------------+ | '
' | | '
' | | '
' +----------------+ | ' (Decentralised)
' | Pythnet Node 2 | | '
' +----------------+ | '
' | | '
' | | '
' +----------------+ +----------------+ '
' | Pythnet Node 3 | --- | Pythnet Node 4 | '
' +----------------+ +----------------+ '
+ - - - - - - - - - - - - - - - - - - - - - +
This design has issues due to latency and API complexity introduced by the Price Service, which acts as a middleman between the user, Wormhole, and Pythnet. Additionally, it does not represent a particularly decentralized design, which was a weak point for Pyth.
In the new model, we designed a single node-style service, Hermes, intended for direct integration into Pythnet nodes. This aligns with other blockchain projects where running standard node software allows users to act as observers of the network:
+--------+ +--------+ +--------+
| User 3 | | User 2 | | User 1 |
+--------+ +--------+ +--------+
| | |
| | |
+--------------+--------------+
|
v
+ - - - - - - - - - + - - - - - - - - - - - +
' Pythnet '
' '
' +----------------+ '
' | Pythnet Node 1 | ------+ '
' +----------------+ | '
' | |Hermes| | '
' | +------+ | '
' | | '
' +----------------+ | '
' | Pythnet Node 2 | | '
' +----------------+ | '
' | |Hermes| | '
' | +------+ | '
' | | '
' +----------------+ +----------------+ '
' | Pythnet Node 3 | --- | Pythnet Node 4 | '
' +----------------+ +----------------+ '
' |Hermes| |Hermes| '
' +------+ +------+ '
+ - - - - - - - - - - - - - - - - - - - - - +
^
|
v
+---------------------+
| Wormhole |
+---------------------+
In this new design, the Price Service is integrated into the Hermes node service, decentralizing the API. Hermes is now also responsible for direct communication with Wormhole over P2P, which reduces latency and simplifies responsibilities.
The new design offers several benefits:
With tighter communication flow, we can define new behaviors such as Pyth-specific threshold signing, fast price accumulation with proving (due to direct node access), improved metrics and observations, and the ability for users to run observe-only Hermes nodes to watch the Pyth network directly instead of relying on a Price Service host.
The Hermes node architecture is as follows:
This is more in line with other well-known projects in the blockchain and P2P space, such as Solana, Bitcoin, and Cosmos chains, where users who run the node can also act as observers with specific features disabled.
In our case, the node software can be run with or without a Pythnet validator running due to it being designed to fetch updates from either Pyth or Geyser networks for high availability.
The Hermes Node software consists of the following components:
While Hermes will always participate in the Wormhole and Pyth P2P networks, the
Pyth network shares network updates on the Pyth layer and so can be run without
a Pythnet node running along-side it for a spy-only mode. This can be done by
running without specifying --geyser-socket.