Skip to content

Commit c713fbd

Browse files
authored
Merge PR cosmos#37: ICS 18: Relayer algorithms
1 parent 9c5ddb7 commit c713fbd

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
ics: 18
3+
title: Relayer Algorithms
4+
stage: draft
5+
category: ibc-misc
6+
author: Christopher Goes <cwgoes@tendermint.com>
7+
created: 2019-03-07
8+
modified: 2019-04-23
9+
---
10+
11+
## Synopsis
12+
13+
Relayer algorithms are the "physical" connection layer of IBC — off-chain processes responsible for relaying data between two chains running the IBC protocol by scanning the state of each chain, constructing appropriate datagrams, and executing them on the opposite chain as allowed by the protocol.
14+
15+
## Specification
16+
17+
### Motivation
18+
19+
In the IBC protocol, a blockchain can only record the *intention* to send particular data to another chain — it does not have direct access to a network transport layer. Physical datagram relay must be performed by off-chain infrastructure with access to a transport layer such as TCP/IP. This standard defines the concept of a *relayer* algorithm, executable by an off-chain process with the ability to query chain state, to perform this relay.
20+
21+
### Definitions
22+
23+
A *relayer* is an off-chain process with the ability to read the state of and submit transactions to some set of ledgers utilizing the IBC protocol.
24+
25+
### Desired Properties
26+
27+
- No safety properties of IBC should depend on relayer behaviour (assume Byzantine relayers).
28+
- Liveness properties of IBC should depend only on the existence of at least one correct, live relayer.
29+
- Relaying should be permissionless, all requisite verification should be performed on-chain.
30+
- Requisite communication between the IBC user and the relayer should be minimized.
31+
- Provision for relayer incentivization should be possible at the application layer.
32+
33+
### Technical Specification
34+
35+
#### Relayer Algorithm
36+
37+
The relayer algorithm is defined over a set `C` of chains implementing the IBC protocol. Each relayer may not necessarily have access to read state from and write datagrams to all chains in the interchain network (especially in the case of permissioned or private chains) — different relayers may relay between different subsets.
38+
39+
`pendingDatagrams` calculates the set of all valid datagrams to be relayed from one chain to another based on the state of both chains. Subcomponents of this function are defined in individual ICSs. The relayer must possess prior knowledge of what subset of the IBC protocol is implemented by the blockchains in the set for which they are relaying (e.g. by reading the source code).
40+
41+
`submitDatagram` is a procedure defined per-chain (submitting a transaction of some sort).
42+
43+
```coffeescript
44+
function relay(C)
45+
for chain in C
46+
for counterparty in C if counterparty != chain
47+
datagrams = pendingDatagrams(chain, counterparty)
48+
for datagram in datagrams
49+
submitDatagram(counterparty, datagram)
50+
```
51+
52+
#### Incentivization
53+
54+
The relay process must have access to accounts on both chains with sufficient balance to pay for transaction fees. Relayers may employ application-level methods to recoup these fees, such by including a small payment to themselves in the packet data — protocols for relayer fee payment will be described in future versions of this ICS or in separate ICSs.
55+
56+
Any number of relayer processes may be safely run in parallel (and indeed, it is expected that separate relayers will serve separate subsets of the interchain). However, they may consume unnecessary fees if they submit the same proof multiple times, so some minimal coordination may be ideal (such as assigning particular relayers to particular packets or scanning mempools for pending transactions).
57+
58+
### Backwards Compatibility
59+
60+
Not applicable. The relayer process is off-chain and can be upgraded or downgraded as necessary.
61+
62+
### Forwards Compatibility
63+
64+
Not applicable. The relayer process is off-chain and can be upgraded or downgraded as necessary.
65+
66+
### Example Implementation
67+
68+
Coming soon.
69+
70+
### Other Implementations
71+
72+
Coming soon.
73+
74+
## History
75+
76+
30 March 2019 - Initial draft submitted
77+
15 April 2019 - Revisions for formatting and clarity
78+
23 April 2019 - Revisions from comments; draft merged
79+
80+
## Copyright
81+
82+
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

0 commit comments

Comments
 (0)