A new CPU miner is now available, making use of the new 'getwork' RPC command.
In the beginning, this is intended largely to demonstrate a 'getwork' miner. It is written in straight C, with minimal dependencies (libcurl, jansson).
It has successfully generated blocks on testnet, mainnet and almost all pools.
Linux/BSD release tarball: http://yyz.us/bitcoin/cpuminer-1.0.2.tar.gz
Windows installer: http://yyz.us/bitcoin/cpuminer-installer-1.0.2.zip
git repository: git://github.com/jgarzik/cpuminer.git
Contributions welcomed! (GPL v2 license)
UPDATE: This has largely been superceded by Con Kolivas's cgminer fork <http://forum.bitcoin.org/index.php?topic=28402.0>. See cgminer's official forum thread <http://forum.bitcoin.org/index.php?topic=28402.0> for updates and details.
New demonstration CPU miner available
BitcoinTalk forum · 13 messages · from 25 November 2010 · with Satoshi Nakamoto, jgarzik, slush, sturle, teknohog, wumpus
Read in Satoshi Mail Archive source
Quote from: jgarzik on November 25, 2010, 12:45:23 AMIn the beginning, this is intended largely to demonstrate a 'getwork' miner. It is written in straight C, with minimal dependencies (libcurl, libcrypto, jansson).
Cool, I like simplicity of your code. I want to try similar implementation in javascript. Partially because of curiosity and partialy because (inspired by hashcash) it can generate few hashes by fighting comments spam :-).
I just made few tests. In four javascript threads I get ~4khash/s, which is EXTREMELY slow. Probably because javascript is interpreted and without any JIT yet. Would be great if javascript supports GPU. Flash will support GPU soon, so we will see Wink.
Quote from: slush on November 25, 2010, 02:14:17 AM> Quote from: jgarzik on November 25, 2010, 12:45:23 AM > In the beginning, this is intended largely to demonstrate a 'getwork' miner. It is written in straight C, with minimal dependencies (libcurl, libcrypto, jansson). Cool, I like simplicity of your code. I want to try similar implementation in javascript. Partially because of curiosity and partialy because (inspired by hashcash) it can generate few hashes by fighting comments spam :-). I just made few tests. In four javascript threads I get ~4khash/s, which is EXTREMELY slow. Probably because javascript is interpreted and without any JIT yet. Would be great if javascript supports GPU. Flash will support GPU soon, so we will see Wink.
Is your JavaScript code available?
I wish the getwork RPC command could be allowed for non-authenticated users from other hosts. It isn't revealing any secret information, is it?
Nice idea on the independent C miner.
On the JS one: Oh no, soon all kinds of websites will be sneakily generating bitcons on the background while you browse them, hogging your CPU even more Tongue
Quote from: sturle on November 25, 2010, 01:28:45 PMIs your JavaScript code available? I wish the getwork RPC command could be allowed for non-authenticated users from other hosts. It isn't revealing any secret information, is it?
Will be available if I finish that. It is just for curiosity because it will be slow as hell. Also network overhead will be significant.
I expect simple PHP proxy will do good work for hiding credentials to client. something like yourdomain.com/getwork.php which call rpc to localhost and return json encoded data.
Quote from: slush on November 25, 2010, 02:53:20 PMWill be available if I finish that. It is just for curiosity because it will be slow as hell. Also network overhead will be significant.
I believe that IE has cryptographic extensions that you can use from javascript. Maybe that will speed it up?
Quote from: witchspace on November 25, 2010, 02:59:26 PMI believe that IE has cryptographic extensions that you can use from javascript. Maybe that will speed it up?
Do you have any link or reference? I found only 3rd party ActiveX component here http://www.chilkatsoft.com/js-sha512-hash.asp.
Should I use a particular version of jansson? I installed it from git, and get the following compile error:
util.c: In function json_rpc_call:
util.c:133:2: warning: passing argument 2 of json_loads makes integer from pointer without a cast
/usr/local/include/jansson.h:188:9: note: expected size_t but argument is of type struct json_error_t *
util.c:133:2: error: too few arguments to function json_loads
/usr/local/include/jansson.h:188:9: note: declared hereQuote from: bugmenot on November 26, 2010, 12:08:00 PMNice work. But : > Quote > DBG: found zeroes in hash: > 6c1e0d9af9b06eab5aae7fbe058760708c1c7869870142b91b9c0ae300000000 > PROOF OF WORK FOUND? submitting... > PROOF OF WORK RESULT: false (booooo) > [...] > DBG: found zeroes in hash: > c155613cbd70edad88bf56b06cbd788329a2a741b27ee78f25abdb2e00000000 > PROOF OF WORK FOUND? submitting... > PROOF OF WORK RESULT: false (booooo) I don't know if this is a bug or not. The miner has been compiled with cygwin, I don't know if it matters.
Not a bug. The miner finds a hash with "several" zeroes in it, but then relies on bitcoin to do the full 256-bit hash < target value comparison. It's normal that some hashes will be found by the CPU miner, then rejected by bitcoin. We call those almost-solutions Smiley
FWIW, the default bitcoin miner also does this -- it just doesn't print out when it "finds some zeroes", only when a real proof of work is found.
Thus, my CPU miner always shows when it stops working on a solution, and starts working on a new solution. Just giving you a bit more information on the whole process.
Attached is a Windows executable build with mingw32. I'd be interested to know if it works.
run "minerd.exe --help" or "minerd.exe -h" to show command line options.
minerd.exe SHA-1 sum: 722fa3b956de3ed3438ed3294fe191f0d55c1514
minerd.exe MD5 sum: 9f75f8da7a5d02da1d45d46d4a032489
Quote from: teknohog on November 26, 2010, 01:41:39 PMShould I use a particular version of jansson? I installed it from git, and get the following compile error: util.c: In function json_rpc_call: util.c:133:2: warning: passing argument 2 of json_loads makes integer from pointer without a cast /usr/local/include/jansson.h:188:9: note: expected size_t but argument is of type struct json_error_t * util.c:133:2: error: too few arguments to function json_loads /usr/local/include/jansson.h:188:9: note: declared here
It's been tested with jansson 1.2 and 1.3 release versions.
EDIT: If you lack jansson, current cpuminer.git will build an in-tree version. Thus, you may opt to fix the problem by... removing jansson from your system.
You should try it with tcatm's 4-way SSE2 SHA in sha256.cpp. It compiles fine as a C file, just rename sha256.cpp to sha256.c. I was able to get it to work in simple tests on Windows, but not when linked in with Bitcoin. It may have a better chance of working as part of a C program instead of C++.
Currently it's only enabled in the Linux build, so if you get it to work you could make it available to Windows users. It's about 100% speedup on AMD CPUs.