Running An Historical Node Using Docker
Welcome to this guide on running a node! In this tutorial, we'll walk you through the steps required to get your own node up and running. Running a node is an important way to contribute to the network's security and decentralization while helping validate transactions.
Why run an historical node?
Historical nodes are special nodes that do not vote but ensure the network stays in sync by storing votes, notifying other nodes about transactions, and helping other nodes to bootstrap.
Currently, any node without a private key is considered a historical node.
Prerequisites
Before we begin, make sure you have the following:
- Docker installed
- Basic knowledge of networking
- A stable internet connection
Step 1: Open a Port on Your Router
Before running the node, make sure to open the appropriate port on your router. The node will not work if it is not reachable by other nodes during the handshake process. During this process, nodes will validate that your node is indeed the owner of the domain or IP address provided. If this validation fails, the connection will be dropped.
- Open port 8082 for the node to communicate with other nodes in the Atto network.
Refer to your router's manual or an online guide on how to open ports, often called 'port forwarding'.
Step 2: Run the Node
To run an Atto node, you'll use Docker Compose to set up and start the necessary services.
Using Docker Compose
Create a docker-compose.yml
file with the following content:
services:
node-mysql:
image: "mysql:8.0"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_DATABASE: "node"
MYSQL_ROOT_PASSWORD: "root"
volumes:
- node_mysql_data:/var/lib/mysql
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
node:
image: "ghcr.io/attocash/node:dev"
ports:
- "8080:8080"
- "8081:8081"
- "8082:8082"
environment:
ATTO_PUBLIC_URI: "ws://{external-ip}:8082"
ATTO_DB_HOST: "node-mysql"
ATTO_DB_NAME: "node"
ATTO_DB_USER: "root"
ATTO_DB_PASSWORD: "root"
LOGGING_LEVEL_CASH_ATTO_NODE_NETWORK: "INFO"
LOGGING_LEVEL_CASH_ATTO_NODE_ELECTION: "INFO"
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8081/health" ]
interval: 60s
timeout: 10s
retries: 5
start_period: 180s
depends_on:
- node-mysql
restart: unless-stopped
volumes:
node_mysql_data:
To start the services, run:
docker compose -f docker-compose.yml --project-name atto up -d
This will start both the MySQL service and the Atto node service in detached mode (-d
). The MySQL database is used to store node data, make sure to backup this data.
Step 3: Configure Your Node
The configuration for the node is already provided in the docker-compose.yml
file under the environment variables section. You should modify the ATTO_PUBLIC_URI
, ATTO_DB_NAME
, ATTO_DB_USER
, ATTO_DB_PASSWORD
, and other settings to suit your setup.
Don't forget to set ATTO_PUBLIC_URI
, otherwise your node won't be reachable.
Step 4: Verify Your Node
To verify that your node is running correctly, you can check its status by executing:
docker compose exec node curl -f http://localhost:8081/health
This command will provide you with information about the node's health status.
Step 5: Enjoy!
Congratulations! You now have an Atto node running using Docker Compose, contributing to the decentralization and robustness of the Atto network. Running a node is a rewarding experience that not only supports the network but also helps you learn more about how blockchain technology works.
If you have questions or run into any issues, feel free to join our Discord community for help and support.