This project simulates a crypto mining environment using Docker-based microservices. It transitions from a traditional multithreaded architecture to a multiprocess containerized setup, offering modular deployment and better process isolation.
- Dockerized Architecture: Server and miner are isolated in separate containers.
- IPC via Named Pipes: Communication is implemented using named pipes (FIFOs), enabling non-blocking data exchange between processes.
- Dynamic Miner Deployment: While the server is running, you can deploy and take down miners at will.
- Automated Deployment: A custom
launcher.shscript handles setup, configuration, and launch of containers. - Syslog Integration: Logs are routed to system logs for monitoring and debugging.
- Handles:
- Miner subscriptions
- Block validation
- Reads mining configuration (difficulty) from a mounted config file.
- Publishes current block info via named pipes.
- Uses syslog for all server activity logging.
📦 Docker Image:
coin_server_img on Docker Hub
- Subscribes to the server.
- Listens for block data via non-blocking named pipes.
- Mines blocks and submits results to the server.
- Logs activity using syslog.
📦 Docker Image:
coin_miner_img on Docker Hub
From the scripts/ directory, run:
sudo ./launcher.shThis will:
- Create or overwrite
/tmp/mtacoin - Write
DIFFICULTY=20intomtacoin.conf - Pull the server and miner Docker images
- Launch one server container and three miner containers
⚠️ Important:
- Script must be run with
sudoto access/tmpand execute Docker commands- The directory
/tmp/mtacoinwill be created (or reset)- Make sure Docker is installed and running
To clean everything:
sudo ./cleanup.shYou can inspect logs by entering a container's shell:
docker exec -it <container_name_or_id> bash
cat /var/log/mtacoin.log- Docker
- Bash
- Root permissions (for script and Docker execution)
Feel free to clone, run, and modify the system to experiment with distributed crypto mining simulations.