|
1 | 1 | --- |
2 | 2 | title: Run an archive node |
3 | | -description: Learn about Dusk archive nodes that store and give access to Dusk’s historical data. |
| 3 | +description: Install and operate a Rusk node with finalized historical indexes. |
4 | 4 | --- |
5 | 5 |
|
6 | | -Archive nodes extend the functionality of [Provisioners](/operator/provisioner) by also preserving a complete historical record of the Dusk blockchain. While provisioners focus on the current state and consensus duties, archive mode adds long-term historical data access for applications, users, researchers, and auditors. |
| 6 | +An archive node runs the archive build of Rusk and retains finalized historical indexes in addition to normal chain state. Applications use it for queries such as `moonlightHistory`, `fullMoonlightHistory`, and `finalizedEvents`. |
7 | 7 |
|
8 | | -Archive nodes are commonly run as data-serving infrastructure and do not need to stake DUSK. However, archive mode is built on top of the regular node stack, so an archive node can also be configured to participate in consensus if you choose to stake and run it that way. |
| 8 | +Archive mode does not require staking. An archive node can also participate in consensus, but production API infrastructure is usually kept separate from provisioner duties so query load and maintenance do not compete with consensus. |
9 | 9 |
|
10 | | -In short, archive nodes: |
11 | | -- Provide additional historical data (such as events emitted by contracts) that is not stored by a Provisioner node |
12 | | -- Expose archive-only GraphQL queries such as `moonlightHistory`, `fullMoonlightHistory`, and `finalizedEvents` |
13 | | -- Can also participate in consensus by staking DUSK, though that is optional |
| 10 | +## Requirements |
14 | 11 |
|
15 | | -:::tip[Run an Archive node] |
16 | | -If you want to quickly launch & run an archive node, you can use the <a href="https://github.com/dusk-network/node-installer" target="_blank">node installer</a> by following [the archive guide](/operator/archive-node). |
17 | | -::: |
18 | | - |
19 | | -## Archive Node Specifications |
| 12 | +Use Ubuntu 24.04 LTS and begin with at least: |
20 | 13 |
|
21 | | -Archive nodes store and serve historical data and require large storage capacity, efficient processing for concurrent requests, and fast Internet connectivity. The following recommended specifications serve as a baseline for Archive Nodes. Over time, storage requirements will increase. |
| 14 | +| CPU | RAM | Storage | Network | |
| 15 | +|---|---|---|---| |
| 16 | +| 4 cores at 2 GHz | 8 GB | 500 GB | 100 Mbps | |
22 | 17 |
|
23 | | -| CPU | RAM | Storage | Network Connection | |
24 | | -| :------------- | :--- | :------ | :----------------- | |
25 | | -| 4 cores; 2 GHz | 8 GB | 500 GB | 100 Mbps | |
| 18 | +This is an initial planning baseline, not a capacity guarantee. Archive storage grows over time; monitor actual utilization and expansion lead time. |
26 | 19 |
|
27 | | -## Run an archive node |
28 | | -> A step-by-step guide to setting up a Dusk archive node. |
| 20 | +## Install |
29 | 21 |
|
30 | | -The following guide will explain you how to install and setup an archive node on Ubuntu 24.04 through the [node installer](https://github.com/dusk-network/node-installer). This installer will set up Rusk as a service on your server, preconfigure parts of the node, and provide a couple of helper scripts. |
| 22 | +Run the released node installer with the archive feature: |
31 | 23 |
|
32 | | -Install Rusk with the archive feature enabled by pasting the following command in your server terminal: |
33 | 24 | ```sh |
34 | | -curl --proto '=https' --tlsv1.2 -sSfL https://github.com/dusk-network/node-installer/releases/latest/download/node-installer.sh | sudo bash -s -- --feature archive |
| 25 | +curl --proto '=https' --tlsv1.2 -sSfL \ |
| 26 | + https://github.com/dusk-network/node-installer/releases/latest/download/node-installer.sh \ |
| 27 | + | sudo bash -s -- --feature archive |
35 | 28 | ``` |
36 | 29 |
|
37 | | -This will install an archive node with the network being set to mainnet. |
38 | | - |
39 | | -## Configure Rusk |
| 30 | +Add `--network testnet` before `--feature archive` for a testnet archive node. |
40 | 31 |
|
41 | | -You now should have successfully installed Rusk. |
42 | | - |
43 | | -A quick check with: |
44 | | - |
45 | | -```sh |
46 | | -ruskquery version |
47 | | -``` |
48 | | - |
49 | | -Should tell you, that you are running the latest installer version. |
50 | | - |
51 | | -## Start your node |
52 | | - |
53 | | -If you've configured everything correctly, you can now start rusk: |
54 | | -```sh |
55 | | -service rusk start |
56 | | -``` |
| 32 | +Start Rusk and monitor synchronization: |
57 | 33 |
|
58 | | -Your node will now start syncing. You can check if it indeed is by running: |
59 | 34 | ```sh |
| 35 | +sudo systemctl start rusk |
| 36 | +systemctl is-active rusk |
| 37 | +ruskquery peers |
60 | 38 | ruskquery block-height |
61 | 39 | ``` |
62 | 40 |
|
63 | | -It is best to wait until your node is synced up. You can find the latest block height on [the block explorer](https://explorer.dusk.network/). Alternatively, consider [fast-syncing](/operator/guides/fast-sync) for a quicker method. |
| 41 | +Compare the height with the matching [network](/operator/networks/). |
| 42 | + |
| 43 | +An archive expected to answer complete history must synchronize from genesis or restore a trusted backup that includes the archive databases. The installer's `download_state` snapshot restores execution state, but it does not backfill archive indexes for blocks before that snapshot. |
64 | 44 |
|
65 | | -## Enable http |
| 45 | +## Enable the HTTP API |
66 | 46 |
|
67 | | -If you want to serve archive data to the outside world, your node needs to enable the http capabilities. This can be done by adding |
| 47 | +The installed API is not intended to be public by default. For local access or a reverse proxy on the same host, add this to `/opt/dusk/conf/rusk.toml`: |
68 | 48 |
|
69 | 49 | ```toml |
70 | | -# rusk.toml |
71 | 50 | [http] |
72 | 51 | listen = true |
73 | | -listen_address = '0.0.0.0:8080' |
| 52 | +listen_address = '127.0.0.1:8080' |
74 | 53 | ``` |
75 | 54 |
|
76 | | -To your rusk.toml file in your system's `/opt/dusk/conf` folder. That's it. |
| 55 | +Then restart Rusk: |
77 | 56 |
|
78 | | -Now you can query the archive for data with an external client application. |
| 57 | +```sh |
| 58 | +sudo systemctl restart rusk |
| 59 | +``` |
79 | 60 |
|
80 | | -## Test archive endpoint |
| 61 | +Use `0.0.0.0:8080` only when the API must accept traffic on an external interface. Restrict it with a firewall, access policy, rate limits, or a controlled reverse proxy. Public `8080/tcp` access is not required for synchronization or consensus. |
81 | 62 |
|
82 | | -You can check which GraphQL queries are available by retrieving the schema (SDL). On RUES, an empty body returns the schema: |
83 | | -```bash |
84 | | -curl -s -X POST "http://<your-node-host>:8080/on/graphql/query" |
85 | | -``` |
| 63 | +:::caution[Updates regenerate rusk.toml] |
| 64 | +Rerun the installer with `--feature archive` during every update. The installer regenerates `/opt/dusk/conf/rusk.toml`, so review the new file and reapply the intended `[http]` settings before returning the API to service. |
| 65 | +::: |
86 | 66 |
|
87 | | -This should now return a different schema than a normal node returns. Archive-enabled nodes expose additional historical queries such as `moonlightHistory`, `fullMoonlightHistory`, and `finalizedEvents`. |
| 67 | +## Verify archive queries |
88 | 68 |
|
89 | | -A regular node also exposes `checkBlock`, but the `onlyFinalized: true` behavior below is archive-only. |
| 69 | +List the archive fields exposed by canonical GraphQL: |
90 | 70 |
|
91 | | -In order to test this endpoint, you can run the following command. |
| 71 | +```sh |
| 72 | +curl -fsS -X POST "http://127.0.0.1:8080/graphql" \ |
| 73 | + -H "Content-Type: application/json" \ |
| 74 | + --data-raw '{"query":"{ __schema { queryType { fields { name } } } }"}' \ |
| 75 | + | jq -r '.data.__schema.queryType.fields[].name' \ |
| 76 | + | grep -E '^(moonlightHistory|fullMoonlightHistory|finalizedEvents|checkBlock)$' |
| 77 | +``` |
| 78 | + |
| 79 | +Query a known block: |
92 | 80 |
|
93 | | -```bash |
94 | | -curl -s -X POST "http://<your-node-host>:8080/on/graphql/query" \ |
95 | | - --data-raw '{ block(height: 1) { header { hash } } }' | jq . |
| 81 | +```sh |
| 82 | +curl -fsS -X POST "http://127.0.0.1:8080/graphql" \ |
| 83 | + -H "Content-Type: application/json" \ |
| 84 | + --data-raw '{"query":"{ block(height: 1) { header { height hash } } }"}' \ |
| 85 | + | jq . |
96 | 86 | ``` |
97 | 87 |
|
98 | | -Then use the returned block hash with `checkBlock`: |
| 88 | +To verify finalized-block lookup, replace `<BLOCK_HASH>` with the returned hash: |
99 | 89 |
|
100 | | -```bash |
101 | | -curl -s -X POST "http://<your-node-host>:8080/on/graphql/query" \ |
102 | | - --data-raw 'query { checkBlock(height: 1, hash: "<block_hash>", onlyFinalized: true) }' | jq . |
| 90 | +```sh |
| 91 | +curl -fsS -X POST "http://127.0.0.1:8080/graphql" \ |
| 92 | + -H "Content-Type: application/json" \ |
| 93 | + --data-raw '{"query":"{ checkBlock(height: 1, hash: \"<BLOCK_HASH>\", onlyFinalized: true) }"}' \ |
| 94 | + | jq . |
103 | 95 | ``` |
104 | 96 |
|
105 | | -On a non-archive node, `onlyFinalized: true` returns an error. |
| 97 | +Archive history is populated as blocks finalize. Verify the earliest range your application requires before declaring the service ready. |
106 | 98 |
|
107 | | -## Stake with archive node |
| 99 | +See [Scan Moonlight deposits](/developer/integrations/historical_events/) for a bounded history consumer and [HTTP API](/developer/integrations/http-api/) for query and access-policy details. |
108 | 100 |
|
109 | | -It is possible to stake and participate in consensus while the archive node is running. This is usually not recommended, but is possible since the archive is built on top of a normal provisioner node and therefore has all the capabilities to do so. |
| 101 | +## Stake from an archive node |
110 | 102 |
|
111 | | -You can read the [node wallet guide](/operator/guides/node-wallet-setup) for a step-by-step instruction on setting up the wallet, depending on if you want the archive node to participate in consensus too or not. |
| 103 | +Staking is optional. If this host will also be a provisioner, follow [Set up the node wallet](/operator/guides/node-wallet-setup/) and apply the same monitoring, key-isolation, and update procedures as any other provisioner. |
0 commit comments