Skip to content

Commit

Permalink
guide
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Jul 17, 2024
1 parent e7a458f commit a79a4fc
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions v2_localnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The new architecture aims to streamline the developer experience for building Un
* `GatewayEVM`: Deployed on each connected chain to interact with ZetaChain.
* `GatewayZEVM`: Deployed on ZetaChain to interact with connected chains.

V2 contracts source code is currently located in [prototypes](/contracts/prototypes/)

## Contract Interfaces

Expand Down Expand Up @@ -92,4 +93,47 @@ Note: `--hide="NODE"` is used to prevent verbose logging
```
yarn
yarn localnet --hide="NODE"
```

The `localnet` command launches two processes:

- A local Ethereum network (using Anvil) with the two gateway contracta deployed
- A background worker that relay messages between the two gateway contracts. It simulates the cross-chain message relaying that would normally happen between live networks with the [observers/signers](https://www.zetachain.com/docs/developers/architecture/observers/). This allows to simulate a cross-chain environment on a single local chain.

Running the command will deploy the two gateway contracts:

```
[WORKER] GatewayEVM: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
[WORKER] GatewayZEVM: 0x0165878A594ca255338adfa4d48449f69242Eb8F
```

The developers can develop application using these addresses, the messages will automatically be relayed by the worker.

The local environment uses Anvil. Therefore, the default Anvil accounts can be used to interact with the network.

```
Account #0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 ETH)
Private Key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Account #1: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000 ETH)
Private Key: 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
Account #2: 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000 ETH)
Private Key: 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
```

### Examples

The example contracts demonstrate how the V2 interface can be leveraged to build Universal Apps.

* [TestZContract](/contracts/prototypes/zevm/TestZContract.sol): ZetaChain contract (Universal App) that can be called from a connected chains
* [SenderZEVM](/contracts/prototypes/zevm/SenderZEVM.sol): ZetaChain contract calling a smart contract on a connected chains
* [ReceiverEVM](/contracts/prototypes/evm/ReceiverEVM.sol): contract on connected chain that can be called from ZetaChain

The following commands can be used to test interactions between these contracts:
```
npx hardhat zevm-call --network localhost
npx hardhat zevm-withdraw-and-call --network localhost
npx hardhat evm-call --network localhost
npx hardhat evm-deposit-and-call --network localhost
```

0 comments on commit a79a4fc

Please sign in to comment.