22
33This is a collection of components for building bridges.
44
5- These components include Substrate pallets for syncing headers, passing arbitrary messages, as well
6- as libraries for building relayers to provide cross-chain communication capabilities.
5+ These components include Substrate pallets for syncing headers, passing arbitrary messages, as well as libraries for
6+ building relayers to provide cross-chain communication capabilities.
77
8- Three bridge nodes are also available. The nodes can be used to run test networks which bridge other
9- Substrate chains.
8+ Three bridge nodes are also available. The nodes can be used to run test networks which bridge other Substrate chains.
109
1110🚧 The bridges are currently under construction - a hardhat is recommended beyond this point 🚧
1211
@@ -21,8 +20,8 @@ Substrate chains.
2120
2221## Installation
2322
24- To get up and running you need both stable and nightly Rust. Rust nightly is used to build the Web
25- Assembly (WASM) runtime for the node. You can configure the WASM support as so:
23+ To get up and running you need both stable and nightly Rust. Rust nightly is used to build the Web Assembly (WASM)
24+ runtime for the node. You can configure the WASM support as so:
2625
2726``` bash
2827rustup install nightly
@@ -38,8 +37,8 @@ cargo build --all
3837cargo test --all
3938```
4039
41- Also you can build the repo with
42- [ Parity CI Docker image] ( https://github.com/paritytech/scripts/tree/master/dockerfiles/bridges-ci ) :
40+ Also you can build the repo with [ Parity CI Docker
41+ image] ( https://github.com/paritytech/scripts/tree/master/dockerfiles/bridges-ci ) :
4342
4443``` bash
4544docker pull paritytech/bridges-ci:production
@@ -57,16 +56,14 @@ docker run --rm -it -w /shellhere/parity-bridges-common \
5756If you want to reproduce other steps of CI process you can use the following
5857[ guide] ( https://github.com/paritytech/scripts#reproduce-ci-locally ) .
5958
60- If you need more information about setting up your development environment [ Substrate's
61- Installation page] ( https://docs.substrate.io/main-docs/install/ ) is a good
62- resource.
59+ If you need more information about setting up your development environment [ Substrate's Installation
60+ page] ( https://docs.substrate.io/main-docs/install/ ) is a good resource.
6361
6462## High-Level Architecture
6563
66- This repo has support for bridging foreign chains together using a combination of Substrate pallets
67- and external processes called relayers. A bridge chain is one that is able to follow the consensus
68- of a foreign chain independently. For example, consider the case below where we want to bridge two
69- Substrate based chains.
64+ This repo has support for bridging foreign chains together using a combination of Substrate pallets and external
65+ processes called relayers. A bridge chain is one that is able to follow the consensus of a foreign chain independently.
66+ For example, consider the case below where we want to bridge two Substrate based chains.
7067
7168```
7269+---------------+ +---------------+
@@ -82,19 +79,19 @@ Substrate based chains.
8279 +---------------+
8380```
8481
85- The Millau chain must be able to accept Rialto headers and verify their integrity. It does this by
86- using a runtime module designed to track GRANDPA finality. Since two blockchains can't interact
87- directly they need an external service, called a relayer, to communicate. The relayer will subscribe
88- to new Rialto headers via RPC and submit them to the Millau chain for verification.
82+ The Millau chain must be able to accept Rialto headers and verify their integrity. It does this by using a runtime
83+ module designed to track GRANDPA finality. Since two blockchains can't interact directly they need an external service,
84+ called a relayer, to communicate. The relayer will subscribe to new Rialto headers via RPC and submit them to the Millau
85+ chain for verification.
8986
90- Take a look at [ Bridge High Level Documentation] ( ./docs/high-level-overview.md ) for more in-depth
91- description of the bridge interaction.
87+ Take a look at [ Bridge High Level Documentation] ( ./docs/high-level-overview.md ) for more in-depth description of the
88+ bridge interaction.
9289
9390## Project Layout
9491
95- Here's an overview of how the project is laid out. The main bits are the ` bin ` , which is the actual
96- "blockchain", the ` modules ` which are used to build the blockchain's logic (a.k.a the runtime) and
97- the ` relays ` which are used to pass messages between chains.
92+ Here's an overview of how the project is laid out. The main bits are the ` bin ` , which is the actual "blockchain", the
93+ ` modules ` which are used to build the blockchain's logic (a.k.a the runtime) and the ` relays ` which are used to pass
94+ messages between chains.
9895
9996```
10097├── bin // Node and Runtime for the various Substrate chains
@@ -117,16 +114,16 @@ the `relays` which are used to pass messages between chains.
117114
118115## Running the Bridge
119116
120- To run the Bridge you need to be able to connect the bridge relay node to the RPC interface of nodes
121- on each side of the bridge (source and target chain).
117+ To run the Bridge you need to be able to connect the bridge relay node to the RPC interface of nodes on each side of the
118+ bridge (source and target chain).
122119
123120There are 2 ways to run the bridge, described below:
124121
125- - building & running from source: with this option, you'll be able to run the bridge between two standalone
126- chains that are running GRANDPA finality gadget to achieve finality;
122+ - building & running from source: with this option, you'll be able to run the bridge between two standalone chains that
123+ are running GRANDPA finality gadget to achieve finality;
127124
128- - running a Docker Compose setup: this is a recommended option, where you'll see bridges with parachains,
129- complex relays and more.
125+ - running a Docker Compose setup: this is a recommended option, where you'll see bridges with parachains, complex relays
126+ and more.
130127
131128### Using the Source
132129
@@ -141,16 +138,15 @@ cargo build -p substrate-relay
141138
142139### Running a Dev network
143140
144- We will launch a dev network to demonstrate how to relay a message between two Substrate based
145- chains (named Rialto and Millau).
141+ We will launch a dev network to demonstrate how to relay a message between two Substrate based chains (named Rialto and
142+ Millau).
146143
147- To do this we will need two nodes, two relayers which will relay headers, and two relayers which
148- will relay messages.
144+ To do this we will need two nodes, two relayers which will relay headers, and two relayers which will relay messages.
149145
150146#### Running from local scripts
151147
152- To run a simple dev network you can use the scripts located in the
153- [ ` deployments/local-scripts ` folder] ( ./deployments/local-scripts ) .
148+ To run a simple dev network you can use the scripts located in the [ ` deployments/local-scripts `
149+ folder] ( ./deployments/local-scripts ) .
154150
155151First, we must run the two Substrate nodes.
156152
@@ -167,8 +163,8 @@ After the nodes are up we can run the header relayers.
167163./deployments/local-scripts/relay-rialto-to-millau.sh
168164```
169165
170- At this point you should see the relayer submitting headers from the Millau Substrate chain to the
171- Rialto Substrate chain.
166+ At this point you should see the relayer submitting headers from the Millau Substrate chain to the Rialto Substrate
167+ chain.
172168
173169```
174170# Header Relayer Logs
@@ -192,20 +188,23 @@ You will also see the message lane relayers listening for new messages.
192188[Millau_to_Rialto_MessageLane_00000000] [date] DEBUG bridge Asking Millau::ReceivingConfirmationsDelivery about best message nonces
193189[...] [date] INFO bridge Synced Some(2) of Some(3) nonces in Millau::MessagesDelivery -> Rialto::MessagesDelivery race
194190[...] [date] DEBUG bridge Asking Millau::MessagesDelivery about message nonces
195- [...] [date] DEBUG bridge Received best nonces from Millau::ReceivingConfirmationsDelivery: TargetClientNonces { latest_nonce: 0, nonces_data: () }
191+ [...] [date] DEBUG bridge Received best nonces from Millau::ReceivingConfirmationsDelivery: TargetClientNonces {
192+ latest_nonce: 0, nonces_data: () }
196193[...] [date] DEBUG bridge Asking Millau::ReceivingConfirmationsDelivery about finalized message nonces
197- [...] [date] DEBUG bridge Received finalized nonces from Millau::ReceivingConfirmationsDelivery: TargetClientNonces { latest_nonce: 0, nonces_data: () }
194+ [...] [date] DEBUG bridge Received finalized nonces from Millau::ReceivingConfirmationsDelivery: TargetClientNonces {
195+ latest_nonce: 0, nonces_data: () }
198196[...] [date] DEBUG bridge Received nonces from Millau::MessagesDelivery: SourceClientNonces { new_nonces: {}, confirmed_nonce: Some(0) }
199197[...] [date] DEBUG bridge Asking Millau node about its state
200- [...] [date] DEBUG bridge Received state from Millau node: ClientState { best_self: HeaderId(1593, 0xacac***), best_finalized_self: HeaderId(1590, 0x0be81d...), best_finalized_peer_at_best_self: HeaderId(0, 0xdcdd89...) }
198+ [...] [date] DEBUG bridge Received state from Millau node: ClientState { best_self: HeaderId(1593, 0xacac***), best_finalized_self:
199+ HeaderId(1590, 0x0be81d...), best_finalized_peer_at_best_self: HeaderId(0, 0xdcdd89...) }
201200```
202201
203202To send a message see the [ "How to send a message" section] ( #how-to-send-a-message ) .
204203
205204### How to send a message
206205
207- In this section we'll show you how to quickly send a bridge message. The message is just an encoded XCM
208- ` Trap(43) ` message.
206+ In this section we'll show you how to quickly send a bridge message. The message is just an encoded XCM ` Trap(43) `
207+ message.
209208
210209``` bash
211210# In `parity-bridges-common` folder
@@ -222,20 +221,20 @@ TRACE bridge Sent transaction to Millau node: 0x5e68...
222221And at the Rialto node logs you'll something like this:
223222
224223```
225- ... runtime::bridge-messages: Received messages: total=1, valid=1. Weight used: Weight(ref_time: 1215065371, proof_size: 48559)/Weight(ref_time: 1215065371, proof_size: 54703).
226- ```
224+ ... runtime::bridge-messages: Received messages: total=1, valid=1. Weight used: Weight(ref_time: 1215065371, proof_size:
225+ 48559)/Weight(ref_time: 1215065371, proof_size: 54703).
226+ ```
227227
228- It means that the message has been delivered and dispatched. Message may be dispatched with an
229- error, though - the goal of our test bridge is to ensure that messages are successfully delivered
230- and all involved components are working.
228+ It means that the message has been delivered and dispatched. Message may be dispatched with an error, though - the goal
229+ of our test bridge is to ensure that messages are successfully delivered and all involved components are working.
231230
232231## Full Network Docker Compose Setup
233232
234- For a more sophisticated deployment which includes bidirectional header sync, message passing,
235- monitoring dashboards, etc. see the [ Deployments README] ( ./deployments/README.md ) .
233+ For a more sophisticated deployment which includes bidirectional header sync, message passing, monitoring dashboards,
234+ etc. see the [ Deployments README] ( ./deployments/README.md ) .
236235
237- You should note that you can find images for all the bridge components published on
238- [ Docker Hub] ( https://hub.docker.com/u/paritytech ) .
236+ You should note that you can find images for all the bridge components published on [ Docker
237+ Hub] ( https://hub.docker.com/u/paritytech ) .
239238
240239To run a Rialto node for example, you can use the following command:
241240
@@ -247,13 +246,12 @@ docker run -p 30333:30333 -p 9933:9933 -p 9944:9944 \
247246
248247## Community
249248
250- Main hangout for the community is [ Element] ( https://element.io/ ) (formerly Riot). Element is a chat
251- server like, for example, Discord. Most discussions around Polkadot and Substrate happen
252- in various Element "rooms" (channels). So, joining Element might be a good idea, anyway.
249+ Main hangout for the community is [ Element] ( https://element.io/ ) (formerly Riot). Element is a chat server like, for
250+ example, Discord. Most discussions around Polkadot and Substrate happen in various Element "rooms" (channels). So,
251+ joining Element might be a good idea, anyway.
253252
254- If you are interested in information exchange and development of Polkadot related bridges please
255- feel free to join the [ Polkadot Bridges] ( https://app.element.io/#/room/#bridges:web3.foundation )
256- Element channel.
253+ If you are interested in information exchange and development of Polkadot related bridges please feel free to join the
254+ [ Polkadot Bridges] ( https://app.element.io/#/room/#bridges:web3.foundation ) Element channel.
257255
258- The [ Substrate Technical] ( https://app.element.io/#/room/#substrate-technical:matrix.org ) Element
259- channel is most suited for discussions regarding Substrate itself.
256+ The [ Substrate Technical] ( https://app.element.io/#/room/#substrate-technical:matrix.org ) Element channel is most suited
257+ for discussions regarding Substrate itself.
0 commit comments