Sunday, October 10, 2021

How to mine Monero on Microsoft Windows

If you are interested in trying to try out mining a cryptocurrency, this guide can be used by most people - even those with low internet bandwidth and a weak or old computer. You will learn the mechanics of how to mine a cryptocurrency through a pool, though don't expect to make much money.

Bitcoin was the original cryptocurrency, with the proof of work software released in January 2009. Proof of work means the cryptocurrency mining software performs calculations using the CPU to determine which miner will put the next block of transactions onto the blockchain. The Bitcoin software can still be run on CPUs, though the majority of the miners use specialized hardware which is optimized to specifically run the Bitcoin mining algorithm. 

The other well-known mining algorithm is proof of stake. In general, this requires a person to "stake" tokens or coins as collateral. Based on shares or round-robin or other methodology, a staker is chosen to submit the next block of transactions. If an invalid block is submitted, others can slash the staked tokens as a penalty.

Ethereum is a proof of work cryptocurrency which is undergoing changes which will allow the network to move to proof of stake. Some people consider proof of stake to have advantages over proof of work, including using a small fraction of the electricity consumed by proof of work blockchains.

Monero is a proof of work blockchain which is specifically designed to be mined only on computer CPUs. This makes mining on video graphics cards or specialized hardware difficult and not cost effective. By allowing anyone to run the mining code on a CPU and to be competitive, Monero aims to create a larger and more distributed group of miners.


This post focuses on running Monero mining software on Microsoft Windows through a mining pool. The mining pool reduces network and storage costs by relieving the client machine from hosting the full node software to route and store transactions. While this allows a person to more easily mine, it does reduce the usefulness of the mining node to submit and validate transactions. Nonetheless, mining Monero through a pool is a good way to gain mining experience.


The basic tasks for running a Monero mining node is to download and install the software, create a wallet, and then run and monitor the mining code.

The cryptocurrency wallet creates and stores a private key / public key pair. The wallet can typically view balances and send and receive coins.

For now, let's focus on mining using Microsoft Windows, a wallet, and the xmrig software. Download the xmrig software from github. Look for the win64 version. Use Windows File Explorer to uncompress the zipped folder. Go into the folder structure (currently it looks like "xmrig-6.15.1-msvc-win64\xmrig-6.15.1"). Create a file named something like startminer.cmd as a txt file. This is a Windows Command Script file which will contain your settings and run the miner.

Edit startminer.cmd and add these three lines:
@echo off
xmrig.exe -o pool.supportxmr.com:443 -u 44YkNzrdJnmAqwoTRMPV2e4fihv3AfZ5vMmrtaWCGQaxKuXp5eiZeRREzhPi9tVqGuA3VBRriNwKa2QxmZmRGmHVTkUSTMc -k --tls -p runDemoA
pause

Open a command prompt by pressing Windows Start Button, type cmd, and click on the Command Prompt app. Go to the location of the startminer.cmd file. Type: startminer.cmd 
Depending on your internet filtering and DNS settings, you may see some warnings. Also, Microsoft Windows security may flag the miner as being a cryptocurrency miner trojan. Since you want to be mining, disable this specific security warning.

After the miner is running, you may use a web browser to monitor your miner. Please note the mining pool at SupportXMR receives at least a 1% fee for their services, and any mining rewards will go to the address in the command script which starts with "44...".

The Command Prompt window will continue to show output from the miner. In the following picture, the first two orange circles show that Microsoft Windows has "core isolation" memory integrity turned on and that it uses a Virtual Machine. If your operating system is running with the VM on (probably a good thing for most people), ignore these apparent errors in the first two orange circles. The third orange circle shows the current mining work output. This picture is from an older machine which shows how a CPU which is several years old can be used to mine transactions via a mining pool.

To monitor the miner in the mining pool, go to SupportXMR.com and enter the public key from the Command Script file: 44YkNzrdJnmAqwoTRMPV2e4fihv3AfZ5vMmrtaWCGQaxKuXp5eiZeRREzhPi9tVqGuA3VBRriNwKa2QxmZmRGmHVTkUSTMc

You will be able to see information including the custom name in the startminer.cmd file, along with your hash rate.


It is typically good to lower the operating system priority of the mining process to reduce interference with other processes on the machine. You certainly want to lower the priority if you are also using the machine for regular play and work. Right-click on the Windows Start Button and click on Task Manager. In task manager click on the Details tab. Click on the CPU column so the highest CPU consumer will appear at the top. This will typically be the xmrig.exe mining software. Right-click on the xmrig.exe line, and set the Priority to Below Normal.

Download the wallet software and install the program. Create a new wallet, and write down the recovery words. Learn more by reading the wallet README.


Copy the wallet primary account address and the public key from the GUI wallet. You can put that address into your Command Script file and restart the miner to allow any rewards to go to your wallet.



Saturday, October 09, 2021

Microsoft Windows File Explorer Customization

The File Explorer in Microsoft Windows allows access to various context-sensitive menus by right-clicking the mouse button. You may customize many of the menus. This post will show you how to modify the context-sensitive menus for "new" file, "open with", and "send to".

The "new" menu may already have items for BMP image and several other document types. Look at your configuration by going to an empty place on the Desktop or in File Explorer, right-click the mouse button, and go to New.


Let's add an item to create a new JPEG image. Press the Windows Start Button and type registry. Click on the Registry Editor app. 

In the Registry Editor go to registry key: HKEY_CLASSES_ROOT\.jpg

Right-click on ".jpg" and add a new Key with name ShellNew.

In ShellNew, create a new "String Value" with value of FileName. Modify the FileName entry with "Value Data" of Template.jpg.


You may close the Registry Editor. Now right-click on the Desktop or in File Explorer, go to New, and there should be an option to create a new JPEG image.



The context-sensitive Open With menu shows appropriate choices for each file type. Because there are many file types, there are many settings which may be shown depending on the file type. In the following picture, this is a text file and the file type is ".txt".



Create the new text document, then right-click on the file and go to the Open With entry. You should see various text editors.



These settings are stored in the Windows registry and may be modified with the Registry Editor for each file type.

Let's add a program in the Open With menu. Click on the Windows Start Button, type regedit, and click on Registry Editor.

In the left pane of the Registry Editor, go to key: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\

Go to the .txt entry, and click on OpenWithList.



Add the office writer application to the Open With menu for ".txt" files. In the right-hand panel, right-click and press New, String Value. The Value Name should be the next letter in the alphabet. 

Double-click the new entry and in the Value Data field add the office writer application of "soffice.exe".


Now when you go to the Open With item, you should see the office writer application as a choice.

While you are in Registry Editor, you may also remove items. Go to the file type, select the item, and then press Delete.



The Send To in File Explorer is a context-sensitive menu which appears when you right-click an item. Let's add an item to the list.


Press the Windows Start Button and type: run
Click the Run App. In the Run app, enter shell:sendto and press the OK button.



This will open a folder which contains the various items. 



Delete any items you do not want by selecting the item and deleting it. 


Add items by copying a shortcut to the program into this folder. For example, if you would like Microsoft Paint to appear in the Send To menu, find the path to the program (Start Button, scroll to Windows Accessories and expand it, right-click on Paint, choose More, then choose Open File Location. After the File Explorer window open, right-click on Paint and choose Copy. In the SendTo folder, right-click on a white sort and choose Paste Shortcut.)


The SendTo folder will look like:


Now when you are in File Explorer and right-click an item to display the context-sensitive menu, Send To will show the new entry which you just added. It may be useful to add the Notepad application to the Send To menu to make it easy to quickly bring up the editor for working with ".cmd" files (Windows command script files or batch files).



Monday, July 26, 2021

Microsoft Windows Core Memory Integrity

Microsoft Windows 10 memory integrity, or "core isolation", uses hardware virtualization to protect memory used by Windows system processes from manipulation (often by malware). This is generally a good security feature to enable, though it may interfere with older device drivers. This option is not automatically turned on by some vendors, so you will need to check this yourself.

Read about Microsoft's Core Isolation.

A recently purchased MS Windows 10 chromebook from Dell had this option turned off, so Core Integrity should be checked even on factory-delivered machines. The Dell chromebook was runing the Windows version known as "Windows 10 Home in S mode". 

For any Windows 10, check if Windows is running with virtualization by looking in Task Manager. Press Start button, and type: task manager
Choose the Task Manager app. 

In Task Manager, click the Performance tab, then CPU. Look in the lower right for Virtualization. In the following picture of Task Manager, hardware virtualization is enabled. Alternatively, open a command prompt, run systeminfo, and look for the Hyper-V line.




 

 

 

 

 

 

 

 

 

 

If Virtualization is not enabled, reboot the machine and press a key for BIOS setup (often a function key or the DEL key). In the BIOS setup utility, look for virtualization or "VT" and turn it on. Save the BIOS settings and restart the machine. Here are a couple different BIOS pictures:














After rebooting and starting Windows, go to the Settings app (press the Start button, press the gear icon). In the Settings app, type: core isolation

Pressing Core Isolation will open Windows Security, Device Security, and Core Isolation Details. 




























If you do not see Memory Integrity on the Core Isolation page, you will need to restart the computer and enter the BIOS settings to turn on virtualization options. 

If Memory Integrity is already turned on, your machine is configured to use core memory integrity and your are done. 

If Memory Integrity is off, try to turn it on. In some cases it will turn on easily. In other cases it will want a reboot. In more challenging cases it will find incompatible drivers and you can decide how to correct each driver.















For the following procedures, you will need to be the computer Administrator.

It may take a restart to fully set Core Isolation to on. If it finds incompatible drivers, press the Review link.














 

Some incompatible drivers must be completely removed. In one case, I encountered an incompatible Realtek sound driver that I removed, rebooted, turned on Memory Integrity, and then was able to reinstall the same sound driver while successfully keeping Memory Integrity turned on.

























 


In this example, the Realtek sound driver and the ViMicro web cam drivers are incompatible. To remove these drivers, look in device manager and uninstall the drivers. As computer Administrator, press Start button and type: device manager
Look around in Device Manager for the yellow flags, and try to update or uninstall the device and delete the driver software. In this case, the old driver "oem3.inf" could not be removed through Device Manager.

The driver was able to be removed from the command line as Administrator: pnputil /delete-driver oem3.inf










If a driver will not uninstall, you can also remove it by hand (or rename it). Look in folder C:\Windows\System32\drivers.


When done resolving incompatible drivers, the Memory Integrity setting in Windows Security Center should look like this.






 

 

 

 

 

 

 

 

 

 

When finished, you may want to create a restore point. Press the Start button and type: restore point
Configure and Create the new restore point. 

You should now check for corrupt Windows files. This will run the Windows Module Installer and verify and correct the Windows software.