Skip to content

Commit fc3681c

Browse files
Ilaria EnacheIlaria Enache
Ilaria Enache
authored and
Ilaria Enache
committed
sync with main
2 parents 0519b45 + 2ffce02 commit fc3681c

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

learn/infrastructure/spy.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Spy
3+
description: Discover Wormhole's Spy daemon, which subscribes to gossiped messages in the Guardian Network, including VAAs and Observations, with setup instructions.
4+
---
5+
6+
# Spy
7+
8+
In the Wormhole context, a _Spy_ is a daemon that subscribes to the gossiped messages in the Guardian Network.
9+
10+
The messages available over gossip are things like:
11+
12+
- [VAAs](#){target=\_blank} <!-- link to VAAs page -->
13+
- [Observations](#){target=\_blank} <!-- link to glossary -->
14+
- Guardian heartbeats
15+
16+
The source code for the Spy is available on [GitHub](https://github.com/wormhole-foundation/wormhole/blob/main/node/cmd/spy/spy.go){target=\_blank}.
17+
18+
!!! note
19+
The Spy has no persistence layer built in, so typically, it is paired with something like Redis or an SQL database to record relevant messages.
20+
21+
## How to Start a Spy
22+
23+
To start a Spy locally, run the following Docker command:
24+
25+
=== "Testnet"
26+
27+
```sh
28+
docker run --platform=linux/amd64 \
29+
-p 7073:7073 \
30+
--entrypoint /guardiand ghcr.io/wormhole-foundation/guardiand:latest \
31+
spy \
32+
--nodeKey /node.key \
33+
--spyRPC "[::]:7073" \
34+
--env testnet
35+
```
36+
Optionally, add the following flags to skip any VAAs with invalid signatures:
37+
```sh
38+
--ethRPC https://sepolia.drpc.org/
39+
--ethContract 0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78
40+
```
41+
42+
=== "Mainnet"
43+
44+
```sh
45+
docker run --platform=linux/amd64 \
46+
-p 7073:7073 \
47+
--entrypoint /guardiand ghcr.io/wormhole-foundation/guardiand:latest \
48+
spy \
49+
--nodeKey /node.key \
50+
--spyRPC "[::]:7073" \
51+
--env mainnet
52+
```
53+
Optionally, add the following flags to skip any VAAs with invalid signatures:
54+
```sh
55+
--ethRPC https://eth.drpc.org
56+
--ethContract 0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B
57+
```
58+
59+
Once running, a [gRPC](https://grpc.io/){target=\_blank} client (i.e., your program) can subscribe to a filtered stream of messages.
60+
61+
To generate a client for the gRPC service use [this proto spec file](https://github.com/wormhole-foundation/wormhole/blob/main/proto/spy/v1/spy.proto){target=\_blank}.
62+
63+
!!! note
64+
If using JavaScript/TypeScript, the [Spydk](https://www.npmjs.com/package/@certusone/wormhole-spydk){target=\_blank} makes setting up a client easier.
65+
66+
## See Also
67+
68+
The [Pyth Beacon](https://github.com/pyth-network/beacon){target=\_blank} provides an alternate Spy implementation that is highly available for improved performance and reliability.
69+
70+
The [relayer engine](https://github.com/wormhole-foundation/relayer-engine){target=\_blank} implements a client and persistence layer for messages received from a Spy subscription.

0 commit comments

Comments
 (0)