@@ -4,25 +4,89 @@ This guide is intended for setting up archive nodes on **Mina Devnet** only. Do
44not use this guide for Mina Mainnet until necessary security audits are
55complete.
66
7+ ## What is an Archive Node?
8+
9+ An archive node is a specialized Mina node that stores the complete blockchain
10+ history in a structured database. Unlike regular nodes that only maintain recent
11+ state for consensus, archive nodes:
12+
13+ - ** Store all blocks** : Maintains every block from genesis to the current tip
14+ - ** Preserve transaction history** : Keeps a complete record of all transactions
15+ - ** Provide historical queries** : Enables querying of past blockchain states
16+ - ** Support analytics** : Facilitates blockchain analysis and data exploration
17+ - ** Enable compliance** : Helps meet regulatory requirements for data retention
18+
19+ ### Synchronization Behavior
20+
21+ <!-- prettier-ignore-start -->
22+
23+ :::note Current Limitation
24+
25+ Archive nodes currently sync and store blocks from the point when they are
26+ started. There is no built-in option to automatically replay and store the
27+ complete blockchain history from genesis block.
28+
29+ To obtain complete historical data, you would need to:
30+
31+ 1 . Start the archive node from genesis (when the network was launched)
32+ 2 . Import historical data from another archive node's database
33+ 3 . Use existing archive services that have been running since genesis
34+
35+ :::
36+
37+ <!-- prettier-ignore-stop -->
38+
39+ The archive node consists of three components:
40+
41+ 1 . ** Mina node** : Syncs with the network and receives new blocks
42+ 2 . ** Archiver process** : Processes blocks and stores them in the database
43+ 3 . ** PostgreSQL database** : Stores the structured blockchain data
44+
745---
846
947## Prerequisites
1048
1149Ensure Docker and Docker Compose are installed on your system -
1250[ Docker Installation Guide] ( ../appendix/docker-installation )
1351
14- ## Download & Start the Archive Node
52+ ## Using Docker Compose
53+
54+ 1 . ** Download the Docker Compose File**
55+
56+ Create a directory for your archive node and download the docker-compose
57+ file:
58+
59+ ``` bash
60+ # Create a directory for your archive node
61+ mkdir mina-archive-node && cd mina-archive-node
62+
63+ # Download the archive node docker-compose file (choose one method)
64+ # Using wget:
65+ wget https://raw.githubusercontent.com/o1-labs/mina-rust/v0.17.0/docker-compose.archive.devnet.yml
66+
67+ # Or using curl:
68+ curl -O https://raw.githubusercontent.com/o1-labs/mina-rust/v0.17.0/docker-compose.archive.devnet.yml
69+
70+ # Create required .env file with PostgreSQL settings
71+ cat > .env << EOF
72+ POSTGRES_PASSWORD=mina
73+ PG_PORT=5432
74+ PG_DB=archive
75+ MINA_RUST_TAG=latest
76+ EOF
77+ ` ` `
78+
79+ For the latest development version, replace ` v0.17.0` with ` develop` in the
80+ URL.
1581
16- 1 . ** Download the Latest Release**
17- - Visit the
18- [ Mina Rust Releases] ( https://github.com/o1-labs/mina-rust/releases )
19- - Download the latest ` mina-rust-vX.Y.Z-docker-compose.zip `
20- - Extract the Files:
82+ < ! -- prettier-ignore-start -->
2183
22- ``` bash
23- unzip mina-rust-vX.Y.Z-docker-compose.zip
24- cd mina-rust-vX.Y.Z-docker-compose
25- ```
84+ :::warning Required Configuration The archive node requires a ` .env` file
85+ with PostgreSQL database settings. The example above provides the minimum
86+ required configuration. You can customize the database password and other
87+ settings as needed. :::
88+
89+ < ! -- prettier-ignore-stop -->
2690
27912. ** Launch Archive Node**
2892
@@ -55,9 +119,60 @@ Ensure Docker and Docker Compose are installed on your system -
55119
561203. ** Monitor the Archive Node**
57121
58- The archive node will be accessible at:
59- - ** Archive API** : http://localhost:3086
60- - ** Node API** : http://localhost:3000
122+ The archive node components will be accessible at:
123+ - ** Archive Service** : localhost:3086 (RPC protocol, not HTTP)
124+ - ** Node GraphQL API** : http://localhost:3000/graphql
125+ - ** PostgreSQL Database** : localhost:5432
126+
127+ # # Analyzing and Querying Archive Data
128+
129+ Once your archive node is running, you can analyze the stored blockchain data
130+ through multiple interfaces:
131+
132+ # ## Database Access
133+
134+ The archive node stores data in a PostgreSQL database with over 45 tables
135+ containing complete blockchain history. You can:
136+
137+ - ** Direct SQL queries** - Connect directly to PostgreSQL for complex analysis
138+ - ** GraphQL API** - Use the node' s GraphQL endpoint for programmatic access
139+ - **Pre-built queries** - Use existing SQL templates for common operations
140+
141+ ### Quick Database Test
142+
143+ ```bash
144+ # Connect to the database
145+ docker exec postgres-mina-rust psql -U postgres -d archive -c "\dt"
146+
147+ # Check recent blocks
148+ docker exec postgres-mina-rust psql -U postgres -d archive -c "SELECT COUNT(*) as total_blocks FROM blocks;"
149+ ```
150+
151+ ### Documentation for Developers
152+
153+ For comprehensive guides on querying and analyzing archive data:
154+
155+ - **[Archive Database Queries](../developers/archive-database-queries)** -
156+ Complete SQL reference, schema documentation, and analysis examples
157+ - **[GraphQL API Reference](../developers/graphql-api)** - Full GraphQL endpoint
158+ documentation and query examples
159+
160+ These developer guides include:
161+
162+ - Complete database schema and table relationships
163+ - Working SQL queries for blockchain analysis
164+ - GraphQL queries for real-time data access
165+ - Performance optimization techniques
166+ - Data export and backup procedures
167+
168+ ### Common Use Cases
169+
170+ 1. **Compliance and Auditing**: Track all transactions for regulatory compliance
171+ 2. **Analytics Dashboards**: Build real-time blockchain analytics
172+ 3. **Research**: Analyze network behavior, transaction patterns, and economics
173+ 4. **Block Explorers**: Power blockchain explorer websites
174+ 5. **Tax Reporting**: Generate transaction history for tax purposes
175+ 6. **Network Monitoring**: Track network health and validator performance
61176
62177## Node Parameters Reference
63178
@@ -102,45 +217,56 @@ the Makefile target. This method requires building from source.
102217### Archive Mode Configuration
103218
104219Mina Rust supports multiple archive modes that can be run simultaneously for
105- redundancy:
220+ redundancy. Each mode stores blockchain data in a different location or format.
221+
222+ #### Available Archive Modes
106223
107- ** Archiver Process (` --archive-archiver-process` )**
224+ ##### 1. Archiver Process (`--archive-archiver-process`)
108225
109- Stores blocks in a database by receiving them directly from the Mina Rust node.
226+ - **Purpose**: Stores blocks in a PostgreSQL database
227+ - **Method**: Receives blocks directly from the Mina Rust node via RPC
228+ - **Use case**: Primary archive method for database queries and analysis
110229
111- ** Required Environment Variables :**
230+ **Required environment variables :**
112231
113- - ` MINA_ARCHIVE_ADDRESS` : Network address for the archiver service
232+ - `MINA_ARCHIVE_ADDRESS`: Network address for the archiver service (e.g.,
233+ `http://localhost:3086`)
114234
115- ** Local Storage (` --archive-local-storage` )**
235+ ##### 2. Local Storage (`--archive-local-storage`)
116236
117- Stores blocks in the local filesystem.
237+ - **Purpose**: Stores blocks in the local filesystem
238+ - **Method**: Saves precomputed blocks as files on disk
239+ - **Use case**: Local backup and offline analysis
118240
119- ** Optional Environment Variables :**
241+ **Optional environment variables :**
120242
121- - ` MINA_ARCHIVE_LOCAL_STORAGE_PATH` : Custom path for block storage (default:
122- ` ~/.mina/archive-precomputed` )
243+ - `MINA_ARCHIVE_LOCAL_STORAGE_PATH`: Custom storage path
244+ - Default: `~/.mina/archive-precomputed`
123245
124- ** GCP Storage (` --archive-gcp-storage` )**
246+ ##### 3. GCP Storage (`--archive-gcp-storage`)
125247
126- Uploads blocks to a Google Cloud Platform bucket.
248+ - **Purpose**: Uploads blocks to Google Cloud Platform bucket
249+ - **Method**: Stores precomputed blocks in GCP Cloud Storage
250+ - **Use case**: Cloud backup with GCP integration
127251
128- ** Required Environment Variables :**
252+ **Required environment variables :**
129253
130254- `GCP_CREDENTIALS_JSON`: Service account credentials JSON
131- - ` GCP_BUCKET_NAME` : Target storage bucket name
255+ - `GCP_BUCKET_NAME`: Target GCP storage bucket name
132256
133- ** AWS Storage (` --archive-aws-storage` )**
257+ ##### 4. AWS Storage (`--archive-aws-storage`)
134258
135- Uploads blocks to an AWS S3 bucket.
259+ - **Purpose**: Uploads blocks to AWS S3 bucket
260+ - **Method**: Stores precomputed blocks in Amazon S3
261+ - **Use case**: Cloud backup with AWS integration
136262
137- ** Required Environment Variables :**
263+ **Required environment variables :**
138264
139265- `AWS_ACCESS_KEY_ID`: IAM user access key
140266- `AWS_SECRET_ACCESS_KEY`: IAM user secret key
141- - ` AWS_DEFAULT_REGION` : AWS region name
142- - ` AWS_SESSION_TOKEN` : Temporary session token for temporary credentials
267+ - `AWS_DEFAULT_REGION`: AWS region (e.g., `us-west-2`)
143268- `MINA_AWS_BUCKET_NAME`: Target S3 bucket name
269+ - `AWS_SESSION_TOKEN`: Temporary session token (for temporary credentials)
144270
145271### Setup and Run
146272
0 commit comments