Duinocoin Mining with Arduino UNO/Nano

It's easy: Getting started with Duinocoin (DUCO) using an Arduino UNO/Nano

The Duinocoin (DUCO) was originally developed for the Arduino UNO. Therefore, mining with the Arduino UNO is the ideal introduction to DUCO mining with microcontrollers..

In addition to an Arduino UNO or Nano, a PC, a notebook or a Raspberry Pi (for the Arduino development environment (IDE) and as a communication computer) is sufficient to get started with DUCO mining.

Overview

To mine the Duinocoin (DUCO) with an Arduino UNO or Nano, you need - besides an Arduino UNO/Nano - the following:

  1. a Duinocoin-Wallet (online account)
  2. a computer with Windows, GNU/Linux or Mac OS X and Python 3.x
  3. A working Arduino IDE.
  4. the Duinocoin software (from Github).

The preparations can be done in about half an hour. With this setup and a single Arduino UNO/Nano, you can subsequently mine around 5-9 DUCO per day.

1. Create a Duinocoin wallet on the project page

To be able to store the mined Duinocoin (DUCO) somewhere, you need a wallet. This is managed online at Duinocoin. The new wallet is created at https://wallet.duinocoin.com/register.html.

Create a new wallet

Create a new wallet (account) at wallet.duinocoin.com.

2. Computer with Windows, GNU/Linux or Mac OS X and Python 3.x

The minimal mining software for the PC only requires a Python 3 interpreter. To check whether Python 3 is available, do the following:

  • GNU/Linux: Open terminal via Ctrl-Alt-T (if necessary, use Ctrl-Alt-F2, back with Ctrl-Alt-F7).
  • Windows: Open Powershell via Win+R and "powershell".
  • Mac OS: Finder > Applications > Utilities > Terminal

At the prompt, enter the following:

python --version

The two minus signs are important (except for Mac OS X). If "python" is not found, you can try "python3 -- version", then the version is hardcoded. The result should look something like this:

mipl@z600:~$ python3 --version
    Python 3.9.2

This machine (an HP Z600 workstation with Devuan GNU/Linux 3.0 "Chimaera" without systemd) is obviously running Python 3.9.2.

How to install Python3 on your computer is described in detail in Installing Python3 on GNU/Linux PC.

3. install the Arduino IDE (development environment)

The easiest way to program mining software on a microcontroller like the Arduino UNO/Nano is to use the Arduino IDE (development environment). The free and open source software is offered by the Arduino Project as a free download for Windows, GNU/Linux and Mac OS X.

In a detailed article I show how to install the Arduino IDE. If you want it to be more comfortable, you can install the Arduino IDE in "portable mode" and thus make your backups and switching between different microcontroller architectures easier. A third article gives tips for the first steps after installing the Arduino IDE.

Tip: If you have problems accessing the Arduino UNO/Nano on GNU/Linux computers, you have to adjust the access rights to device files (serial ports, USB) under GNU/Linux.

With this, nothing should stand in the way of Duinocoin mining.

4. download Duinocoin software

The official software for Duinocoin mining is provided by the Duinocoin project in source code. The latest version is always available on Github.

Github Repo of revox

The Duinocoin repository from revox on Github.

Via "Code / Download ZIP" the ZIP archive with the current Duinocoin code is downloaded and can then be unpacked to duino-coin.

Alternatively, you can download the current Duinocoin version via git:

git clone --depth 1 -b 3.18 https://github.com/revoxhere/duino-coin

If there is a newer version than 3.18, you have to replace it in the above command. Also with git you get a directory duino-coin with all files.

  • The directory Arduino_Code contains the source code (sketch) for the Arduino UNO/Nano.
  • PC_AVR_Miner.py then handles the communication between the pool servers and the Arduino UNO/Nano.

Install the PC software for mining management

First, the necessary software and tools should be installed on the PC. The communication software for connecting the Arduino UNO to the Duinocoin servers on the internet is written in Python3. Basically, Python3 itself and the Python package manager "pip" in version 3 are required. All these packages have to be installed as "root" or prefixed with "sudo":

sudo apt-get install python3 python3-pip

If you want to pack the Python3 environment for the user into a virtual Python3 environment - which you should always do - install the venv module as well. This is the only way to install the following rat's tail of colourful and half-assed libraries not in the system itself, but only in a directory to be specified by the user:

sudo apt-get install python3-venv

How to set up and use a Python3 virtual environment I show here. Not for pure mining, but for other Duinocoin tools, the Python Image Library (pil) and even a Tkinter-compatible PhotoImage library may also be needed later:

apt-get install python3-pil python3-pil.imagetk

Programming Arduino UNO/Nano with DUCO-Miner

Now it is time to plug in the Arduino via USB cable and start the Arduino IDE. When starting the development environment for the first time, do not forget to update the boards and libraries.

Via "File / Open..." you load the Duinocoin source code (sketch) "Arduino_Code.ino" from the duino-coin/Arduino_Code/ directory into the editor. Translate the source code with [Ctrl]+[R] or by clicking on the "OK hook" at the top left of the IDE toolbar. No errors should occur.

Arduino IDE with Duinocoin-Sketch

The Duinocoin-Sketch 3.18 was compiled with the Arduino IDE 1.8.19 without errors.

Normally, the USB port to which the Arduino UNO/Nano is connected must be selected via "Tools / Port" (for example /dev/ttyACM0 (Arduino Uno) or /dev/USB0 for a clone.

With [Ctrl]+[U] or a click on the right arrow in the toolbar, the translated AVR code is transferred (flashed) to the Arduino UNO/Nano. The IDE reports an inconspicuous "Upload complete."

If the error PermissionError: [Errno 13] Permission denied: 'dev/ttyACM0' occurs, the access rights to device files (serial ports, USB) must still be set.

Start mining

To now mine Duinocoin (DUCO) with the Arduino UNO/Nano, start the AVR_Miner.py script via the Python3 interpreter:

python3 AVR_Miner.py

The script installs additional libraries and asks for

  • the name of the wallet/account
  • the (optional) mining key (enter only if set)
  • the serial port of the Arduino UNO/Nano (dev/ttyACM0 or /dev/USB0 for a clone)
  • Additional boards and identification are needed if you use more than one miner.
  • Donation level (0-5) for the intensity of the MAGI miner on the PC (0 for testing, later you can run the miner)
  • Use lower difficulty? (enter "n" only for very fast computers)
Arduino mining Duinocoin

The first start! The Arduino UNO mines its first DUCO with a whopping 258-260 hashes per second....

That's it! This is the start of the mining process.