Skip to content
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
3fce9f3
chore: move rabby under deps/rabby
Karrq Nov 26, 2025
de3bdbd
feat(deps): fetch external deps
Karrq Nov 26, 2025
61ad03c
refactor: based/docker
Karrq Nov 26, 2025
417f80a
fix(metrics-exporter): remove reth reference
Karrq Nov 26, 2025
2518ffd
feat(docs): Justfile
Karrq Nov 27, 2025
cac8547
feat(gateway): justfile
Karrq Nov 27, 2025
b443674
refactor: avoid import, invoke instead
Karrq Nov 27, 2025
8d58c97
feat: main node cfg
Karrq Nov 27, 2025
f2daee2
feat: deploy.just
Karrq Nov 28, 2025
d508aab
chore: rename task
Karrq Nov 28, 2025
6c12916
fix(main-node): typos
Karrq Nov 30, 2025
31e2bee
feat: logs
Karrq Nov 30, 2025
17302d1
feat(just): tests
Karrq Dec 1, 2025
d07d392
chore: restore rabby at ./rabby
Karrq Dec 1, 2025
0262ea5
fix: gateway -> follower-node
Karrq Dec 1, 2025
4cb46fb
feat: remaining tests
Karrq Dec 1, 2025
efeeac7
docs: update README
Karrq Dec 1, 2025
641c6df
Merge remote-tracking branch 'origin/develop' into refactor/devex
Karrq Dec 1, 2025
f4151d4
fix: deploy-chain
Karrq Dec 2, 2025
7bce162
fix: logs
Karrq Dec 2, 2025
346ce4b
fix: register-gateway
Karrq Dec 2, 2025
9095c4a
fix(test): continue lines
Karrq Dec 2, 2025
288d604
fix: deploy-chain populate-intent call
Karrq Dec 3, 2025
f51a4f5
fix: PR review
Karrq Dec 3, 2025
23c83c2
refactor: deps module as invocation
Karrq Dec 3, 2025
dcaafa0
fix: _populate-intent location
Karrq Dec 3, 2025
281d109
working reset-and-start-full-stack-local
BrycePy Dec 3, 2025
0465f28
fix
BrycePy Dec 3, 2025
79cfb91
increase overseer start delay
BrycePy Dec 3, 2025
f8dfea3
update example port
BrycePy Dec 3, 2025
a97d86c
feat: wallet backup
Karrq Dec 3, 2025
047e831
fix: wallet backup
Karrq Dec 3, 2025
1bade95
fix: wallet typo
Karrq Dec 3, 2025
d9d7794
feat: reset follower/main node
Karrq Dec 3, 2025
dd3bf87
feat: ci script & deployed chain assets
Karrq Dec 4, 2025
68e952e
feat(script): peering
Karrq Dec 4, 2025
9342fd7
fix + peering
BrycePy Dec 4, 2025
71441c6
fix(just): peering
Karrq Dec 4, 2025
a5000bf
feat: ci script from main justfile
Karrq Dec 4, 2025
ba0cf45
fix: peering force local enode
Karrq Dec 5, 2025
fd626fd
feat: .env.example
Karrq Dec 5, 2025
a159d78
fix: local address for multiaddress
Karrq Dec 8, 2025
c233e68
fix(make): DisputeGameFactoryProxy
Karrq Dec 8, 2025
84a8754
feat(compose): prod/dev setup
Karrq Dec 8, 2025
b166d39
feat(ci): integration test
Karrq Dec 8, 2025
16b25d6
fix(ci): export correct image
Karrq Dec 9, 2025
d56e492
feat: parallel build
Karrq Dec 9, 2025
acd4c22
fix(dev): container-name
Karrq Dec 9, 2025
f3b8249
fix(ci): run against develop branch too
Karrq Dec 9, 2025
da232b9
fix: parallel deps build
Karrq Dec 9, 2025
d730c32
fix(ci): checkout repo
Karrq Dec 9, 2025
c975396
fix(ci): use .env.example
Karrq Dec 9, 2025
dcf5bb2
fix(ci): remove keys from .env.example
Karrq Dec 9, 2025
9b77a7e
fix(ci): ensure LOCAL_DATA
Karrq Dec 9, 2025
c8d92fc
fix(ci): upload hidden .local
Karrq Dec 9, 2025
e504978
fix(ci): ignore .local/data
Karrq Dec 9, 2025
d269ad7
fix(ci): ignore config artifact
Karrq Dec 9, 2025
df4feef
fix(ci): BASED_OP_GETH_PORT from .env
Karrq Dec 9, 2025
04f989d
fix(scripts): intent permission
Karrq Dec 9, 2025
ad81b94
feat(ci): upgrade chain config
Karrq Dec 10, 2025
54a07e8
feat(ci): workflow_call only
Karrq Dec 10, 2025
3902554
feat(ci): integration triggers
Karrq Dec 10, 2025
0cb8699
fix(ci): config-with-deploy
Karrq Dec 10, 2025
1ac5f43
feat(ci): layer caching
Karrq Dec 10, 2025
2aaf15e
fix: more robust wallet keys
Karrq Dec 29, 2025
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ based/temp_registry.json
temp
webcontrol
data
*.py

*.py

/dist
/.local
86 changes: 86 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
set dotenv-load

export LOCAL_DATA := canonicalize(env("LOCAL_DATA", shell('mkdir -p .local && echo ".local"')))

mod deps

# Verifies that system dependencies are present
@check:
echo "jq: {{require('jq')}}"
echo "docker: {{require('docker')}}"
echo "cast: {{require('cast')}}"
echo "rustup: {{require('rustup')}}"

# Prepare the local environment: fetch deps, build them, setup toolchains...
@prepare:
just deps::fetch
cd docs && npm i
cd based && rustup toolchain install

# 🏗️ Build
@build: deps::build
just -f based/docker/Justfile all

# 📚 Build local docs
docs:
just -f docs/Justfile serve

# Build and link rabby in the configured output folder
rabby out="./dist":
just -f deps/rabby.just build
ln -s deps/rabby/dist {{out}}/rabby
ln -s deps/rabby/dist-mv2 {{out}}/rabby-mv2

## Component access (component verb)

# Run recipes from scripts/spamoor.just
spamoor *args=("start ./spamoor-config.yml"):
just -f scripts/spamoor.just {{args}}

# Run recipes from scripts/overseer.just
overseer *args=("start"):
just -f based/overseer.just {{args}}

# Run recipes from based/portal.just
portal *args:
just -f based/portal.just {{args}}

# Run recipes from based/registry.just
registry *args:
just -f based/registry.just {{args}}

# Run recipes from based/main-node.just
main-node *args:
just -f based/main-node.just {{args}}

# Run recipes from based/follower-node.just
follower-node *args:
just -f based/follower-node.just {{args}}

# Run recipes from based/monitoring.just
monitoring *args:
just -f scripts/monitoring.just {{args}}

## Action access (verb component)

# View logs for the given service
logs name:
just -f scripts/logs.just {{name}}

# Start the given service
start name:
just -f {{justfile()}} {{name}} start

# Stop the given service
stop name:
just -f {{justfile()}} {{name}} stop

# Run a test recipe described in scripts/test.just
test name:
just -f scripts/test.just {{name}}

# TODO: setup main node, start main node, setup follower-node, start follower-node (& gateway)
#
# TODO: consider some sort of interactive config if needed
quick-start:
exit 1
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@
The following steps have been tested on Sepolia, with a previously deployed L2 chain

1. locate your `rollup.json`, `genesis.json` and `state.json` files
2. 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>`
3. there should be some files set up in `.local_main_node`
4. 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>`
2. run `just main-node create-config /path/to/folder/with/{rollup.json, genesis.json, state.json}`
3. there should be some files set up in `.local/local_main_node`
4. start sequencing the main chain with `just start main-node`, ensuring `OP_PROPOSER_KEY`, `OP_BATCHER_KEY` and `OP_SEQUENCER_KEY` environment variables are set with the private key of the corresponding entity for the chain
5. Normally you should see some logs starting
6. `blockscout` should be up and running at `http://0.0.0.0:4000`
7a. `make stop-main-node` to stop all the sequencing services
7b. `make stop-monitoring` to stop all monitoring services (Grafana, Prometheus, etc)
7c. `make logs-main-node` to output logs of all the main services
7a. `just stop main-node` to stop all the sequencing services
7b. `just stop monitoring` to stop all monitoring services (Grafana, Prometheus, etc)
7c. `just logs main-node` to output logs of all the main services

### Deploy a new l2 chain on Sepolia

1. 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.
2. create 2 more accounts, deposit ~0.2 eth in them. One will be used for the `op-batcher` one for the `op-proposer.
3. run `make deploy-chain OP_BATCHER_KEY=<op-batcher private key> OP_PROPOSER_KEY=<op-proposer private key> MAIN_KEY=<vault key>`
4. 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>`
2. create 2 more accounts, deposit ~0.2 eth in them. One will be used for the `op-batcher` one for the `op-proposer`.
3. run `just main-node config-with-deploy`, ensuring `OP_BATCHER_KEY`, `OP_PROPOSER_KEY` and `OP_SEQUENCER_KEY` environment variables are set with the private key of the corresponding entity for your new chain
4. start sequencing the main chain with `just main-node start`, ensuring the same environment variables as set
5. Normally you should see some logs starting
6. `blockscout` should be up and running at `http://0.0.0.0:4000`
7a. `make stop-main-node` to stop all the sequencing services
7b. `make stop-monitoring` to stop all monitoring services (Grafana, Prometheus, etc)
7c. `make logs-main-node` to output logs of all the main services
7a. `just stop main-node` to stop all the sequencing services
7b. `just stop monitoring` to stop all monitoring services (Grafana, Prometheus, etc)
7c. `just logs main-node` to output logs of all the main services

### Run a Based Gateway

Expand All @@ -35,7 +35,7 @@ With that default config, a new `private-key` and `wallet` combo will be generat
The `wallet` is communicated back to the `Portal` to be gossiped around to the rest of the network for signature verification.

The following single command sets up everything and will start your `Gateway`, `Based OP-node`, `Based OP-geth`:
`git clone https://github.com/gattaca-com/based-op && cd based-op && make start-gateway`
`git clone https://github.com/gattaca-com/based-op && cd based-op && just start follower-node`

If everything went well, you should see a terminal UI appear, called the `Overseer`:

Expand All @@ -44,29 +44,29 @@ If everything went well, you should see a terminal UI appear, called the `Overse
This shows you the status of your local `Gateway` and a general overview of the chain.
You can press left and right keys to cycle between the different tabs and explore all the information!

The configuration that was generated can be found in `based-op/.local_gateway_and_follower`, mainly the `.env` and `compose.yml` files.
The configuration that was generated can be found in `based-op/.local/gateway_and_follower`, mainly the `.env` and `compose.yml` files.

When you [spam some transactions with `based-bmf`](https://based-bmf.gattaca.com), you should see them appear in the `Transaction Pool` of your `Gateway`.

A couple of commands tend to come in handy (from the top `based-op` directory):

- `make stop-gateway`
- `make start-gateway`
- `make start-overseer`
- `make logs-gateway`
- `make logs-based-op-node`
- `make logs-based-op-geth`
- `just stop follower-node`
- `just start follower-node`
- `just start overseer`
- `just logs follower-node`
- `just logs based-op-node`
- `just logs based-op-geth`

### 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.
When a based-gateway is started with `just follower-node start`, 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.

### Send your first tx

You can now test sending a transaction with `make test-tx`.
You can now test sending a transaction with `just 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.

> [!IMPORTANT]
Expand All @@ -78,10 +78,10 @@ The transaction will be sent to the Portal, and forwarded to the gateway, which
Wallets commonly use a high polling interval for the transaction receipt. To be able to see the preconfirmation speed, we modify Rabby to speed up that interval. You can test it compiling it:

```sh
make build-rabby-chrom
just rabby
```

And importing it to your browser locally (see [Firefox](https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox/) or [Chrome](https://developer.chrome.com/docs/extensions/get-started/tutorial/hello-world?hl=es-419#load-unpacked) references). The compiled extension directory is `rabby/dist` for Google Chrome, and `rabby/dist-mv2` for Mozilla Firefox.
And importing it to your browser locally (see [Firefox](https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox/) or [Chrome](https://developer.chrome.com/docs/extensions/get-started/tutorial/hello-world?hl=es-419#load-unpacked) references). The compiled extension directory is `dist/rabby` for Google Chrome, and `dist/rabby-mv2` for Mozilla Firefox.

### Connecting your local wallet to your local follower node

Expand Down
23 changes: 23 additions & 0 deletions based/docker/Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
set quiet

suppress_output := env("QUIET", "true")
quiet := if suppress_output == "true" { "--quiet > /dev/null 2>&1 " } else { "" }

# Build the docker image from the corresponding `.Dockerfile`
build image *args:
echo "Building {{image}}..."
docker build -t local_based_{{image}} -f ./{{image}}.Dockerfile ../ {{args}} \
{{quiet}}

build-portal: (build "portal")
build-registry: (build "registry")
build-gateway: (build "gateway")
build-txproxy: (build "txproxy")
build-metrics-exporter: (build "metrics-exporter" "--load")

[parallel]
all: build-portal build-registry build-gateway build-txproxy build-metrics-exporter

# Creates the docker network `name` if it doesn't already exist
create-network name="based_op_net":
docker network inspect {{name}} > /dev/null 2>&1 || docker network create {{name}}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ RUN apt-get update && apt-get install -y clang

FROM chef AS planner
COPY . .
RUN --mount=from=reth,target=/reth cargo chef prepare --recipe-path recipe.json
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json

RUN --mount=from=reth,target=/reth cargo chef cook --release --recipe-path recipe.json
RUN cargo chef cook --release --recipe-path recipe.json

COPY . .
RUN --mount=from=reth,target=/reth cargo build --release --bin bop-metrics-exporter
RUN cargo build --release --bin bop-metrics-exporter


FROM debian:stable-slim AS runtime
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading