You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: learn/infrastructure/relayer.md
+68-27
Original file line number
Diff line number
Diff line change
@@ -5,109 +5,150 @@ description: Discover the role of relayers in the Wormhole network, including cl
5
5
6
6
# Relayers
7
7
8
-
This documentation provides a comprehensive guide to relayers within the Wormhole network, describing their role, types, and benefits in facilitating cross-chain processes.
8
+
This page provides a comprehensive guide to relayers within the Wormhole network, describing their role, types, and benefits in facilitating cross-chain processes.
9
9
10
10
Relayers in the Wormhole context are processes that deliver [Verified Action Approvals (VAAs)](/docs/learn/infrastructure/vaas/){target=\_blank} to their destination, playing a crucial role in Wormhole's security model. They can't compromise security, only availability, and act as delivery mechanisms for VAAs without the capacity to tamper with the outcome.
11
11
12
12
There are three primary types of relayers discussed:
13
13
14
14
-**Client-side relaying** - a cost-efficient, no-backend-infrastructure approach relying on user-facing front ends. It provides a simple solution, although it can complicate the user experience due to the manual steps involved
15
+
15
16
-**Custom relayers** - backend components that handle parts of the cross-chain process, offering a smoother user experience and allowing off-chain calculations to reduce gas costs. These relayers could operate through direct listening to the Guardian Network (Spy relaying)
17
+
16
18
-**Wormhole-deployed relayers** - a decentralized relayer network that can deliver arbitrary VAAs, reducing the developer's need to develop, host, or maintain relayers. However, they require all calculations to be done on-chain and might be less gas-efficient
17
19
18
20
## Fundamentals
19
21
20
22
This section highlights the crucial principles underpinning the operation and handling of relayers within the Wormhole network.
21
23
22
-
Relayers are fundamentally trustless entities within the network. This means that while they don't require your trust, they shouldn't be trusted implicitly. They function as delivery mechanisms, transporting VAAs from their source to their destination.
24
+
Relayers are fundamentally trustless entities within the network, meaning while they don't require your trust to operate, you also shouldn't trust them implicitly. Relayers function as delivery mechanisms, transporting VAAs from their source to their destination.
23
25
24
26
Key characteristics of VAAs include:
25
27
26
28
- Public emission from the Guardian Network
29
+
27
30
- Authentication through signatures from the Guardian Network
31
+
28
32
- Verifiability by any entity or any Wormhole Core Contract
29
-
- As a result of these characteristics, anyone can pick up a VAA and deliver it anywhere, but no one can alter the VAA content without invalidating the signatures
30
33
31
-
When designing contracts, it's crucial to only trust information contained within your contract or a VAA. Relying on information from a relayer could expose you to input attacks.
34
+
These characteristics mean anyone can pick up a VAA and deliver it anywhere, but no one can alter the VAA content without invalidating the signatures.
32
35
33
-
Advanced strategies can involve relayers performing trustless off-chain computation passed into the destination contract. These strategies can optimize gas costs but also create attack vectors if not used correctly.
36
+
Keep in mind the following security considerations around relayers:
34
37
35
-
In summary, the design of a relayer should ensure that there's a single, deterministic way to process messages in your protocol. In an optimally designed protocol, relayers should have a "correct" implementation, mirroring "crank turner" processes used elsewhere in blockchain.
38
+
-**Trusting information** - it is crucial not to trust information outside your contract or a VAA. Relying on information from a relayer could expose you to input attacks
39
+
40
+
-**Gas optimization** - using relayers to perform trustless off-chain computation to pass into the destination contract can optimize gas costs but also risk creating attack vectors if not used correctly
41
+
42
+
-**Deterministic by design** - the design of a relayer should ensure a single, deterministic way to process messages in your protocol. Relayers should have a "correct" implementation, mirroring "crank turner" processes used elsewhere in blockchain
36
43
37
44
## Client-Side Relaying
38
45
39
46
Client-side relaying relies on user-facing front ends, such as a webpage or a wallet, to complete the cross-chain process.
40
47
41
-
**Key Features**
48
+
### Key Features
42
49
43
50
-**Cost-efficiency** - users only pay the transaction fee for the second transaction, eliminating any additional costs
44
-
-**No backend infrastructure** - the process is completely client-based, eliminating the need for a backend relaying infrastructure
45
51
46
-
**Implementation**
52
+
-**No backend infrastructure** - the process is wholly client-based, eliminating the need for a backend relaying infrastructure
53
+
54
+
### Implementation
47
55
48
56
Users themselves carry out the three steps of the cross-chain process:
49
57
50
58
1. Perform an action on chain A
59
+
51
60
2. Retrieve the resulting VAA from the Guardian Network
61
+
52
62
3. Perform an action on chain B using the VAA
53
63
54
-
**Considerations**
64
+
### Considerations
55
65
56
-
!!! note
57
-
Though simple, this type of relaying is generally not recommended if your aim is a highly polished user experience. It can, however, be useful for getting a Minimum Viable Product (MVP) up and running.
66
+
Though simple, this type of relaying is generally not recommended if your aim is a highly polished user experience. It can, however, be useful for getting a Minimum Viable Product (MVP) up and running.
58
67
59
68
- Users must sign all required transactions with their own wallet
69
+
60
70
- Users must have funds to pay the transaction fees on every chain involved
71
+
61
72
- The user experience may be cumbersome due to the manual steps involved
62
73
63
74
## Custom Relayers
64
75
65
-
Custom relayers are purpose-built components within the Wormhole protocol, designed to relay messages for specific applications. They are capable of performing off-chain computations and can be customized to suit a variety of use cases.
76
+
Custom relayers are purpose-built components within the Wormhole protocol, designed to relay messages for specific applications. They can perform off-chain computations and can be customized to suit a variety of use cases.
66
77
67
-
The main method of setting up a custom relayer is by listening directly to the Guardian Network via a [Spy](/learn/infrastructure/spy/).
78
+
The primary method of setting up a custom relayer is to listen directly to the Guardian Network via a [Spy](/learn/infrastructure/spy/).
68
79
69
-
**Key Features**
80
+
### Key Features
70
81
71
82
-**Optimization** - capable of performing trustless off-chain computations which can optimize gas costs
83
+
72
84
-**Customizability** - allows for specific strategies like batching, conditional delivery, multi-chain deliveries, and more
85
+
73
86
-**Incentive structure** - developers have the freedom to design an incentive structure suitable for their application
87
+
74
88
-**Enhanced UX** - the ability to retrieve a VAA from the Guardian Network and perform an action on the target chain using the VAA on behalf of the user can simplify the user experience
75
89
76
-
**Implementation**
90
+
### Implementation
77
91
78
-
!!! note
79
-
To make the development of custom relayers easier, a plugin relayer is available in the [main Wormhole repository](https://github.com/wormhole-foundation/wormhole/tree/main/relayer){target=\_blank}. This sets up the basic infrastructure for relaying, allowing developers to focus on implementing the specific logic for their application.
92
+
A plugin relayer to make the development of custom relayers easier is available in the [main Wormhole repository](https://github.com/wormhole-foundation/wormhole/tree/main/relayer){target=\_blank}. This plugin sets up the basic infrastructure for relaying, allowing developers to focus on implementing the specific logic for their application.
80
93
81
-
**Considerations**
94
+
### Considerations
82
95
83
96
Remember, despite their name, custom relayers still need to be considered trustless. VAAs are public and can be submitted by anyone, so developers shouldn't rely on off-chain relayers to perform any computation considered "trusted."
84
97
85
98
- Development work and hosting of relayers are required
99
+
86
100
- The fee-modeling can become complex, as relayers are responsible for paying target chain fees
87
-
- Relayers are responsible for availability, adding dependency for the cross-chain application
101
+
102
+
- Relayers are responsible for availability, and adding dependencies for the cross-chain application
88
103
89
104
## Wormhole Relayers
90
105
91
-
Wormhole relayers are a component of a decentralized network in the Wormhole protocol, facilitating the delivery of VAAs to recipient contracts compatible with the standard relayer API.
106
+
Wormhole relayers are a component of a decentralized network in the Wormhole protocol. They facilitate the delivery of VAAs to recipient contracts compatible with the standard relayer API.
92
107
93
-
**Key Features**
108
+
### Key Features
94
109
95
110
-**Lower operational costs** - no need to develop, host, or maintain individual relayers
111
+
96
112
-**Simplified integration** - because there is no need to run a relayer, integration is as simple as calling a function and implementing an interface
97
113
98
-
**Implementation**
114
+
### Implementation
99
115
100
116
The Wormhole relayer integration involves two key steps:
101
117
102
118
-**Delivery request** - request delivery from the ecosystem Wormhole relayer contract
119
+
103
120
-**Relay reception** - implement a [`receiveWormholeMessages`](https://github.com/wormhole-foundation/wormhole-solidity-sdk/blob/bacbe82e6ae3f7f5ec7cdcd7d480f1e528471bbb/src/interfaces/IWormholeReceiver.sol#L44-L50){target=\_blank} function within their contracts. This function is invoked upon successful relay of the VAA
104
121
105
-
**Considerations**
122
+
### Considerations
106
123
107
-
!!! note
108
-
Developers should note that the choice of relayers depends their project's specific requirements and constraints. Wormhole relayers offer simplicity and convenience but limit customization and optimization opportunities compared to custom relayers.
124
+
Developers should note that the choice of relayers depends on their project's specific requirements and constraints. Wormhole relayers offer simplicity and convenience but limit customization and optimization opportunities compared to custom relayers.
109
125
110
126
- All computations are performed on-chain
127
+
111
128
- Potentially less gas-efficient compared to custom relayers
112
-
- Optimization features like conditional delivery, batching, off-chain calculations might be restricted
129
+
130
+
- Optimization features like conditional delivery, batching, and off-chain calculations might be restricted
131
+
113
132
- Support may not be available for all chains
133
+
134
+
## Where to Go Next
135
+
136
+
<divclass="grid cards"markdown>
137
+
138
+
- :octicons-book-16:{ .lg .middle } **Spy**
139
+
140
+
---
141
+
142
+
Discover Wormhole's Spy daemon, which subscribes to gossiped messages in the Guardian Network, including VAAs and Observations, with setup instructions.
143
+
144
+
[:custom-arrow: Learn More About the Spy](/docs/learn/infrastructure/spy/)
145
+
146
+
- :octicons-book-16:{ .lg .middle } **Build with Wormhole Relayers**
147
+
148
+
---
149
+
150
+
Learn how to use Wormhole-deployed relayer configurations for seamless cross-chain messaging between contracts on different EVM blockchains without off-chain deployments.
151
+
152
+
[:custom-arrow: Get Started with Wormhole Relayers](/docs/build/core-messaging/wormhole-relayers/)
0 commit comments