Skip to content

Commit 1573dcc

Browse files
fix(mr): update README to reflect latest version
1 parent dfd5ac6 commit 1573dcc

3 files changed

Lines changed: 31 additions & 56 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ packages/data-transport-layer/db
2424

2525
.env
2626
.env*
27+
!.env.example
2728
*.log
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# URL pointing to an L1 RPC provider
2+
MESSAGE_RELAYER__L1RPCPROVIDER=
3+
4+
# URL pointing to an L2 RPC provider
5+
MESSAGE_RELAYER__L2RPCPROVIDER=
6+
7+
# Private key for a wallet with ETH on L1
8+
MESSAGE_RELAYER__L1WALLET=
9+
10+
# Optional, L2 block height to start relaying messages from (default is 0)
11+
MESSAGE_RELAYER__FROML2TRANSACTIONINDEX=

packages/message-relayer/README.md

Lines changed: 19 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,33 @@
1-
[![codecov](https://codecov.io/gh/ethereum-optimism/optimism/branch/master/graph/badge.svg?token=0VTG7PG7YR&flag=message-relayer)](https://codecov.io/gh/ethereum-optimism/optimism)
21
# @eth-optimism/message-relayer
32

4-
This package contains:
5-
6-
1. A service for relaying messages from L2 to L1.
7-
2. Utilities for finding these messages and relaying them.
3+
`message-relayer` is a service that automatically finalizes ("relays") messages sent from Optimism to Ethereum.
4+
This package is meant to be used during local development and should NOT be used on a production network.
85

96
## Installation
107

8+
Clone, install, and build the Optimism monorepo:
9+
1110
```
12-
yarn add @eth-optimism/message-relayer
11+
git clone https://github.com/ethereum-optimism/optimism.git
12+
yarn install
13+
yarn build
1314
```
1415

15-
## Relay Utilities
16-
17-
### getMessagesAndProofsForL2Transaction
18-
19-
Finds all L2 => L1 messages sent in a given L2 transaction and generates proof for each.
20-
21-
#### Usage
16+
## Running the relayer (Docker)
2217

23-
```typescript
24-
import { getMessagesAndProofsForL2Transaction } from '@eth-optimism/message-relayer'
18+
The `message-relayer` can be included as part of the [local Optimism development environment](https://community.optimism.io/docs/developers/build/dev-node/).
19+
Although the `message-relayer` is not turned on by default, it can be enabled by [changing this line in docker-compose.yml](https://github.com/ethereum-optimism/optimism/blob/51a527b8e3fe69940fb8c0f5e4aa2e0ae8ee294c/ops/docker-compose.yml#L129) to:
2520

26-
const main = async () => {
27-
const l1RpcProviderUrl = 'https://layer1.endpoint'
28-
const l2RpcProviderUrl = 'https://layer2.endpoint'
29-
const l1StateCommitmentChainAddress = 'address of StateCommitmentChain from deployments page'
30-
const l2CrossDomainMessengerAddress = 'address of L2CrossDomainMessenger from deployments page'
31-
const l2TransactionHash = 'hash of the transaction with messages to relay'
32-
33-
const messagePairs = await getMessagesAndProofsForL2Transaction(
34-
l1RpcProviderUrl,
35-
l2RpcProviderUrl,
36-
l1StateCommitmentChainAddress,
37-
l2CrossDomainMessengerAddress,
38-
l2TransactionHash
39-
)
21+
```
22+
replicas: 1
23+
```
4024

41-
console.log(messagePairs)
42-
// Will log something along the lines of:
43-
// [
44-
// {
45-
// message: {
46-
// target: '0x...',
47-
// sender: '0x...',
48-
// message: '0x...',
49-
// messageNonce: 1234...
50-
// },
51-
// proof: {
52-
// // complicated
53-
// }
54-
// }
55-
// ]
25+
## Running the relayer (manual)
5626

57-
// You can then do something along the lines of:
58-
// for (const { message, proof } of messagePairs) {
59-
// await l1CrossDomainMessenger.relayMessage(
60-
// message.target,
61-
// message.sender,
62-
// message.message,
63-
// message.messageNonce,
64-
// proof
65-
// )
66-
// }
67-
}
27+
The `message-relayer` can also be run manually.
28+
Copy `.env.example` into a new file named `.env`, then set the environment variables listed there.
29+
Once your environment variables have been set, run the relayer via:
6830

69-
main()
31+
```
32+
yarn start
7033
```

0 commit comments

Comments
 (0)