
Minting Money with Monero and CPU Vector Intrinsics - dgacmu
http://da-data.blogspot.com/2014/08/minting-money-with-monero-and-cpu.html
======
d4vlx
Love the story, reminds me of the early days of Primecoin where I had my first
exposure to cryptocurrency code. I spent the first two months of it fighting
to stay ahead of the curve as well and had a blast. Not nearly as successfully
as Dave however and my wife wasn't too happy about me spending every waking
hour when home from my full time job on it.

------
Cyther606
Much respect for profiting hand over fist from pure knowledge. But the fact
that this "opportunity" existed in the code is really damning for the Monero
project. It highlights the staggering amounts of greed and hushed fraud
rampant in the Bitcoin space. I don't fault him for selling everything.

~~~
ayrx
There is a huge difference between unoptimized code and maliciously slow code.
This case definitely falls in the second category.

~~~
oafitupa
Bytecoin falls in the scam, yes. But the Monero community fixed this quite
fast.

------
tromp
New proof-of-work schemes in crypto-currencies should ideally have optimized
implementations from day 0, to prevent the situation described in the article
where some people can mine much more efficiently than others.

To this end, I offer several bounties for my Cuckoo Cycle proof-of-work
scheme, which David has helped refine, and which has yet to be deployed by any
coin.

See [https://github.com/tromp/cuckoo](https://github.com/tromp/cuckoo) for
details and a whitepaper.

------
gwern
I remember when Bytecoin was released; the claims to have been used for years
were clearly wrong, but I couldn't figure out what the real story was skimming
the forum posts. I'm glad someone figured it out!

~~~
d4vlx
Premining and instamining (where they just start the coin with x coins in the
devs wallet) are fairly common practices among new cryptocoins. They are
usually frowned upon by the community but not always as the coin developers
will sometimes keep a 1-2% for use promoting and developing the coin. Which
most people consider fair. An 80% premine like bytecoin is ridiculous.

It is very easy to tell if a coin has been premined by checking the state of
the block chain for the number of outstanding coins. The coins with large
premines are usually outed withing an hour of their release.

~~~
gwern
I realize that, which is why I didn't believe the Bytecoin claims to have been
used for years. (That and I spend a lot of time on Tor so I was skeptical
I'd've never heard of it if there really was an active community using it.)
But that didn't explain where the huge apparently-PoW-intensive blockchain
came from.

------
jnbiche
Any suggestions/resources on learning how to implement these kinds of
optimizations?

~~~
nkurz
Agner Fog's guides and the Intel reference documents are the best resources
that I've found:

[http://www.agner.org/optimize/](http://www.agner.org/optimize/)

[http://www.intel.com/content/www/us/en/processors/architectu...](http://www.intel.com/content/www/us/en/processors/architectures-
software-developer-manuals.html)

IACA, perf, pmu-tools, and likwid are very useful tools.

[https://software.intel.com/en-us/articles/intel-
architecture...](https://software.intel.com/en-us/articles/intel-architecture-
code-analyzer)

[https://perf.wiki.kernel.org/index.php/Main_Page](https://perf.wiki.kernel.org/index.php/Main_Page)

[https://github.com/andikleen/pmu-tools](https://github.com/andikleen/pmu-
tools)

[https://code.google.com/p/likwid/](https://code.google.com/p/likwid/)

~~~
dgacmu
In addition to that great list, see also "Hacker's Delight", and several of
Jon Bentley's books (Programming Pearls, Writing Efficient Programs, etc.).
They're dated, but the basic ideas are eternal. The application to x86
requires combining those ideas with the specifics you get from Agner Fog's
references.

~~~
nkurz
On sitkack's recommendation (see my comment history) I'm currently reading
through Rick Booth's "Inner Loops". It's another dated classic that may be
useful when used in combination with other more modern resources. Some of
Booth's explanations micro-ops and superscalar dispatch are great, although it
would be difficult for a beginner to differentiate what still applies today
from what doesn't.

------
MichaelGG
What is the incentive for the open source developers to release such fast
miners? Dave says that one guy could beat him and "everyone" would be running
his code. Why wouldn't the other guy run his privately, thus effectively
splitting the money with other smart folks? You can always release it later to
get the fame and ego points for being brilliant.

~~~
dgacmu
Style difference? yvg makes money from a built-in 1-2% dev fee on his (binary)
miners. They are fast, support many pools and protocols, and are robust enough
that you can pretty much start them running in /etc/rc.local and trust that
they'll still be running a month later. I don't know what his total crypto
income is, but I suspect he's doing OK. In contrast, you'd cringe at the
horrible code I cranked out for some of these miners. Quality, high-
performance, and delivered fast: pick two. It wouldn't surprise me if his
business model was, in the long term, more profitable. He argues that it is. I
haven't wanted to lock myself into providing support for software long term,
so I picked a very different model.

I believe, though, that there's a mix of both in many situations. I think some
of the miner devs release some code openly as an advertisement for their
skills and then do some contract work. The shady ones probably have
opportunities to collaborate with coin developers to pre-develop a secret GPU
miner for a "CPU only" coin so that the devs can instamine it. There's at
least one I know of who's customized his code and sold it to a botnet herder.

I love the question someone raised earlier: If someone can get a huge
advantage that "kills" the coin, it's a flaw in the coin design. Is there a
way to have the coin dynamics incentivize developers to make fast code _and
release it_? That's one to chew on...

