Category Archives: Cryptocurrency

Building Kawpowminer From Source on Ubuntu 20.04 Linux

I wanted to build kawpowminer from source so I could mine some Ravencoin. I ran into some issues getting it to build, so I’m documenting them here in case anyone else runs into the same problems.

Let’s assume you’ve gotten past the part where you install all of the dev libraries you need (cuda, etc) and are trying to get the kawpowminer source to build (if you miss a library, it’s generally pretty obvious from googling the build error which one you need to add and then try again).

git clone https://github.com/RavenCommunity/kawpowminer
cd kawpowminer
git submodule update --init --recursive
cmake .

It’s at this point that you’re likely to see an error.

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_cuda_LIBRARY
linked by target "ethash-cuda" in directory /home/xangis/code/kawpowminer/libethash-cuda
CUDA_nvrtc_LIBRARY
linked by target "ethash-cuda" in directory /home/xangis/code/kawpowminer/libethash-cuda

-- Configuring incomplete, errors occurred!

To get past this, you’ll need to find where your libcuda.so and libnvrtc.so files are. I install mlocate on my machines so I can do “locate libcuda.so” to find the file location. Once you’ve found (or installed) them, add the file locations to the cmake command line like so:

cmake . -DETHASHCUDA=ON -DETHASHCL=ON -DCUDA_cuda_LIBRARY=/usr/lib/x86_64-linux-gnu/libcuda.so -DCUDA_nvrtc_LIBRARY=/usr/lib/x86_64-linux-gnu/libnvrtc.so

CMake should run for a while and do a bunch of things. Eventually you’ll be ready to run “make” to create the final build of the app. Except, it doesn’t like the default Ubuntu gcc v9 install. It’s too new:

[ 64%] Building NVCC (Device) object libethash-cuda/CMakeFiles/ethash-cuda.dir/ethash-cuda_generated_CUDAMiner_cuda.cu.o
In file included from /usr/include/cuda_runtime.h:83,
from :
/usr/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc versions later than 8 are not supported!
138 | #error -- unsupported GNU version! gcc versions later than 8 are not supported!
| ^~~~~
CMake Error at ethash-cuda_generated_CUDAMiner_cuda.cu.o.Release.cmake:220 (message):
Error generating
/home/xangis/code/kawpowminer/libethash-cuda/CMakeFiles/ethash-cuda.dir//./ethash-cuda_generated_CUDAMiner_cuda.cu.o

make[2]: *** [libethash-cuda/CMakeFiles/ethash-cuda.dir/build.make:65: libethash-cuda/CMakeFiles/ethash-cuda.dir/ethash-cuda_generated_CUDAMiner_cuda.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:513: libethash-cuda/CMakeFiles/ethash-cuda.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 66%] Linking CXX static library libpoolprotocols.a
[ 66%] Built target poolprotocols
make: *** [Makefile:152: all] Error 2
xangis@spica:~/code/kawpowminer$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

To get around this, you’ll need to install an older version of gcc. I went back to version 7 because I didn’t want to worry about installing v8.1 for example, and then being told that it won’t work because it’s a version later than 8.

sudo apt-get install gcc-7 g++-7

Now you have two versions of GCC installed, and your system won’t use the older one. There are a few ways to switch them (including update-alternatives), but the quickest way is to remove the /usr/bin/gcc link to gcc-9 and replace it with one to gcc-7.

sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-7 /usr/bin/gcc

Now if you run “make”, you won’t get the error message about your gcc being too new. You’ll probably want to reverse this change after you’re done building, unless you want to keep using the older version of GCC, which you might want to do if you’ll be working on the kawpowminer code.

sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-9 /usr/bin/gcc

I Set Up a Ravencoin Node

I have a handful of mostly-idle Ubuntu servers, so I decided to set up a Ravencoin node on one of them.

I used this tutorial by Tron Black for the setup. (Warning: Medium is now a paywall site)

At the risk of repeating, this is how I set up a node on my Ubuntu 20.04 server (from my user home directory):

wget https://github.com/RavenProject/Ravencoin/releases/download/v4.3.2.1/raven-4.3.2.1-x86_64-linux-gnu.zip
unzip raven-4.3.2.1-x86_64-linux-gnu.zip
cd linux
gunzip raven-4.3.2.1-x86_64-linux-gnu.tar.gz
tar xf raven-4.3.2.1-x86_64-linux-gnu.tar

Yes, we have a gzipped file inside of a zip file. That’s a little odd, but not a big deal.

cd raven-4.3.2.1/
sudo ln -s ~/raven-4.3.2.1/bin/raven-cli /usr/bin/raven-cli
sudo ln -s ~/raven-4.3.2.1/bin/ravend /usr/bin/ravend
ravend -daemon -maxconnections=10000

Wait a few seconds.

ps aux|grep ravend

The process should show up if the daemon started successfully. Running it manually like that means it’ll have to be restarted if the machine restarts, but this one has an uptime of 181 days, so that’s not a frequent occurrence.

Now to check status:

raven-cli getnetworkinfo

Outputs:

{
"version": 4030201,
"subversion": "/Ravencoin:4.3.2.1/",
"protocolversion": 70028,
...
"connections": 25,
...
"localaddresses": [
{
"address": "216.151.2.51",
"port": 8767,
"score": 1472
}
],
}

I trimmed out a bunch of extra stuff for the sake of space (thus “…”), but the important things to see are that it’s using the right IP address and that there’s a positive number of connections (25). It’s working! I’m very curious what the “score” is for, though. It’s not always the same.

I waited a day or so to see whether it shows up on the raven nodes site, and it does.

Ravencoin Node in Portland Area

As far as I know, you don’t actually get any direct benefit from running a raven node (transaction fees, etc), it just keeps things running smoothly on the Raven network.

Essentially, you’ve left water out for the birds, but they’re not going to bring you shiny things. But, it never hurts to have some goodwill from the ravens.

You can always RVN me at RRWHrajdjJV7kKdZoeRFbKHkEeuh9jBKR4

First Steps Mining Ravencoin

I don’t have a gaming rig. I don’t even have a desktop computer. So, how am I going to be able to mine any kind of cryptocurrency? Fat chance.

Well, it turns out that if you have a fairly powerful laptop video card, you can mine Ravencoin. I have a GeForce 1650 Max-Q, which gets about 5.6 MH/s with the KAWPoW algorithm used for Ravencoin. I used kawpowminer on Windows, but there are plenty of other options for both Windows and Linux.

How did I decide what mining pool to use?

Well, I checked MiningPoolStats to find the most popular ones. 2Miners and Flypool were at the top of the list, but I checked out their websites and I didn’t care for the look and feel of them. After checking a few more, I settled on miningpoolhub. Their website has a clean look, it’s easy to set up payouts, and they have a nice view of your stats with the important info up front.

I’ve been running for a few days and so far I’ve been getting about 5 RVN per day. It’s not a lot — only 60 cents worth — but it’s enough to make it feel like I’m making progress. The computer was going to be on anyway, so I might as well get some use out of it.

Don’t be afraid to try a few different mining pools. The interfaces, fees, payout frequency, coin conversion, and other features vary considerably.

You can always RVN me at RRWHrajdjJV7kKdZoeRFbKHkEeuh9jBKR4

Finding Good Cryptocurrency

It’s been about seven years since I’ve paid any attention to the world of cryptocurrency. A lot has changed since then. There are now THOUSANDS of coins in the world. How do you figure out which ones to pay attention to?

I started by checking the coin ratings at isthiscoinascam.com. I only gave serious attention to coins rated at least 6.0 (Good), which at the time of this writing is 67 coins. I also looked at some of the coins rated between 5.0 and 6.0 (Above Average), but only if they had names that sounded interesting. For the most part there wasn’t much worth looking at below 6.0.

For each of those coins, I took a look at the profile and statistics at coinmarketcap.com. I eliminated anything that had a focus that didn’t seem very interesting to me, anything that looked like it had peaked and was on the decline, or anything that had numbers that didn’t look right to me.

That left a handful of coins that seemed like they were worth holding as investments (to me). I’m not looking for insane 10x+ returns, but rather some solid growth over the next few years. In other words, I’m looking for assets rather than lottery tickets.

The ones I decided that I wanted to hold some of are:

Algorand (ALGO)
Bitcoin (BTC)
Cardano (ADA)
Cosmos (ATOM)
Dash (DASH)
Ethereum (ETH)
Litecoin (LTC)
Monero (XMR)
Polkadot (DOT)
Ravencoin (RVN)
Stellar (XLM)
Tezos (XTZ)
ZCash (ZEC)

Honorable mentions (things I’ll consider getting) are:

Aave (AAVE)
Chainlink (LINK)
Polygon (MATIC)
Solana (SOL)

Of the good choices, the one that seems to have the most potential is Ravencoin. I’ll have to look into that in more detail.

With 13 coins in the list of things I want to hold on to, it should be pretty easy to build a diversified portfolio. Some things will do well, and some won’t, but I think cryptocurrency is still on the rise and chances are good that there will be a significant positive return.

How I Feel About Bitcoin

I am generally pretty indifferent to Bitcoin. Unlike many who think it’s either “the wave of the future” or going to bring about the end times through a global warming apocalypse, I don’t think it’s really all that important other than as a research project.

Bitcoin is Cryptocurrency 1.0. It was an interesting idea that doesn’t have much long-term potential due to its flaws (slow transaction confirmation, high transfer fees, massive energy consumption). That said, you may very well make a profit investing in Bitcoin (BTC). Markets are weird and have many factors, and while Bitcoin itself is not great for small retail transactions, it could still be a valid store of value akin to buying a gold bar. You can’t buy a cup of coffee with a gold bar either. Bitcoin doesn’t seem to be all that interested in further innovation to improve, either, which is why forks like Bitcoin Cash exist.

Ethereum is in a similar situation — as cryptocurrency 2.0, it solved some problems that Bitcoin didn’t, but still has its own issues. Another useful research project, and one that is still innovating and doing new things, but one that will probably not survive as new cryptos evolve.

Newer cryptocurrencies build on the good ideas that Bitcoin and other early-generation cryptocurrency brought to the world, but also solve some other important problems. For example, proof-of-stake-based coins don’t use ASIC mining (which consumes a lot of electricity and contributes to global warming). Many others have a low energy footprint or base themselves on things other than mass computational power. As more environmentally friendly coins come around, the energy-hogging ones will gradually fade.

I don’t see either of them having much long-term usefulness, probably not greater than 20 years, but that doesn’t mean they won’t continue to have value in much the way that antiques do. Ancient Greek and Roman coins can be worth a ton of money, but you can’t and won’t spend them anywhere, at least not directly.

Note: I have about $15 worth of Bitcoin (mainly from loyalty programs), and have both mined and traded Bitcoin years ago.

Overclocking The HP Touchpad For Cryptocurrency

I mention in my September 9th post that I was able to get a Bitcoin/Litecoin mining daemon (cpuminer) running scrypt calculations on the HP Touchpad.

Because a device like that is one of the worst possible things you could use to generate cryptocurrency, I’ve left it running as a dedicated Litecoin mining machine since then. It’s generated nearly a quarter of a cent worth of imaginary money in the past week.

This is a Touchpad with the stock kernel at 1.2 GHz:

[2013-09-09 01:37:27] thread 0: 43849 hashes, 0.74 khash/s
[2013-09-09 01:37:46] thread 1: 46406 hashes, 0.77 khash/s
[2013-09-09 01:38:28] thread 0: 44242 hashes, 0.74 khash/s
[2013-09-09 01:38:46] thread 1: 46395 hashes, 0.77 khash/s
[2013-09-09 01:41:33] thread 1: 23011 hashes, 0.38 khash/s
[2013-09-09 01:41:39] thread 0: 25365 hashes, 0.38 khash/s

The drop to half rate is because the CPU is throttled to half speed when the device goes idle. I’ve heard that you can overclock a Touchpad, but have never looked into it because it’s been fast enough for me.

Here’s a blog post that details how to tweak your Touchpad for performance:

http://jasonnash.com/2011/09/05/tweaking-that-new-hp-touchpad-you-just-got/

This is the Touchpad with the stock webOS Internals “uberkernel” (no settings changed):

[2013-09-09 03:23:58] thread 0: 13388 hashes, 0.30 khash/s
[2013-09-09 03:23:58] thread 1: 13363 hashes, 0.30 khash/s
[2013-09-09 03:25:27] thread 1: 18193 hashes, 0.20 khash/s
[2013-09-09 03:25:27] thread 0: 18232 hashes, 0.20 khash/s
[2013-09-09 03:26:00] thread 1: 12187 hashes, 0.37 khash/s
[2013-09-09 03:26:00] thread 0: 12208 hashes, 0.37 khash/s

That’s worrisome, shouldn’t it be faster? It seems that the stock install optimizes for power savings rather than speed.

With the UberKernel set to OnDemandTcl 1512 (1.512 GHz):

[2013-09-09 03:31:22] thread 1: 57473 hashes, 0.95 khash/s
[2013-09-09 03:31:23] thread 0: 50465 hashes, 0.87 khash/s
[2013-09-09 03:32:20] thread 1: 56374 hashes, 0.98 khash/s
[2013-09-09 03:32:20] thread 0: 51996 hashes, 0.91 khash/s

That’s right, 1.8 khash per second! Blazing fast! You may also notice that it’s bursting as high as 0.98 khash per core…

OK, here goes. I’m probably going to melt my pad, but 1 khash per CPU is within my reach. Could you imagine a 2 khash tablet? Dang, that’d be nosebleed-worthy.

[2013-09-09 03:45:44] thread 1: 67142 hashes, 1.11 khash/s
[2013-09-09 03:46:42] thread 0: 62675 hashes, 1.06 khash/s
[2013-09-09 03:46:43] thread 1: 66417 hashes, 1.11 khash/s
[2013-09-09 03:47:17] thread 0: 37319 hashes, 1.06 khash/s
[2013-09-09 03:47:17] accepted: 2/2 (100.00%), 2.17 khash/s (yay!!!)

Yay indeed. I did it! A kilohash per core per second! 2150 hashes! Victory!

I also tried mining Bitcoin with cpuminer on the HP Touchpad using SHA256 calculations, and the power was considerable there, too:

[2013-09-10 01:20:15] thread 0: 40506764 hashes, 762.24 khash/s
[2013-09-10 01:20:16] thread 1: 47714636 hashes, 789.13 khash/s
[2013-09-10 01:20:58] thread 1: 33848421 hashes, 800.30 khash/s
[2013-09-10 01:20:58] thread 0: 32404380 hashes, 759.41 khash/s

That’s right, more than a three quarters of a megahash! That’s a BTC generating /machine/.

I don’t think this is something I should try to sustain, though. The CPU made it as high as 32 degrees C, in a room that was 24 degrees C at the time.

I’m going to be rich! Wait, you mean I only earned a thousandth of a cent during this experiment? Oh well, there goes my dream of a Touchpad mining farm…. creating a penny worth of imaginary money for each dollar of electricity is something you probably can’t make up on volume.

Parallel Programming and Cryptocurrencies

Lately I’ve been spending a lot of brain cycles learning parallel programming tools and APIs. These are tools that let you write code to run on your video card (GPU) and/or multiple CPU cores at once. I’ve learned the basics of NVIDIA CUDA, OpenCL, OpenMP, and C++ AMP over the past few weeks. They’re neat things to know, but I’m not really sure what I’d use them for since most of the applications are scientific computing and math-intensive things and that’s not something I’ve ever really focused on.

One of the most useless things that GPUs are used for is mining bitcoins and litecoins. They’re a virtual currency that is created by using math to turn lots of electricity into coins that are worth anywhere from slightly less to a lot less than you paid for the electricity. This imaginary currency will gradually disappear as governments obliterate the exchanges that you can trade them on. They’re doing that because alternative currencies are a threat to them – they’re hard to tax, easy to launder, and undermine the authority of a central bank. These are all generally good things unless you’re a government. Bitcoins and litecoin wallets and exchanges are also frequently hacked/robbed, but nobody knows yet whether those thieving hackers are government-sponsored.

Now that I’ve made it clear that cryptocurrencies are dumb, one thing they are great for is exploring and learning about the capabilities of different hardware and parallel computing APIs. There are plenty of open source mining programs that use CUDA, OpenCL, or CPU-based hash calculations, and you can run a miner on almost anything. If you want to waste electricity, you’ve got options.

I have a wide range of hardware at home and have benchmarked quite a few things. Here are the speeds of various bits of hardware in Litecoin kilohashes per second:

460 hashes/sec – Asus EEE 701 PC with 630 MHz single-core Celeron processor.
1500 hashes/sec – HP Touchpad Tablet with 1.2 GHz dual-core ARM processor.
6200 hashes/sec – Compaq laptop with Core 2 Duo T8100 processor.
13650 hashes/sec – NVIDIA Geforce GT 610 512MB PCI video card.
27400 hashes/sec – NVIDIA Geforce GT 650M 2GB laptop video card.
37000 hashes/sec – AMD Phenom II 1100T six-core processor.
41000 hashes/sec – MSI laptop with i7-3920XM quad-core processor.
52000 hashes/sec – NVIDIA Geforce 640 1GB PCI-E video card.
NULL hashes/sec – ATI Radeon HD 6870 1GB PCI-E video card.

I don’t have much ATI graphics hardware, and for good reason, because one thing is still true – there is *ALWAYS* something broken in their drivers, and in the case of my 6870, OpenCL doesn’t work right on it, so it’s pretty much a brick for this experiment.

The most interesting bit was getting a litecoin miner running on my HP Touchpad. There is a miner daemon called “Pooler’s CPUMiner” that can be compiled for ARM. It almost compiled with the TouchPad SDK, but it required some adjustments to library settings and compile flags to get it to work. After a bit of tinkering I got it to run on the device at a blistering 1510 hashes per second. When the device’s screen is off the CPU runs at half speed, so with the screen off it gets 760 hashes per second. Because I know the masses will be clamoring for a TouchPad binary, I’ve posted it on Github: https://github.com/Xangis/cpuminer

This was an interesting experiment and I’ve managed to generate nearly 10 cents in imaginary money. It only took just over $1 of electricity to get there.