github.com/ethereum-optimism/optimism@v1.7.2/op-node/README.md (about)

     1  # op-node
     2  
     3  This is the reference implementation of the [rollup-node spec](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/rollup-node.md).
     4  
     5  ## Compiling
     6  
     7  Compile a binary:
     8  ```shell
     9  cd op-node
    10  go build -o bin/op-node ./cmd
    11  ```
    12  
    13  ## Testing
    14  
    15  Run op-node unit tests:
    16  ```shell
    17  cd op-node
    18  go test ./...
    19  ```
    20  
    21  Run end-to-end tests:
    22  ```shell
    23  cd op-e2e
    24  go test ./...
    25  ```
    26  
    27  ## Running
    28  
    29  Options can be reviewed with:
    30  
    31  ```shell
    32  ./bin/op-node --help
    33  ```
    34  
    35  To start syncing the rollup:
    36  
    37  Connect to at least one L1 RPC and L2 execution engine:
    38  
    39  - L1: use any L1 node / RPC (websocket connection path may differ)
    40  - L2: run the Optimism fork of geth: [`op-geth`](https://github.com/ethereum-optimism/op-geth)
    41  
    42  ```shell
    43  # websockets or IPC preferred for event notifications to improve sync, http RPC works with adaptive polling.
    44  op \
    45    --l1=ws://localhost:8546 --l2=ws//localhost:9001 \
    46    --rollup.config=./path-to-network-config/rollup.json \
    47    --rpc.addr=127.0.0.1 \
    48    --rpc.port=7000
    49  ```
    50  
    51  ## Devnet Genesis Generation
    52  
    53  The `op-node` can generate geth compatible `genesis.json` files. These files
    54  can be used with `geth init` to initialize the `StateDB` with accounts, storage,
    55  code and balances. The L2 state must be initialized with predeploy contracts
    56  that exist in the state and act as system level contracts. The `op-node` can
    57  generate a genesis file with these predeploys configured correctly given
    58  hardhat compilation artifacts, hardhat deployment artifacts, a L1 RPC URL
    59  and a deployment config.
    60  
    61  The hardhat compilation artifacts are produced by `hardhat compile`. The native
    62  hardhat compiler toolchain produces them by default and the
    63  `@foundry-rs/hardhat` plugin can also produce them when using the foundry
    64  compiler toolchain. They can usually be found in an `artifacts` directory.
    65  
    66  The hardhat deployment artifacts are produced by running `hardhat deploy`. These
    67  exist to make it easy to track deployments of smart contract systems over time.
    68  They can usually be found in a `deployments` directory.
    69  
    70  The deployment config contains all of the information required to deploy the
    71  system. It can be found in `packages/contracts-bedrock/deploy-config`. Each
    72  deploy config file can be JSON or TypeScript, although only JSON files are
    73  supported by the `op-node`. The network name must match the name of the file
    74  in the deploy config directory.
    75  
    76  Example usage:
    77  
    78  ```bash
    79  $ op-node genesis devnet-l2 \
    80     --artifacts $CONTRACTS_BEDROCK/artifacts \
    81     --network $NETWORK \
    82     --deployments $CONTRACTS_BEDROCK/deployments \
    83     --deploy-config $CONTRACTS_BEDROCK/deploy-config \
    84     --rpc-url http://localhost:8545 \
    85  ```