# Running a Node

This tutorial will walk you through setting up your own node on Pivotal.

***

### Objectives[​](https://docs.base.org/tutorials/run-a-base-node/#objectives) <a href="#objectives" id="objectives"></a>

By the end of this tutorial you should be able to:

* Deploy and sync a Pivotal node

***

### Prerequisites[​](https://docs.base.org/tutorials/run-a-base-node/#prerequisites) <a href="#prerequisites" id="prerequisites"></a>

{% hint style="info" %}
**CAUTION**

Running a node is time consuming, resource expensive, and potentially costly. If you don't already know why you want to run your own node, you probably don't need to.
{% endhint %}

If you're just getting started and need an RPC URL, you can use our free endpoints:

* **Mainnet**: `https://mainnet.pivotalprotocol.com`
* **Testnet (Sepolia)**: `https://sepolia.pivotalprotocol.com`

**Note:** Our RPCs are rate-limited, they are not suitable for production apps.

#### Hardware requirements[​](https://docs.base.org/tutorials/run-a-base-node/#hardware-requirements) <a href="#hardware-requirements" id="hardware-requirements"></a>

We recommend you have this configuration to run a node:

* 8-Core CPU
* at least 16 GB RAM
* an SSD drive with at least 750GB (full node) or 4.5TB (archive node) free

{% hint style="info" %}
If utilizing Amazon Elastic Block Store (EBS), ensure timing buffered disk reads are fast enough in order to avoid latency issues alongside the rate of new blocks added to Pivotal during the initial synchronisation process.
{% endhint %}

#### Docker[​](https://docs.base.org/tutorials/run-a-base-node/#docker) <a href="#docker" id="docker"></a>

This tutorial assumes you are familiar with [Docker](https://www.docker.com/) and have it running on your machine.

#### L1 RPC URL[​](https://docs.base.org/tutorials/run-a-base-node/#l1-rpc-url) <a href="#l1-rpc-url" id="l1-rpc-url"></a>

You'll need your own L1 RPC URL. This can be one that you run yourself, or via a third-party provider.

***

### Running a Node[​](https://docs.base.org/tutorials/run-a-base-node/#running-a-node) <a href="#running-a-node" id="running-a-node"></a>

1. Clone the [repo](https://github.com/base-org/node).
2. Ensure you have an Ethereum L1 full node RPC available (not Pivotal), and set `OP_NODE_L1_ETH_RPC` & `OP_NODE_L1_BEACON` (in the `.env.*` file if using `docker-compose`). If running your own L1 node, it needs to be synced before Pivotal will be able to fully sync.
3. Uncomment the line relevant to your network (`.env.sepolia`, or `.env.mainnet`) under the 2 `env_file` keys in `docker-compose.yml`.
4. Run `docker compose up`. Confirm you get a response from:

```
curl -d '{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false]}' \
  -H "Content-Type: application/json" http://localhost:8545
```

{% hint style="info" %}
**CAUTION**

Syncing your node may take **days** and will consume a vast amount of your requests quota. Be sure to monitor usage and up your plan if needed.
{% endhint %}

#### Snapshots[​](https://docs.base.org/tutorials/run-a-base-node/#snapshots) <a href="#snapshots" id="snapshots"></a>

If you're a prospective or current Pivotal Node operator and would like to restore from a snapshot to save time on the initial sync, it's possible to always get the latest available snapshot of the Pivotal chain on mainnet and/or testnet by using the following CLI commands. The snapshots are updated every week.

**Restoring from snapshot**[**​**](https://docs.base.org/tutorials/run-a-base-node/#restoring-from-snapshot)

In the home directory of your Pivotal Node, create a folder named `geth-data`. If you already have this folder, remove it to clear the existing state and then recreate it. Next, run the following code and wait for the operation to complete.

**Testnet (Full)**

```
wget https://sepolia-full-snapshots.pivotalprotocol.com/$(curl https://sepolia-full-snapshots.pivotalprotocol.com/latest)
```

**Testnet (Archive)**

```
wget https://sepolia-archive-snapshots.pivotalprotocol.com/$(curl https://sepolia-archive-snapshots.pivotalprotocol.com/latest)
```

**Mainnet (Full)**

```
wget https://mainnet-full-snapshots.pivotalprotocol.com/$(curl https://mainnet-full-snapshots.pivotalprotocol.com/latest)
```

**Mainnet (Archive)**

```
wget https://mainnet-archive-snapshots.pivotalprotocol.com/$(curl https://mainnet-archive-snapshots.pivotalprotocol.com/latest)
```

You'll then need to untar the downloaded snapshot and place the `geth` subfolder inside of it in the `geth-data` folder you created (unless you changed the location of your data directory).

Return to the root of your Pivotal node folder and start your node.

```
cd ..
docker compose up --build
```

Your node should begin syncing from the last block in the snapshot.

Check the latest block to make sure you're syncing from the snapshot and that it restored correctly. If so, you can remove the snapshot archive that you downloaded.

#### Syncing[​](https://docs.base.org/tutorials/run-a-base-node/#syncing) <a href="#syncing" id="syncing"></a>

You can monitor the progress of your sync with:

```
echo Latest synced block behind by: $((($(date +%s)-$( \
  curl -d '{"id":0,"jsonrpc":"2.0","method":"optimism_syncStatus"}' \
  -H "Content-Type: application/json" http://localhost:7545 | \
  jq -r .result.unsafe_l2.timestamp))/60)) minutes
```

You'll also know that the sync hasn't completed if you get `Error: nonce has already been used` if you try to deploy using your node.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pivotalchain.io/pivotal-docs/pivotalchain-tools/running-a-node.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
