This document covers how to run Citrea sequencer and a full node locally using a mock DA layer and Bitcoin Regtest.
Follow the instructions in this document.
Build citrea:
make buildRun on a local da layer, sharable between nodes that run on your computer.
Run sequencer on Mock DA:
./target/debug/citrea --dev --da-layer mock --rollup-config-path resources/configs/mock/sequencer_rollup_config.toml --sequencer resources/configs/mock/sequencer_config.toml --genesis-paths resources/genesis/mock/Sequencer RPC is accessible at 127.0.0.1:12345
Optional: Run full node on Mock DA:
./target/debug/citrea --dev --da-layer mock --rollup-config-path resources/configs/mock/rollup_config.toml --genesis-paths resources/genesis/mock/Full node RPC is accessible at 127.0.0.1:12346
If test_mode is set to false in the sequencer config, the sequencer will publish blocks every 2 seconds.
Optional: Run batch prover on Mock DA:
PARALLEL_PROOF_LIMIT=1 ./target/debug/citrea --dev --da-layer mock --rollup-config-path resources/configs/mock/batch_prover_rollup_config.toml --genesis-paths resources/genesis/mock/ --batch-prover resources/configs/mock/batch_prover_config.tomlOptional: Run light client prover on Mock DA:
./target/debug/citrea --dev --da-layer mock --rollup-config-path resources/configs/mock/light_client_prover_rollup_config.toml --genesis-paths resources/genesis/mock/ --light-client-prover resources/configs/mock/light_client_prover_config.tomlRun on local Bitcoin network.
Run Bitcoin Regtest:
bitcoind -regtest -txindex=1 -addresstype=bech32m -fallbackfee=0.0001Or using docker:
docker compose -f docker/docker-compose.regtest.yml upKeep this terminal open.
Create bitcoin wallet for Bitcoin DA adapter.
bitcoin-cli -regtest createwallet citreatesting
bitcoin-cli -regtest loadwallet citreatestingMine blocks so that the wallet has BTC:
bitcoin-cli -regtest -generate 201Edit resources/configs/bitcoin-regtest/sequencer_config.toml to adjust the sequencer settings.
Edit resources/configs/bitcoin-regtest/sequencer_rollup_config.toml file and put in your rpc url, username and password:
[da]
# fill here
node_url = ""
# fill here
node_username = ""
# fill here
node_password = ""Run sequencer:
./target/debug/citrea --dev --da-layer bitcoin --rollup-config-path resources/configs/bitcoin-regtest/sequencer_rollup_config.toml --sequencer resources/configs/bitcoin-regtest/sequencer_config.toml --genesis-paths resources/genesis/bitcoin-regtest/Sequencer RPC is accessible at 127.0.0.1:12345
Optional: Run full node
Run full node:
./target/debug/citrea --dev --da-layer bitcoin --rollup-config-path resources/configs/bitcoin-regtest/rollup_config.toml --genesis-paths resources/genesis/bitcoin-regtest/Full node RPC is accessible at 127.0.0.1:12346
Optional: Run batch prover:
PARALLEL_PROOF_LIMIT=1 ./target/debug/citrea --dev --da-layer bitcoin --rollup-config-path resources/configs/bitcoin-regtest/batch_prover_rollup_config.toml --batch-prover resources/configs/bitcoin-regtest/batch_prover_config.toml --genesis-paths resources/genesis/bitcoin-regtestIf you want to test proofs, make sure to set proof_sampling_number in resources/configs/bitcoin-regtest/batch_prover_config.toml to 0, and you can set the max_l2_blocks_per_commitment to a number between 5-50, as higher numbers than that take too long even if you run the prover in execute mode.
To publish blocks on Bitcoin Regtest, run the sequencer with test_mode in sequencer config set to false and blocks will be published every two seconds.
Optional: Run light client prover:
./target/debug/citrea --dev --da-layer bitcoin --rollup-config-path resources/configs/bitcoin-regtest/light_client_prover_rollup_config.toml --light-client-prover resources/configs/bitcoin-regtest/light_client_prover_config.toml --genesis-paths resources/genesis/bitcoin-regtestTo delete sequencer or full nodes databases run:
make clean-nodeIf you want to run both the sequencer and the batch prover, it's a good idea to create different bitcoin wallets for each.
Then the wallets can be used separately by modifying rollup_config.toml files for both nodes like so:
# sequencer_rollup_config.toml
[da]
# node_url = "http://HOST:PORT/wallet/wallet-name"
node_url = "http://0.0.0.0:18433/wallet/sequencer-wallet"
# batch_prover_rollup_config.toml
[da]
# node_url = "http://HOST:PORT/wallet/wallet-name"
node_url = "http://0.0.0.0:18433/wallet/batch-prover-wallet"Both wallets should be funded by running
bitcoin-cli -regtest -rpcwallet=wallet-name -generate 201If your testing of the local network requires mining sequencer commitments and batch proofs, run in a separate terminal:
bitcoin-cli -regtest -generateOr you can run this command in a separate terminal to periodically mine new regtest blocks:
while true; do; bitcoin-cli -regtest -generate; sleep 10; done;To run tests:
make testThis will run cargo nextest, which will run all Rust tests inside the repo. As our e2e tests use docker, docker engine should be on when this is ran.
To run smart contract tests:
cd crates/evm/src/evm/system_contracts
forge test