Skip to content

AlonBletter/crypto-mining-multiprocess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crypto Mining Simulation with Docker

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.

✨ Key Features

  • 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.sh script handles setup, configuration, and launch of containers.
  • Syslog Integration: Logs are routed to system logs for monitoring and debugging.

🛠 Components

Server Container

  • 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

Miner Containers

  • 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

🚀 Getting Started

1. Launch the Simulation

From the scripts/ directory, run:

sudo ./launcher.sh

This will:

  • Create or overwrite /tmp/mtacoin
  • Write DIFFICULTY=20 into mtacoin.conf
  • Pull the server and miner Docker images
  • Launch one server container and three miner containers

⚠️ Important:

  • Script must be run with sudo to access /tmp and execute Docker commands
  • The directory /tmp/mtacoin will be created (or reset)
  • Make sure Docker is installed and running

2. Reset the Environment

To clean everything:

sudo ./cleanup.sh

You can inspect logs by entering a container's shell:

docker exec -it <container_name_or_id> bash
cat /var/log/mtacoin.log

✅ Requirements

  • 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors