Setting Up and Running a Qubic Archive Server
Set up an archive server to store and validate Qubic transaction data using scripts for peer maintenance, tick files, and epochs.
Qsilver · Jan 22, 2024.
Introduction
Qubic is not your ordinary crypto! Without a blockchain, it’s initially unclear how transactions are validated, and weekly pruning of transaction data presents challenges in determining past transactions. The archive server addresses these issues by storing all relevant data from each epoch automatically, handling epoch changes without recompilation (unless the network protocol changes).
Setup and Compilation
Assuming a Linux server, follow these steps to set up the archive server:
git clone https://github.com/Qsilver97/qubic-cli
cd qubic-cli
mkdir build
cd build
cmake ..
make
g++ -I.. ../bxid.cpp ../connection.cpp -o bxid
Your system will need g++
to compile C++ code, cmake
, and e2fsprogs
. These usually come standard and may not require installation via apt-get
.
Running the Archive Server
To run the archive server continuously, use infinite loop bash scripts:
while true; do ACTION; done
Run each script in a separate window or asynchronously with &
. If disconnection is a risk, use:
nohup ./script > script.out &
Actions and Scripts
1. Maintaining Peers List
Create a loop script with the action:
./bxid peersloop
This script will update the peer directory with files named after peer IP addresses, essential for queries to find the current and previous epoch peers.
2. Fetching Tick Files
Create a loop script with the action:
./bxid maketickfiles
This script saves quorum files and tick data in their respective directories. It works in two phases: parallel requests to get tick files and a sequential mode with retries. Running this script in a loop ensures more files are obtained with each iteration.
3. Scanning Epochs
Create a loop script with the action:
./bxid scanepoch 0
The epoch value of 0 means the script will determine the current epoch and generate .json
files for the archive. Ensure the computors
file for the specified epoch is available.
4. Generating JSON Files and Posting to OpenSearch
Create a loop script with the action:
./bxid jsonfiles
This script generates .json
files and posts them to OpenSearch, performing basic validations and deleting invalid files.
5. Validation
Create a loop script with the action:
./bxid validate
This script validates quorum votes, ensuring 451+ votes with matching hashes and verifying the tick data hash. It write-protects validated files to prevent revalidation.
Using OpenSearch
Install OpenSearch by following instructions on opensearch.org. Ensure it’s available on localhost:9200
. Modify opensearch()
and opensearchpost()
functions in bxidutils.cpp
to use appropriate credentials if logins and certificates are added. To run the archive server without OpenSearch, comment out #define POST_TO_OPENSEARCH
in bxid.cpp
.
Additional Tools
For those with access to a computor log feed, create a bxid
dataset using:
./qubic-cli -nodeip (ipaddr) -getlogfromnode (pass0) (pass1) (pass2) (pass3)
./bxid logjson logfileN
Replace N
with the source number of the computor log entries. This creates and maintains logs in logs/(epoch)/logfileN
and its .json
file.
Final Notes
Add a script to include:
./bxid qchain 0
This generates a qchain
dataset, a digest of all invariant data in the quorum vote and the previous tick digest. This helps ensure identical data across different archives.
Conclusion
The archive server setup with its various scripts ensures Qubic transaction data is comprehensively stored and validated. With these tools, you can maintain a robust archive server capable of handling Qubic’s unique transaction processing.
For the latest updates, join the Valis Discord, follow us on X, and bookmark our blog.
On this Page
- Setting Up and Running a Qubic Archive Server
- Introduction
- Setup and Compilation
- Running the Archive Server
- Actions and Scripts
- 1. Maintaining Peers List
- 2. Fetching Tick Files
- 3. Scanning Epochs
- 4. Generating JSON Files and Posting to OpenSearch
- 5. Validation
- Using OpenSearch
- Additional Tools
- Final Notes
- Conclusion