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 build
For production use cases, we leverage PostgreSQL for a few extra features in the sequencer. These features are optional, if you don't want to run them, make sure the sequencer_config.toml
file does not contain the db_config altogether in order to skip using a storage DB backend such as postgres.
If running Postgres is prefered, you can execute the following command:
docker compose -f docker-compose.postgres.yml up -d
this will run postgres in a dockerized daemon mode.
Run on a local da layer, sharable between nodes that run on your computer.
Run sequencer on Mock DA:
./target/debug/citrea --da-layer mock --rollup-config-path resources/configs/mock/sequencer_rollup_config.toml --sequencer-config-path 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 --rollup-config-path resources/configs/mock/sequencer_rollup_config.toml --genesis-paths resources/test-data/demo-tests/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. To also publish mock DA blocks, run this script:
./configs/mock-dockerized/publish_da_block.sh
Run on local Bitcoin network.
Run Bitcoin Regtest:
bitcoind -regtest -txindex=1
Keep this terminal open.
Create bitcoin wallet for Bitcoin DA adapter.
bitcoin-cli -regtest createwallet citreatesting
bitcoin-cli -regtest loadwallet citreatesting
Mine blocks so that the wallet has BTC:
bitcoin-cli -regtest -generate 201
Edit resources/configs/bitcoin-regtest/sequencer_rollup_config.toml
and resources/configs/bitcoin-regtest/sequencer_config.toml
files 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 --da-layer bitcoin --rollup-config-path resources/configs/bitcoin-regtest/sequencer_rollup_config.toml --sequencer-config-path 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 --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
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.
To delete sequencer or full nodes databases run:
make clean-node
To run tests:
make test
This will run cargo nextest
.