This guide goes over how to run a full node for Citrea mainnet.
It demonstrates different methods for running required software.
Citrea mainnet uses Bitcoin mainnet as its DA and settlement layer.
So running a Citrea fullnode requires a fully synced Bitcoin mainnet node.
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
git checkout v30.0Then follow the instructions on the links below for the build. However, don't clone the repository since we already did.
OSX: https://github.com/bitcoin/bitcoin/blob/v30.0/doc/build-osx.md
Linux: https://github.com/bitcoin/bitcoin/blob/v30.0/doc/build-unix.md
After the setup, execute these commands to run a Bitcoin mainnet node:
bitcoind -daemon -txindex=1 -rpcbind=0.0.0.0 -rpcport=8332 -rpcuser=citrea -rpcpassword=citreaYou can edit RPC parameters as you wish, but you also have to edit rollup_config.toml
Follow instructions to install Docker here: https://docs.docker.com/engine/install/
After Docker is installed, run this command to pull Bitcoin v0.30.0 image and run it as a container:
docker run -d \
-v ${PWD}/bitcoin-mainnet:/home/bitcoin/.bitcoin \
--name bitcoin-mainnet \
-p 8332:8332 \
-p 8333:8333 \
bitcoin/bitcoin:30.0 \
-printtoconsole \
-rest \
-rpcbind=0.0.0.0 \
-rpcallowip=0.0.0.0/0 \
-rpcport=8332 \
-rpcuser=citrea \
-rpcpassword=citrea \
-server \
-txindex=1You can edit RPC parameters as you wish, but you have to also edit rollup_config.toml
There are three different ways to run a Citrea full node: using a pre-built binary, building from source and using docker.
Before continuing we suggest creating a citrea/ directory and executing these commands in that directory.
Go to this webpage and download latest binary for your operating system under "Assets" section.
Run this command to download full node config and mainnet genesis files:
curl https://raw.githubusercontent.com/chainwayxyz/citrea/nightly/resources/configs/mainnet/rollup_config.toml --output rollup_config.toml
mkdir -p genesis
curl https://raw.githubusercontent.com/chainwayxyz/citrea/nightly/resources/genesis/mainnet/evm.json --output genesis/evm.json
curl https://raw.githubusercontent.com/chainwayxyz/citrea/nightly/resources/genesis/mainnet/accounts.json --output genesis/accounts.json
curl https://raw.githubusercontent.com/chainwayxyz/citrea/nightly/resources/genesis/mainnet/l2_block_rule_enforcer.json --output genesis/l2_block_rule_enforcer.jsonLook through the rollup_config.toml and apply changes as you wish, if you modified any Bitcoin RPC configs, change corresponding values under [da].
Optional: Enable Pruning
To manage disk space, you can enable pruning by adding this to rollup_config.toml:
[runner.pruning_config]
distance = 129600 # Keep last 3 days of blocksOr set via environment variable:
export PRUNING_DISTANCE=129600Without pruning, the database grows continuously. With pruning enabled, old blocks are automatically removed while keeping recent history. See Pruning documentation for details.
Finally run this command to run your Citrea full node:
Mac:
./citrea-v2.3.1-osx-arm64 --network mainnet --da-layer bitcoin --rollup-config-path ./rollup_config.toml --genesis-paths ./genesisor if you wish to use environment variables for configuring your node:
SEQUENCER_PUBLIC_KEY=03516a66ea4bc3dab67f94dd356edb4eee00a7b33ffe1ab5a1422de5c7c42df4d6 \
SEQUENCER_DA_PUB_KEY=032a31a1fa359abd2e6fc1136b4dea711e5f18618504e021084cc61099f72bb2bd \
PROVER_DA_PUB_KEY=038e501ede61097973e49e714d5f2ad740c82b798bb90fda427fd5138e51f2398e \
NODE_URL=http://0.0.0.0:8332 \
NODE_USERNAME=citrea \
NODE_PASSWORD=citrea \
NETWORK=mainnet \
TX_BACKUP_DIR="" \
STORAGE_PATH=resources/dbs \
DB_MAX_OPEN_FILES=5000 \
RPC_BIND_HOST=0.0.0.0 \
RPC_BIND_PORT=8080 \
RPC_MAX_CONNECTIONS=100 \
RPC_MAX_REQUEST_BODY_SIZE=10485760 \
RPC_MAX_RESPONSE_BODY_SIZE=10485760 \
RPC_BATCH_REQUESTS_LIMIT=50 \
RPC_ENABLE_SUBSCRIPTIONS=true \
RPC_MAX_SUBSCRIPTIONS_PER_CONNECTION=10 \
SEQUENCER_CLIENT_URL=https://rpc.mainnet.citrea.xyz \
INCLUDE_TX_BODY=false \
SYNC_BLOCKS_COUNT=10 \
SCAN_L1_START_HEIGHT=924022 \
RUST_LOG=info \
JSON_LOGS=1 \
./citrea-v2.3.1-osx-arm64 --network mainnet --da-layer bitcoin --genesis-paths ./genesisLinux:
./citrea-v2.3.1-linux-amd64 --network mainnet --da-layer bitcoin --rollup-config-path ./rollup_config.toml --genesis-paths ./genesisor if you wish to use environment variables for configuring your node:
SEQUENCER_PUBLIC_KEY=03516a66ea4bc3dab67f94dd356edb4eee00a7b33ffe1ab5a1422de5c7c42df4d6 \
SEQUENCER_DA_PUB_KEY=032a31a1fa359abd2e6fc1136b4dea711e5f18618504e021084cc61099f72bb2bd \
PROVER_DA_PUB_KEY=038e501ede61097973e49e714d5f2ad740c82b798bb90fda427fd5138e51f2398e \
NODE_URL=http://0.0.0.0:8332 \
NODE_USERNAME=citrea \
NODE_PASSWORD=citrea \
NETWORK=mainnet \
TX_BACKUP_DIR="" \
STORAGE_PATH=resources/dbs \
DB_MAX_OPEN_FILES=5000 \
RPC_BIND_HOST=0.0.0.0 \
RPC_BIND_PORT=8080 \
RPC_MAX_CONNECTIONS=100 \
RPC_MAX_REQUEST_BODY_SIZE=10485760 \
RPC_MAX_RESPONSE_BODY_SIZE=10485760 \
RPC_BATCH_REQUESTS_LIMIT=50 \
RPC_ENABLE_SUBSCRIPTIONS=true \
RPC_MAX_SUBSCRIPTIONS_PER_CONNECTION=10 \
SEQUENCER_CLIENT_URL=https://rpc.mainnet.citrea.xyz \
INCLUDE_TX_BODY=false \
SYNC_BLOCKS_COUNT=10 \
SCAN_L1_START_HEIGHT=924022 \
RUST_LOG=info \
JSON_LOGS=1 \
./citrea-v2.3.1-linux-amd64 --network mainnet --da-layer bitcoin --genesis-paths ./genesisYour full node should be serving RPC at http://0.0.0.0:8080 now.
If you don't have it, install it from here.
Clone the repository and checkout the latest tag:
git clone https://github.com/chainwayxyz/citrea
cd citrea
git fetch --tags
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)Compile Citrea by running command:
SKIP_GUEST_BUILD=1 cargo build --releaseCitrea ZK proof circuits are read from resources/guests. Rebuilding the circuits are unnecessary if you only wish to run a mainnet node, that's why build is made with SKIP_GUEST_BUILD=1.
Look through the rollup_config.toml and apply changes as you wish, if you modified any Bitcoin RPC configs, change corresponding values under [da].
And then run the full node by executing this command
./target/release/citrea --network mainnet --da-layer bitcoin --rollup-config-path ./resources/configs/mainnet/rollup_config.toml --genesis-paths ./resources/genesis/mainnetIf you'd like to use environment variables to pass configs instead of using .toml files you can do so like this:
SEQUENCER_PUBLIC_KEY=03516a66ea4bc3dab67f94dd356edb4eee00a7b33ffe1ab5a1422de5c7c42df4d6 \
SEQUENCER_DA_PUB_KEY=032a31a1fa359abd2e6fc1136b4dea711e5f18618504e021084cc61099f72bb2bd \
PROVER_DA_PUB_KEY=038e501ede61097973e49e714d5f2ad740c82b798bb90fda427fd5138e51f2398e \
NODE_URL=http://0.0.0.0:8332 \
NODE_USERNAME=citrea \
NODE_PASSWORD=citrea \
NETWORK=mainnet \
TX_BACKUP_DIR="" \
STORAGE_PATH=resources/dbs \
DB_MAX_OPEN_FILES=5000 \
RPC_BIND_HOST=0.0.0.0 \
RPC_BIND_PORT=8080 \
RPC_MAX_CONNECTIONS=100 \
RPC_MAX_REQUEST_BODY_SIZE=10485760 \
RPC_MAX_RESPONSE_BODY_SIZE=10485760 \
RPC_BATCH_REQUESTS_LIMIT=50 \
RPC_ENABLE_SUBSCRIPTIONS=true \
RPC_MAX_SUBSCRIPTIONS_PER_CONNECTION=10 \
SEQUENCER_CLIENT_URL=https://rpc.mainnet.citrea.xyz \
INCLUDE_TX_BODY=false \
SYNC_BLOCKS_COUNT=10 \
SCAN_L1_START_HEIGHT=924022 \
RUST_LOG=info \
JSON_LOGS=1 \
./target/release/citrea --network mainnet --da-layer bitcoin --genesis-paths ./resources/genesis/mainnetIf you've made any changes to your bitcoin node url, username or password, don't forget to change values for NODE_URL, NODE_USERNAME and NODE_PASSWORD.
Run the full node:
docker run -d \
-e NETWORK=mainnet \
-e NODE_URL=<your_bitcoin_url> \
-e NODE_USERNAME=<your_username> \
-e NODE_PASSWORD=<your_password> \
-v citrea-data:/mnt/task/citrea-db \
-p 8080:8080 \
chainwayxyz/citrea-full-node:latestRequired:
| Variable | Description |
|---|---|
NETWORK |
Network to run on: mainnet |
NODE_URL |
Bitcoin node RPC URL |
NODE_USERNAME |
Bitcoin RPC username |
NODE_PASSWORD |
Bitcoin RPC password |
Auto-configured per network (can be overridden):
| Variable | Description |
|---|---|
SEQUENCER_PUBLIC_KEY |
Sequencer's public key |
SEQUENCER_DA_PUB_KEY |
Sequencer DA public key |
PROVER_DA_PUB_KEY |
Prover DA public key |
SCAN_L1_START_HEIGHT |
L1 block height to start syncing |
SEQUENCER_CLIENT_URL |
Sequencer RPC URL |