
Bitcoin mining the hard way: the algorithms, protocols, and bytes - lelf
http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html
======
verroq
I have written a proxy pool server
([https://github.com/dogestreet/proxypool](https://github.com/dogestreet/proxypool))
in Haskell if anybody wants to check it out. It's a Stratum to Stratum
protocol proxy, it lets you create a mining pool that mines into another
mining pool.

(Disclaimer, only P2Pool upstreams work for now, I'm trying to get it to work
with stratum-mining).

~~~
verroq
Just an update, it now works for all upstreams. As long as they are not using
a buggy version of cgminer - v3.7.2

------
plg
Ironically, the most cost efficient way of acquiring BTC today may well be to
go out into the world and earn dollars (e.g. a job) and then use them to
purchase BTC from an exchange.

~~~
vertex-four
No, the most cost efficient is likely to go out into the world and earn BTC
(e.g. a job). It's just that it's a bit difficult to find people who have BTC
to pay you with at the moment.

------
durkie
one thing i've never been clear on: what happens after the last bitcoin is
mined?

it seems like if there isn't a reward of BTC for mining the block (and you're
just relying on transaction fees), then mining will become a lot less
lucrative/interesting to folks. so do lots of people then drop of out of the
mining game, and then difficulty decreases until mining is easy enough to be
worth the transaction fees? do transaction fees go up?

~~~
zwily
The reward just keeps halving, so it only approaches 0 (well, until we run out
of digits of course). And by the time that happens, transaction fees will
probably already be more valuable than the reward.

------
joveian
Thanks, I was just trying to explain bitcoint recently but didn't know enough
of the details so I'll pass that along.

I find the linked hashchain rate chart and the 1000x increase over the past
year to be really interesting when considering that bitcoin relies on 50% of
that being honest. The difference in processing power used in hashing now vs.
about a month ago would be enough to own the system a month ago.

~~~
nwh
The introduction of new hardware (~difficulty) will level off fairly soon,
we're reaching efficiency limits in what people can produce. I don't think we
are at the technical limit, just at the limit of what the current companies
involved are capable of. Eligius controls a large portion (~20%) of the
hashrate, it's somewhat reassuring that they are known to be acting in good
faith (geddit?).

~~~
yetfeo
GHash.io and BTC Guild own >50% between them though:
[http://blockorigin.pfoe.be/top.php](http://blockorigin.pfoe.be/top.php)

Eligius have some mining rules which one could regard as not acting in good
faith (rejecting gambling site transactions, etc) depending on your point of
view. This can prevent some from using them and limits their hashrate
somewhat.

If you look at the top pools list compared to 6 months ago that landscape has
changed quite a bit. The pools outside of the top 5 have less market share and
there are less pools. Mining power is slowly centralizing:
[https://web.archive.org/web/20130215040845/http://blockorigi...](https://web.archive.org/web/20130215040845/http://blockorigin.pfoe.be/top.php)

~~~
nwh
You're not wrong that there's less pools, I think it's just somewhat due to a
lot of miners not understanding how pools work. There's an unfortunate
misconception that the size of the pool impacts your income, so they gravitate
to the largest pool. Ghash.io is almost certainly evil (attacking sites by
double spending in the past), but there's not much we can do about it
unfortunately. Hopefully p2pool can eventually become larger and more
significant, then the issue goes away somewhat.

~~~
thekiwi99
Can you provide a source for Ghash.io double spending? I've not heard about
that before, and it seems unlikely.

~~~
hendzen
[https://bitcointalk.org/index.php?topic=327767.0](https://bitcointalk.org/index.php?topic=327767.0)

~~~
nwh
Critically in this thread they do acknowledge the double spends happened.

------
bamos
I don't know much about Bitcoins, but is there a large risk of tainted workers
in a pool that are reverse engineered and have knowledge of the part of the
algorithm they're helping with? Then, if they detect they mined a coin, they
disconnect from the pool, don't report the result, and take all the profit.

I couldn't find anything with a quick search, but would be interested to read
more about (client-side)? security vulnerabilities of pooled mining.

~~~
kens
I mentioned that in the article. A miner can't "steal" a block they solved for
a pool. The miners are working on a block that pays the reward to the pool. If
the miner successfully mines a block and bypasses the pool, the address in the
block is still the pool's address, so that's still where the 25 bitcoins go.
If the miner tries to change the address, the hash changes and the block is no
longer valid, so the miner can't submit the tampered block.

There is a theoretical attack where the miner throws away a successful block,
so nobody gets the reward and the pool suffers. But it's a whole lot of work
just to annoy people and this solution-witholding attack isn't viewed as a
real problem: [http://bitcoin.stackexchange.com/questions/1338/how-is-
block...](http://bitcoin.stackexchange.com/questions/1338/how-is-block-
solution-withholding-a-threat-to-mining-pools)

------
gus_massa
Previous Discussion:
[https://news.ycombinator.com/item?id=7162153](https://news.ycombinator.com/item?id=7162153)
(216 points, 22 days ago, 26 comments)

~~~
kens
That's my previous article on generating transactions manually. The current
article continues where that left off, discussing mining.

I wanted the titles to show the articles are related, but I think I've caused
confusion. If someone has a better title suggestion, please let me know.
(Genuine request, not sarcasm.)

~~~
gus_massa
Interesting article as always. No problem with the title. I just made a
mistake.

I like to have more articles with a technical discussion of the mining
process. Most people just listen to the "lottery" part of mining and don't
hear the chaining and transaction recording part. So they soon propose a new
mining algorithm that is more "usefull" or doesn't require so much energy.

