github.com/0xPolygon/supernets2-node@v0.0.0-20230711153321-2fe574524eaa/docs/running_local.md (about)

     1  # Steps to run/develop on the environment locally
     2  
     3  # Warning:
     4  
     5  >Currently the Executor/Prover does not run on ARM-powered Macs. For Windows users, WSL/WSL2 use is not recommended. 
     6  
     7  ## Overview
     8  
     9  This documentation will help you running the following components:
    10  
    11  - zkEVM Node Databases
    12  - Explorer Databases
    13  - L1 Network
    14  - Prover
    15  - zkEVM Node components
    16  - Explorers
    17  
    18  ## Requirements
    19  
    20  The current version of the environment requires `go`, `docker` and `docker-compose` to be previously installed, check the links below to understand how to install them:
    21  
    22  - <https://go.dev/doc/install>
    23  - <https://www.docker.com/get-started>
    24  - <https://docs.docker.com/compose/install/>
    25  
    26  The `supernets2-node` docker image must be built at least once and every time a change is made to the code.
    27  If you haven't build the `supernets2-node` image yet, you must run:
    28  
    29  ```bash
    30  make build-docker
    31  ```
    32  
    33  ## A look at how the binary works:
    34  
    35  The `supernets2-node` allows certain commands to interact with smart contracts, run certain components, create encryption files and print out debug information.
    36  
    37  To interact with the binary program we provide docker compose files, and a Makefile to spin up/down the different services and components, ensuring a smooth deployment locally and better interface in command line for developers.
    38  
    39  ## Controlling the environment
    40  
    41  > All the data is stored inside of each docker container, this means once you remove the container, the data will be lost.
    42  
    43  To run the environment:
    44  
    45  The `test/` directory contains scripts and files for developing and debugging.
    46  
    47  ```bash
    48  cd test/
    49  ```
    50  
    51  Then:
    52  
    53  ```bash
    54  make run
    55  ```
    56  
    57  To stop the environment:
    58  
    59  ```bash
    60  make stop
    61  ```
    62  
    63  To restart the environment:
    64  
    65  ```bash
    66  make restart
    67  ```
    68  
    69  ## Sample data
    70  
    71  The `make run` will execute the containers needed to run the environment but this will not execute anything else, so the L2 will be basically empty.
    72  
    73  If you need sample data already deployed to the network, we have the following scripts:
    74  
    75  **To add some examples of transactions and smart contracts:**
    76  
    77  ```bash
    78  make deploy-sc
    79  ```
    80  
    81  **To deploy a full a uniswap environment:**
    82  
    83  ```bash
    84  make deploy-uniswap
    85  ```
    86  
    87  **To grant the Matic smart contract a set amount of tokens, run:**
    88  
    89  ```bash
    90  make run-approve-matic
    91  ```
    92  
    93  ## Accessing the environment
    94  
    95  - **Databases**:
    96    - zkEVM Node *State* Database 
    97      - `Type:` Postgres DB
    98      - `User:` state_user
    99      - `Password:` state_password
   100      - `Database:` state-db
   101      - `Host:` localhost
   102      - `Port:` 5432
   103      - `Url:` <postgres://state_user:srare_password@localhost:5432/state-db>
   104    - zkEVM Node *Pool* Database 
   105      - `Type:` Postgres DB
   106      - `User:` pool_user
   107      - `Password:` pool_password
   108      - `Database:` pool_db
   109      - `Host:` localhost
   110      - `Port:` 5433
   111      - `Url:` <postgres://pool_user:pool_password@localhost:5433/pool_db>
   112    - zkEVM Node *JSON-RPC* Database 
   113      - `Type:` Postgres DB
   114      - `User:` rpc_user
   115      - `Password:` rpc_password
   116      - `Database:` rpc_db
   117      - `Host:` localhost
   118      - `Port:` 5434
   119      - `Url:` <postgres://rpc_user:rpc_password@localhost:5434/rpc_db>
   120    - Explorer L1 Database
   121      - `Type:` Postgres DB
   122      - `User:` l1_explorer_user
   123      - `Password:` l1_explorer_password
   124      - `Database:` l1_explorer_db
   125      - `Host:` localhost
   126      - `Port:` 5435
   127      - `Url:` <postgres://l1_explorer_user:l1_explorer_password@localhost:5435/l1_explorer_db>
   128    - Explorer L2 Database
   129      - `Type:` Postgres DB
   130      - `User:` l2_explorer_user
   131      - `Password:` l2_explorer_password
   132      - `Database:` l2_explorer_db
   133      - `Host:` localhost
   134      - `Port:` 5436
   135      - `Url:` <postgres://l2_explorer_user:l2_explorer_password@localhost:5436/l2_explorer_db>
   136  - **Networks**:
   137    - L1 Network
   138      - `Type:` Geth
   139      - `Host:` localhost
   140      - `Port:` 8545
   141      - `Url:` <http://localhost:8545>
   142    - zkEVM Node
   143      - `Type:` JSON RPC
   144      - `Host:` localhost
   145      - `Port:` 8123
   146      - `Url:` <http://localhost:8123>
   147  - **Explorers**:
   148    - Explorer L1
   149      - `Type:` Web
   150      - `Host:` localhost
   151      - `Port:` 4000
   152      - `Url:` <http://localhost:4000>
   153    - Explorer L2
   154      - `Type:` Web
   155      - `Host:` localhost
   156      - `Port:` 4001
   157      - `Url:` <http://localhost:4000>
   158  - Prover
   159    - `Type:` Mock
   160    - `Host:` localhost
   161    - `Port:` Depending on the prover image, if it's mock or not: 
   162      - Prod prover: 50052 for Prover, 50061 for Merkle Tree, 50071 for Executor
   163      - Mock prover: 43061 for MT, 43071 for Executor
   164    - `Url:` <http://localhost:50001>
   165  ## Metamask
   166  
   167  > Metamask requires the network to be running while configuring it, so make sure your network is running before starting.
   168  
   169  To configure your Metamask to use your local environment, follow these steps:
   170  
   171  1. Log in to your Metamask wallet
   172  2. Click on your account picture and then on Settings
   173  3. On the left menu, click on Networks
   174  4. Click on `Add Network` button
   175  5. Fill up the L2 network information
   176      1. `Network Name:` Polygon zkEVM - Local
   177      2. `New RPC URL:` <http://localhost:8123>
   178      3. `ChainID:` 1001
   179      4. `Currency Symbol:` ETH
   180      5. `Block Explorer URL:` <http://localhost:4000>
   181  6. Click on Save
   182  7. Click on `Add Network` button
   183  8. Fill up the L1 network information
   184      1. `Network Name:` Geth - Local
   185      2. `New RPC URL:` <http://localhost:8545>
   186      3. `ChainID:` 1337
   187      4. `Currency Symbol:` ETH
   188  9. Click on Save
   189  
   190  ## L1 Addresses
   191  
   192  | Address | Description |
   193  |---|---|
   194  | 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 | Proof of Efficiency |
   195  | 0xff0EE8ea08cEf5cb4322777F5CC3E8A584B8A4A0 | Bridge |
   196  | 0x5FbDB2315678afecb367f032d93F642f64180aa3 | Matic token |
   197  | 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6 | GlobalExitRootManager |
   198  
   199  ## Deployer Account
   200  
   201  | Address | Private Key |
   202  |---|---|
   203  | 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 |
   204  
   205  ## Sequencer Account
   206  
   207  | Address | Private Key |
   208  |---|---|
   209  | 0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D | 0x28b2b0318721be8c8339199172cd7cc8f5e273800a35616ec893083a4b32c02e |
   210  
   211  ## Accounts
   212  
   213  | Address | Private Key |
   214  |---|---|
   215  | 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 | 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d |
   216  | 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC | 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a |
   217  | 0x90F79bf6EB2c4f870365E785982E1f101E93b906 | 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 |
   218  | 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 | 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a |
   219  | 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc | 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba |
   220  | 0x976EA74026E726554dB657fA54763abd0C3a0aa9 | 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e |
   221  | 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 | 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 |
   222  | 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f | 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 |
   223  | 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 | 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 |
   224  | 0xBcd4042DE499D14e55001CcbB24a551F3b954096 | 0xf214f2b2cd398c806f84e317254e0f0b801d0643303237d97a22a48e01628897 |
   225  | 0x71bE63f3384f5fb98995898A86B02Fb2426c5788 | 0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82 |
   226  | 0xFABB0ac9d68B0B445fB7357272Ff202C5651694a | 0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1 |
   227  | 0x1CBd3b2770909D4e10f157cABC84C7264073C9Ec | 0x47c99abed3324a2707c28affff1267e45918ec8c3f20b8aa892e8b065d2942dd |
   228  | 0xdF3e18d64BC6A983f673Ab319CCaE4f1a57C7097 | 0xc526ee95bf44d8fc405a158bb884d9d1238d99f0612e9f33d006bb0789009aaa |
   229  | 0xcd3B766CCDd6AE721141F452C550Ca635964ce71 | 0x8166f546bab6da521a8369cab06c5d2b9e46670292d85c875ee9ec20e84ffb61 |
   230  | 0x2546BcD3c84621e976D8185a91A922aE77ECEc30 | 0xea6c44ac03bff858b476bba40716402b03e41b8e97e276d1baec7c37d42484a0 |
   231  | 0xbDA5747bFD65F08deb54cb465eB87D40e51B197E | 0x689af8efa8c651a91ad287602527f3af2fe9f6501a7ac4b061667b5a93e037fd |
   232  | 0xdD2FD4581271e230360230F9337D5c0430Bf44C0 | 0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0 |
   233  | 0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199 | 0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e |