Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: How to reproduce - Validium Readme #44

Merged
merged 3 commits into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions validium.md → validium_mode_example/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
## Validium
## Validium example

In order to start the node as a validium:
In order to start the node as a validium and run the example follow the next steps.

- Make sure `zk` has been built and then run `zk && zk clean --all && zk init --validium-mode` This will set up the
Ethereum node with the validium contracts, and also define an env var which the server will pick up in order to run as
a validium node.
- Start the server (`zk server`)
- Execute transactions. For testing, run `cargo run --release --bin validium_mode_example`, this test does the
following:
### Run the server

To run this example we need to run the server in validium mode. In the `zksync-era` directory, you can run the following command:

```sh
zk && zk clean --all && zk init --validium-mode && zk server
```

> [!IMPORTANT]
> Make sure that the flag `--validium-mode` is present when initilizing the server.

This will set up the Ethereum node with the validium contracts, and also define an `env` var which the server will pick up in order to run as a validium node.

### Run the example

In this example we're going to run some transactions.

Once the server is running, run this command in other terminal:
```sh
cargo run --release --bin zksync_full_stack
```

This test does the following:
- Inits a wallet
- Deposits some funds into the wallet
- Deploys a sample ERC20 contract
Expand All @@ -25,6 +42,8 @@ In order to start the node as a validium:

### Example output

You will have an output similar to this one:

```
Deposit transaction hash: 0x77f378f1857ad7ff8c1041d2ce0f7f167587a90a19f9fd923c9ea91fbdf37650
Deploy
Expand All @@ -46,4 +65,5 @@ L2 fee: 31366500000000
L1 max fee per gas: 1000000010
```

> [!NOTE] The `transaction hash` is a changing field and the value of the other fields may change depending on the server mode (`rollup` or `validium`).
> [!NOTE]
> You can observe how the diferent fields evolve depending on the operation. The `transaction hash` is a changing field.
Loading