From 60d52dec3037b31c615da31ca3a9a26f3ee9836b Mon Sep 17 00:00:00 2001 From: Oleh Bairak <118197764+obmatter@users.noreply.github.com> Date: Mon, 6 Nov 2023 23:50:27 +0700 Subject: [PATCH] chore: new wallet key line instructions for example section (#776) * fix: new line added * fix: use dotenv instead of revealing user key --- docs/dev/how-to/send-message-l2-l1.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/dev/how-to/send-message-l2-l1.md b/docs/dev/how-to/send-message-l2-l1.md index 5273110024..b1fe3cdd8e 100644 --- a/docs/dev/how-to/send-message-l2-l1.md +++ b/docs/dev/how-to/send-message-l2-l1.md @@ -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 = ""; + +import dotenv from "dotenv"; +dotenv.config(); + +const TEST_PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY || ""; const MESSAGE = "Some L2->L1 message";