Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
chore: new wallet key line instructions for example section (#776)
Browse files Browse the repository at this point in the history
* fix: new line added

* fix: use dotenv instead of revealing user key
  • Loading branch information
olehbairak authored Nov 6, 2023
1 parent 1a42eef commit 60d52de
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docs/dev/how-to/send-message-l2-l1.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,23 @@ yarn add -D @matterlabs/zksync-contracts
yarn add zksync-web3 ethers@5 typescript @types/node ts-node
```

5. Create a `file.ts` file in the root directory with the next script:
5. In the root folder add `.env` file with private key of wallet to use

```js
"RICH_WALLET_PRIV_KEY=0x..";
```

6. Create a `file.ts` file in the root directory with the next script:

```ts
// The following script sends a message from L2 to L1, retrieves the message proof, and validates that the message received in L1 came from an L2 block.
import * as ethers from "ethers";
import { Provider, utils, Wallet } from "zksync-web3";
const TEST_PRIVATE_KEY = "<YOUR_PRIVATE_KEY>";

import dotenv from "dotenv";
dotenv.config();

const TEST_PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY || "";

const MESSAGE = "Some L2->L1 message";

Expand Down

0 comments on commit 60d52de

Please sign in to comment.