> ## Documentation Index
> Fetch the complete documentation index at: https://metalayerlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Advanced Setup

Deploying a Blast node follows the same process as other OP Stack-based chains. This document is based on the `master` branch of the [Blast repository](https://github.com/blast-io/blast).

This guide is intended for advanced users who want to build Blast from source. If you prefer to use prebuilt Docker images, refer to the [Docker Compose Setup](./basic) documentation.

# Initial Setup

### Download Blast `genesis.json` & `rollup.json`

In addition to the Blast repository containing `blast-geth` and `blast-optimism`, you will also need to obtain the chain configuration files from the deployment repository.

These files contain the essential chain configuration parameters for initializing your Blast node. Ensure you select the correct files based on the network (Mainnet or Sepolia) you want to connect to. This step is crucial for aligning your node with the chosen network’s protocol settings.

```bash theme={null}
git clone git@github.com:blast-io/deployment.git
```

<Info>
  To run a Sepolia node, use the `sepolia-testnet branch` of the Blast repository. The `master` branch is not compatible with the Blast Sepolia testnet.
</Info>

### Building the Docker Images

#### blast-geth

```bash theme={null}
cd blast-geth/
docker build . -t blast-geth
```

#### op-node

This step creates a Docker image of the `op-node`, tagged for development use. This image will be used later when running the node.

```bash theme={null}
cd blast-optimism/
# This will build an image with tag: blast.io/blast-optimism/op-node:dev
REGISTRY=blast.io REPOSITORY=blast-optimism docker buildx bake --load -f docker-bake.hcl op-node
```

### Generate the jwt secret

```bash theme={null}
openssl rand -hex 32 | tr -d "\n" > /jwt.txt
```

### Initialize the blast-geth data directory

Use the following command to initialize the data directory. Ensure you have downloaded the appropriate `genesis.json` file.

```bash theme={null}
geth init \
  --datadir=$GETH_DATA_DIR \
  config/genesis.json
```

# Running

### Set up env vars

The sequencer URL and bootnode address must be configured to connect your Blast node to the appropriate peer network and the transaction sequencer.

To do this, you will need to expose the sequencer URL and bootnode address environment variables as follows:

```yaml theme={null}
# For Mainnet
export GETH_ROLLUP_SEQUENCERHTTP=https://sequencer.blast.io
export OP_NODE_P2P_BOOTNODES=enr:-J64QGwHl9uYLfC_cnmxSA6wQH811nkOWJDWjzxqkEUlJoZHWvI66u-BXgVcPCeMUmg0dBpFQAPotFchG67FHJMZ9OSGAY3d6wevgmlkgnY0gmlwhANizeSHb3BzdGFja4Sx_AQAiXNlY3AyNTZrMaECg4pk0cskPAyJ7pOmo9E6RqGBwV-Lex4VS9a3MQvu7PWDdGNwgnZhg3VkcIJ2YQ,enr:-J64QDge2jYBQtcNEpRqmKfci5E5BHAhNBjgv4WSdwH1_wPqbueq2bDj38-TSW8asjy5lJj1Xftui6Or8lnaYFCqCI-GAY3d6wf3gmlkgnY0gmlwhCO2D9yHb3BzdGFja4Sx_AQAiXNlY3AyNTZrMaEDo4aCTq7pCEN8om9U5n_VyWdambGnQhwHNwKc8o-OicaDdGNwgnZhg3VkcIJ2YQ

# For Sepolia
# export GETH_ROLLUP_SEQUENCERHTTP=https://sequencer.s2.testblast.io
# export OP_NODE_P2P_BOOTNODES=enr:-J-4QM3GLUFfKMSJQuP1UvuKQe8DyovE7Eaiit0l6By4zjTodkR4V8NWXJxNmlg8t8rP-Q-wp3jVmeAOml8cjMj__ROGAYznzb_HgmlkgnY0gmlwhA-cZ_eHb3BzdGFja4X947FQAIlzZWNwMjU2azGhAiuDqvB-AsVSRmnnWr6OHfjgY8YfNclFy9p02flKzXnOg3RjcIJ2YYN1ZHCCdmE,enr:-J-4QDCVpByqQ8nFqCS9aHicqwUfXgzFDslvpEyYz19lvkHLIdtcIGp2d4q5dxHdjRNTO6HXCsnIKxUeuZSPcEbyVQCGAYznzz0RgmlkgnY0gmlwhANiQfuHb3BzdGFja4X947FQAIlzZWNwMjU2azGhAy3AtF2Jh_aPdOohg506Hjmtx-fQ1AKmu71C7PfkWAw9g3RjcIJ2YYN1ZHCCdmE
```

### blast-geth

```bash theme={null}
geth \
  --datadir=$GETH_DATA_DIR \
  --http \
  --http.corsdomain="*" \
  --http.vhosts="*" \
  --http.addr=0.0.0.0 \
  --http.port=$RPC_PORT \
  --http.api=web3,debug,eth,txpool,net,engine \
  --ws \
  --ws.addr=0.0.0.0 \
  --ws.port=$WS_PORT \
  --ws.origins="*" \
  --ws.api=debug,eth,txpool,net,engine \
  --authrpc.addr="0.0.0.0" \
  --authrpc.port="8551" \
  --authrpc.vhosts="*" \
  --authrpc.jwtsecret=/jwt.txt \
  --syncmode=full \
  --gcmode=archive \
  --nodiscover \
  --maxpeers=0 \
  --rollup.disabletxpoolgossip=true 
  --override.canyon=0
  --override.ecotone=1716843599
```

### op-node

```bash theme={null}
op-node \
  --l1=$L1_RPC_URL \
  --l1.rpckind=$L1_RPC_KIND \
  --l2=ws://blast-geth:8551 \
  --l2.jwt-secret=/jwt.txt \
  --rollup.config=config/rollup.json
  --l1.beacon=$L1_BEACON_API_URL
```

To fully participate in P2P, ensure TCP/UDP is allowed on port `9003` and set `--p2p.advertise.ip=$PUBLIC_IP`.

<Note>
  Blast Mainnet and Testnet have activated the Ecotone upgrade to benefit from EIP-4844. It's important that you provide a beacon chain API URL (`$L1_BEACON_API_URL`) in addition to the `$L1_RPC_URL` so your node can read blob data.
</Note>

# Upgrades

### Using pre-built docker images

1. First, pull latest code from the [deployment repository](https://github.com/blast-io/deployment).
2. Next, restart the containers with the new Docker image.

```bash theme={null}
docker compose pull --policy=always

# restart all of the containers
docker compose down
docker compose up -d
```

### Building the docker images from source code

1. Pull the latest code from [https://github.com/blast-io/blast](https://github.com/blast-io/blast)
2. Build new Docker images by following the instructions in the [Building the Docker Images](#building-the-docker-images) section. Ensure your `genesis.json` and `rollup.json` files are up-to-date in case of any changes (e.g., a hard fork timestamp).
3. Restart the `blast-geth` and `op-node` containers as described in the [Running](#running) section.

# Additional RPC methods

### eth\_getBalanceValues

To facilitate rebasing ETH balances, accounts on Blast store more fields than just balance in the state trie. This RPC method exposes the underlying parameters that control an account's rebasing ETH balance.

See our article on [Indexing Account Shares](/building/guides/indexing-balances#indexing-account-shares) for a detailed overview of this RPC method.
