|
| 1 | +--- |
| 2 | +sidebar_position: 2 |
| 3 | +title: How to Run a Sequencer Node |
| 4 | +description: A comprehensive guide to setting up and running an Aztec Sequencer node on testnet, including infrastructure requirements, configuration options, and troubleshooting tips. |
| 5 | +keywords: |
| 6 | + [ |
| 7 | + aztec, |
| 8 | + sequencer, |
| 9 | + node, |
| 10 | + blockchain, |
| 11 | + L2, |
| 12 | + scaling, |
| 13 | + ethereum, |
| 14 | + validator, |
| 15 | + setup, |
| 16 | + tutorial, |
| 17 | + ] |
| 18 | +tags: |
| 19 | + - sequencer |
| 20 | + - node |
| 21 | + - tutorial |
| 22 | + - infrastructure |
| 23 | +--- |
| 24 | + |
| 25 | +This guide will go over the steps required to run a sequencer node on Aztec. It will also provide context to ensure users are comfortable with the steps they are taking. |
| 26 | + |
| 27 | +The Aztec sequencer node is critical infrastructure responsible for ordering transactions and producing blocks. |
| 28 | + |
| 29 | +The sequencer node takes part in three key actions: |
| 30 | + |
| 31 | +1. Assemble unprocessed transactions and propose the next block |
| 32 | +2. Attest to correct execution of txs in the proposed block (if part of validator committee) |
| 33 | +3. Submit the successfully attested block to L1 |
| 34 | + |
| 35 | +When transactions are sent to the Aztec network, sequencer nodes bundle them into blocks, checking various constraints such as gas limits, block size, and transaction validity. Before a block can be published, it must be validated by a committee of other sequencer nodes (validators in this context) who re-execute public transactions and verify private function proofs so they can attest to correct execution. These validators attest to the block's validity by signing the block header, and once enough attestations are collected (two-thirds of the committee plus one), the sequencer can submit the block to L1. |
| 36 | + |
| 37 | +The archiver component complements this process by maintaining historical chain data. It continuously monitors L1 for new blocks, processes them, and maintains a synchronized view of the chain state. This includes managing contract data, transaction logs, and L1-to-L2 messages, making it essential for network synchronization and data availability. |
| 38 | + |
| 39 | +## Prerequisites |
| 40 | + |
| 41 | +Minimum hardware requirements: |
| 42 | + |
| 43 | +- 2 core / 4 vCPU |
| 44 | +- 16 GB RAM |
| 45 | +- 1TB NVMe SSD |
| 46 | +- 25 Mbps network connection |
| 47 | + |
| 48 | +Please note that these requirements are subject to change as the network throughput increases. |
| 49 | + |
| 50 | +This guide expects you to be using a "standard" Linux distribution like Debian / Ubuntu when following along with the steps. |
| 51 | + |
| 52 | +It also is assumed that you have installed Docker and the aztec toolchain via aztec-up as described in the [getting started section](../../index.md). |
| 53 | + |
| 54 | +Furthermore, as this guide uses Docker compose, you will need to install it. Please follow [this](https://docs.docker.com/compose/install/) guide to do so. |
| 55 | + |
| 56 | +Finally, this guide requires you to have endpoints of an L1 node stack of an execution and consensus client. If you do not have one set up, you can see a good guide on how to do that [here at Eth Docker](https://ethdocker.com/Usage/QuickStart). |
| 57 | + |
| 58 | + |
| 59 | +## Configure the sequencer |
| 60 | + |
| 61 | +There are a few important things to note when setting up a sequencer. This guide will guide you in setting up and running a sequencer with a standard setup using Docker compose with a .env file. |
| 62 | + |
| 63 | +The setup of the sequencer has four important steps. |
| 64 | + |
| 65 | +1. Define private keys / accounts used for sequencer duties |
| 66 | +2. Set required node configuration |
| 67 | +3. Ensure auto-update / auto-restart is enabled |
| 68 | +4. Apply your Docker compose file |
| 69 | + |
| 70 | +Let's start by creating a new directory called `aztec-sequencer`, with two subdirectories, `keys`, and `data`. This is where all the information used by the sequencer will be stored. Please also create an empty `.env` file in `aztec-sequencer` to define your settings before moving on to the next step. |
| 71 | + |
| 72 | +### Define private keys / accounts |
| 73 | + |
| 74 | +A sequencer must hold and use private keys identifying it as a valid proposer or attester. This is done is by defining a keystore file. |
| 75 | + |
| 76 | +An example keystore file is below. Copy this file and save it as `keystore.json` into your `aztec-sequencer/keys` folder. |
| 77 | + |
| 78 | +```JSON |
| 79 | +{ |
| 80 | + schemaVersion: 1, |
| 81 | + validators: [ |
| 82 | + { |
| 83 | + attester: ["ETH_PRIVATE_KEY_0"] |
| 84 | + publisher: ["ETH_PRIVATE_KEY_1"], |
| 85 | + coinbase: "ETH_ADDRESS_2", |
| 86 | + feeRecipient: "AZTEC_ADDRESS_0" |
| 87 | + } |
| 88 | + ] |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +The keystore defines a few important keys and addresses for sequencer operation. They include but are not limited to: |
| 93 | + |
| 94 | +- `attester`: the private key of the sequencer, used for signing block proposals and attestations on block proposals produced by other sequencers. The corresponding Ethereum address of the private key is the identity of the sequencer. |
| 95 | +- `publisher`: the private key of the Ethereum EOA used for sending the block proposal to L1. This defaults to the attester private key if not set. |
| 96 | +- `coinbase`: the Ethereum address set in a block proposal. L1 rewards and fees are sent to this address. This falls back to the address derived by the attester private key if not set. |
| 97 | +- `feeRecipient`: the Aztec Address of the fee recipient address when proposing blocks. The unburnt portion of the tx fees in a given block are sent to this address. |
| 98 | + |
| 99 | +Please set these values with the ones you want and save `keystore.json`. |
| 100 | + |
| 101 | +### Node configuration |
| 102 | + |
| 103 | +Next you will need to define some environment variables that set important configuration for your node. |
| 104 | + |
| 105 | +These include: |
| 106 | + |
| 107 | +- `DATA_DIRECTORY`: the folder where the data of the sequencer is stored |
| 108 | +- `KEY_STORE_DIRECTORY`: can be a path to the file or directory where keystores are located. In our case it is the path to the folder containing the `keystore.json` file created above |
| 109 | +- `LOG_LEVEL`: the desired level of logging for the sequencer. It defaults to `INFO`. |
| 110 | +- `ETHEREUM_HOSTS`: The execution RPC endpoints |
| 111 | +- `L1_CONSENSUS_HOST_URLS`: The consensus RPC endpoints |
| 112 | +- `P2P_IP`: The IP address of this sequencer |
| 113 | +- `P2P_PORT`: The port that P2P communication happens on |
| 114 | +- `AZTEC_PORT`: The port that the sequencer node API is exposed on |
| 115 | + |
| 116 | +Please paste this sample `.env` file into the empty one currently residing in your `aztec-sequencer` folder. Please note that we are assuming you are using the default ports of 8080 for the sequencer itself, and 40400 for p2p connectivity. If this is not the case, please overwrite the defaults below. |
| 117 | + |
| 118 | +```sh |
| 119 | +DATA_DIRECTORY=./data |
| 120 | +KEY_STORE_DIRECTORY=./keys |
| 121 | +LOG_LEVEL=info |
| 122 | +ETHEREUM_HOSTS=<your L1 execution endpoint, or a comma separated list if you have multiple> |
| 123 | +L1_CONSENSUS_HOST_URLS=<your L1 consensus endpoint, or a comma separated list if you have multiple> |
| 124 | +P2P_IP=<your external IP address> |
| 125 | +P2P_PORT=40400 |
| 126 | +AZTEC_PORT=8080 |
| 127 | +``` |
| 128 | +
|
| 129 | +:::tip |
| 130 | +You MUST forward your ports. Your router must send UDP and TCP traffic on the port specified by `AZTEC_NODE_P2P_PORT` to your IP address on your local network. |
| 131 | +
|
| 132 | +Running the command `curl ipv4.icanhazip.com` can retrieve your public IP address for you. |
| 133 | +::: |
| 134 | +
|
| 135 | +### Enable auto-update / auto-restart |
| 136 | +
|
| 137 | +It is imperative that the built in auto-updating functionality of the sequencer is not disabled. The update-checker is a background module in the Aztec node that enables global coordination of updates. It allows the protocol team to: |
| 138 | +
|
| 139 | +- Push configuration changes to all nodes |
| 140 | +- Trigger shutdowns so that nodes can pull the latest image version |
| 141 | +- Apply hot-fixes quickly |
| 142 | +- Coordinate node resets after a governance upgrade, especially when a new canonical rollup is published to the Registry |
| 143 | +
|
| 144 | +This module ensures that upgrades and fixes propagate smoothly without requiring manual intervention from every node operator. |
| 145 | +
|
| 146 | +Please ensure environment variables: |
| 147 | +
|
| 148 | +`AUTO_UPDATE_URL` and `AUTO_UPDATE` remain unset, as to take their default values (which are the s3 bucket being used to host the update information, and `config-and-version` respectively). |
| 149 | +
|
| 150 | +Because docker-compose does not respect pull policies on container restarts, to handle updates properly, add Watchtower to your stack by running: |
| 151 | +
|
| 152 | +```sh |
| 153 | +docker run -d \ |
| 154 | + --name watchtower \ |
| 155 | + -v /var/run/docker.sock:/var/run/docker.sock \ |
| 156 | + containrrr/watchtower |
| 157 | +``` |
| 158 | +
|
| 159 | +### Applying your Docker compose file |
| 160 | +
|
| 161 | +Now that you have done all the setup, create a Docker compose file named `compose.yml` in your `aztec-sequencer` directory and paste the below code into it. |
| 162 | +
|
| 163 | +```yaml |
| 164 | +services: |
| 165 | + aztec-sequencer: |
| 166 | + image: "aztecprotocol/aztec:1.2.1" |
| 167 | + container_name: "aztec-sequencer" |
| 168 | + ports: |
| 169 | + - ${AZTEC_PORT}:${AZTEC_PORT} |
| 170 | + - ${P2P_PORT}:${P2P_PORT} |
| 171 | + - ${P2P_PORT}:${P2P_PORT}/udp |
| 172 | + volumes: |
| 173 | + - ${DATA_DIRECTORY}:/var/lib/data |
| 174 | + - ${KEY_STORE_DIRECTORY}:/var/lib/keystore |
| 175 | + environment: |
| 176 | + KEY_STORE_DIRECTORY: /var/lib/keystore |
| 177 | + DATA_DIRECTORY: /var/lib/data |
| 178 | + LOG_LEVEL: ${LOG_LEVEL} |
| 179 | + ETHEREUM_HOSTS: ${ETHEREUM_HOSTS} |
| 180 | + L1_CONSENSUS_HOST_URLS: ${L1_CONSENSUS_HOST_URLS} |
| 181 | + P2P_IP: ${P2P_IP} |
| 182 | + P2P_PORT: ${P2P_PORT} |
| 183 | + AZTEC_PORT: ${AZTEC_PORT} |
| 184 | + entrypoint: node /usr/src/yarn-project/aztec/dest/bin/index.js |
| 185 | + command: >- |
| 186 | + start |
| 187 | + --network alpha-testnet |
| 188 | + --node |
| 189 | + --archiver |
| 190 | + --sequencer |
| 191 | + networks: |
| 192 | + - aztec |
| 193 | + restart: always |
| 194 | + |
| 195 | +networks: |
| 196 | + aztec: |
| 197 | + name: aztec |
| 198 | +``` |
| 199 | +
|
| 200 | +Please note that we are setting only the necessary configuration for running this sequencer. The full list of settings and flags can be explored here at the [cli reference](../../reference/cli_reference.md). A lot of these options are preset to defaults by the `--network` flag above. This downloads defaults for the specified network and applies them to the node. |
| 201 | +
|
| 202 | +Now, you can run `docker compose up` inside your `aztec-sequencer` folder to start the sequencer! |
| 203 | +
|
| 204 | +To check if it is currently synced, which may take a few minutes, run this command and compare its output to any of the Aztec block explorers. |
| 205 | +
|
| 206 | +```sh |
| 207 | +curl -s -X POST -H 'Content-Type: application/json' \ |
| 208 | +-d '{"jsonrpc":"2.0","method":"node_getL2Tips","params":[],"id":67}' \ |
| 209 | +http://localhost:8080 | jq -r ".result.proven.number" |
| 210 | +``` |
| 211 | +
|
| 212 | +## Add yourself to the testnet sequencer set |
| 213 | +
|
| 214 | +After setting up your node you must explicitly request to be added to the sequencer set. |
| 215 | +
|
| 216 | +To complete this final step you can now head to [testnet.aztec.network](https://testnet.aztec.network) and complete the onboarding flow there utilizing zkPassport ! |
0 commit comments