Develop
Prerequisites
Before you start, make sure you have the following installed on your machine:
For local development, you will also need:
Quick start
With existing OP chain
The following steps have been tested on Sepolia, with a previously deployed L2 chain
- locate your
rollup.json
,genesis.json
andstate.json
files - run
make config-main-node OP_NODE_DATA_DIR=<path/to/op-node/data> OP_GETH_DATA_DIR=<path/to/op-geth/data> ROLLUP_JSON=<path/to/rollup.json> GENESIS_JSON=<path/to/genesis.json> STATE_JSON=<path/to/state.json>
- there should be some files set up in
.local_main_node
- start sequencing the main chain with
make start-main-node OP_BATCHER_KEY=<op-batcher-private-key> OP_PROPOSER_KEY=<op-proposer-private-key> MAIN_KEY=<vault-key/main-sequencing key> L1_RPC_URL=<sepolia rpc url> L1_BEACON_RPC_URL=<sepolia beacon rpc url>
- Normally you should see some logs starting
blockscout
should be up and running athttp://0.0.0.0:4000
7a.make stop-main-node
to stop all the sequencing services 7b.make logs-main-node
to output logs of all the main services
Deploy a new l2 chain on Sepolia
- To deploy a new chain on l2, make sure to have an address on Sepolia with some funds. This will be used as the
MAIN
/vault
address. - create 2 more accounts, deposit ~0.2 eth in them. One will be used for the
op-batcher
one for the `op-proposer. - run
make deploy-chain OP_BATCHER_KEY=<op-batcher private key> OP_PROPOSER_KEY=<op-proposer private key> MAIN_KEY=<vault key> L1_RPC_URL=<l1 sepolia rpc url> L1_BEACON_RPC_URL=<l1 sepolia beacon rpc url>
- start sequencing the main chain with
make start-main-node OP_BATCHER_KEY=<op-batcher-private-key> OP_PROPOSER_KEY=<op-proposer-private-key> MAIN_KEY=<vault-key/main-sequencing key> L1_RPC_URL=<sepolia rpc url> L1_BEACON_RPC_URL=<sepolia beacon rpc url>
- Normally you should see some logs starting
blockscout
should be up and running athttp://0.0.0.0:4000
7a.make stop-main-node
to stop all the sequencing services 7b.make logs-main-node
to output logs of all the main services
Run a based-gateway
- run
make start-gateway PORTAL=<portal rpc url> GATEWAY_SEQUENCING_KEY=<private key used to sequence with>
- to stop the based gateway run
make stop-gateway
- for logs
make logs-gateway
Add/Update based-gateways to Registry
When a based-gateway is started with make start-gateway
, it will register itself to the Registry behind the PORTAL
. For now, the Registry is kept in a simple json file in .local_main_node/config/registry.json
. You can add/update/remove gateways there, the Registry and Portal will pick up on the changes every minute.
If you have started both the main sequencing node and the gateway on the same machine, you might need to change the ip to 0.0.0.0
, by default curl ifconfig.me
is used to populate
your url.
You can now test sending a transaction with make test-tx
.
The transaction will be sent to the Portal, and forwarded to the gateway, which will sequence the transaction in a new Frag, and broacast it via p2p to follower nodes.
The Portal is only temporarily acting as a multiplexer for eth_
calls, but we don't expect this to be in the final design.
Logging
To view the logs, run the following:
make logs-main-node // Full main node logs
make logs-gateway // Based gateway and follower node logs
make logs-portal // Based portal logs
make logs-registry // Based registry logs
make logs-op-node // main OP node logs
make logs-op-geth // main OP reth logs