Category Archives: Javascript

Monero Mining Ban or How to Ban yourself from Google

I’m back

I haven’t posted in a while. Mainly because I was really busy with my morning job, and a lot of other stuff in the between. For all of you who actually kept in line with my blog I would have to say I have done a lot the past 3 years, career-wise.

This post is going to be mainly for talking about Crypto Currency mining, and the related technology.

Fintech

I have worked a lot in the Finance Tech Sector, even before it was the hot word. Unfortunately I didn’t have enough time to actually delve into the Crypto Finance part, only up until recently.

I decided I should have a look at the technological / mining part of a Crypto Currency.

Of course since I am primarily an engineer and not a coder, I decided that the mining must be done in a distributed way and not in a dedicated way most people without any specific technical background do… And that was the issue unfortunately.

Monero JS Mining

 

Even though my current morning job doesn’t include a lot of JavaScript (or ECMAScript as they renamed it nowadays), I still have some juice left in me. So since JS rules the world language-wise, the logical approach would be a JS miner. There is only one js-miner.  And also a nicely laid-out service is  Coin-Hive (I’m not linking the site as it will be marked as a malware, more on that later). The crypto currency is Monero (XMR), and it is mainly developed for mining using a CPU and not any specific ASIC just as Bitcoin or Ethereum are. Which also makes it more profitable in my opinion to mine right now, without actually having a monster like computer, which is needed to mine all the other currencies…

Profitablility

Ok, lets face it mining using others pc’s is not that profitable.
Having something like 30-40 visits per day on your website with an average stay of 1-2 mins could probably give out something like 10 cents per day, with roughly 1M hashes.

So it turns out that a lot of people had the same idea as me (a few months back) by using the browser’s V8 to run mining software.

Unfortunately users do not appreciate this. They do not appreciate ads, but also not their CPU spiking up a bit as they like to browse a site they might benefit from.

Frankly, I find this offensive. Especially from google’s part since I managed to set up a distributed miner. I distributed it’s source code (based on a flavour of CryptoNight algorithm) and mining software between some of my sites, using my github account to host the files for the miner, and a few other freeware sites for proxying the traffic for the mining pool.

The Monero Mining Ban

My github account was banned. Also my sites as well. Google thought that all my sites have been hacked and that they were infected with a malware.

Google sent me a lot of e-mails that my sites were infected, and that I should clean them. Apparently it is illegal to serve these assets even if you specifically ask permission from the users (or just simply notify them for this). So, users don’t like ads, since they are using an adblocker, and they don’t like also using their CPU for mining. OK, I get it. We just have to pay for domains and servers for ourselves, for the code and the brain power we burnt to create the content, and just give this away for nothing. Nice. Even though if I somehow have a guy who still owes me a lot of money for a website I helped him create and I don’t want to put him out of business by just closing it down.

Should you need any more info let me know to help you if you want to setup your own JS mining rig.

PS. I have started working on another big open source project which is really nice, you will hear from me again.

One Liners and Overengineering

Sometimes being a developer is hard work

And that is because you have to study and understand the code other people write. Now, this has many aspects in terms of understanding. There are many people who write code. Some of them are good at it, some are not. It all comes down to two categories in my opinion.

“I’m bored of this thing” people

These people  write code just enough to finish the feature. Not very descriptive code, just enough to get the job done, nothing more. Their variables are often misunderstood, they do not have the proper names or sometimes they have a twofold meaning. Something like:

$thisVariableMightContainAStringOrATraitedSuperObject

Their code structure nonetheless is pretty much the same like :

function addOrSubtract ($addOrSubtract, $firstOperand, $secondOperand)
{

if ($addOrSubtract == '+') {

  return $firstOperand + $secondOperand;

else {

  return $firstOperand - $secondOperand;

}

Their tests also are somehow like the above example. They tend to irrationally use the same structure, using the “feature” of loosely typed languages.

One Liners

Now these people I love. They are trying to do the same thing with the above people, only, they delve into it. They are bored also at first, but when they see that their code can be optimized, they are “one-lining-em”. They do not use the wrongly inferred type as the above people, and their code is “a mystery” yet “it gets the thing done” in one line. Supreme elegance in my opinion.

example :

[].forEach.call($$("*"),function(a){
a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)
})

Now these One Liners are writing the best optimized code.

The above line was taken from this guy’s blog who explains the exact function of what it does. It is amazing how much you can learn by just one line of code.

What it does is to apply a single pixel outline to all the elements of a page, randomized with a different color. Simply paste the above line in your browser’s console and see what happens. The purpose of this line is to debug your css layout in the page.

If you have a look at the above page you will see that this line is taken from a simple gist and there are a lot of people who are suggesting revisions on how to write that single line.

I will conclude by saying that programming

is something that is quite complex at times. People who do it for a long period, tend to do the above things in order to “escape” the routine of writing plain code. Over-engineering and trying different things (in all the acceptable frameworks of programming, like optimization, maintainability, debug free code) is something that is being constantly done, to keep oneself from doing something different even if one does not have the capability of doing so.

What I mean is that, after you have seen all the technologies, you have used all the “regular path” ways of a construct, you are always trying to do something in a different – peculiar way so as to “escape” the straight-forward, more “boring”, more “effort consuming” way.

And believe me, I have seen this from many, many people that are indeed very good engineers.

After all, Lazy people make the best inventors…
Doing a thing as simple as touching one's left ear, could prove quite complex...
Doing a thing as simple as touching one’s left ear, could prove quite complex…

Anger! Unlimited, Unmetered ANGERRRR!

Developer Anger!

Developers often face situations where logic bends. Now this happens quite a few times. Suppose we have an equation with factors that the outcome of this equation is the “bending logic”.

The first factor, and larger at times is the client input. “Yes, we know we asked for that, but now things have changed, so we have to change it” , “What? I did not ask for a red line drawn with a blue pen!” and so on. More on that at The Expert.

The second factor is the programming language we are using. And that is the point were we stand for now.  Third and fourth factors is experience and capability but those are irrelevant on each person so, we wont be discussing them now.

ANGER. WRITING CODE THAT SEEMS TO WORK.

Quite recently I stumbled upon this interesting site :

http://www.commitlogsfromlastnight.com/

Turns out that this guy: @abestanway is parsing repos from github and records each curse in the commit log message. A commit log message is a message we developers use when we are completing a project/code snippet/change/bug in the code of a system we are using.

This guy, took it to another step also. He gathered data and created a presentation, showing the languages with the most curses. He even created graphs of the most cursed and least cursed language:

Curses / Language
Curses / Language

As you can see, Javascript is the first. Undoubtedly this language is the most widely used, so it makes sense for it to have the most curses (and yeah many other stuff you already know like changeling scopes and other Javascript shitty stuff).

He also created graphs with the most used curses:

See that Fuck prevails all!!
See that Fuck prevails all!!

Next, he compared the Most Cursed languages with the most used languages in Github. You can have a look at all the above from the relevant video :

Therefore :

ANGERRRRRRRRRRRR
UNLIMITED ANGERRRRR!

To conclude he points out that the more the curses, the better the code…