jgarzik (OP)
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
November 25, 2010, 12:45:23 AM Last edit: July 13, 2011, 03:18:15 AM by jgarzik |
|
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.gzWindows installer: http://yyz.us/bitcoin/cpuminer-installer-1.0.2.zipgit repository: git://github.com/jgarzik/cpuminer.git Contributions welcomed! (GPL v2 license) UPDATE: This has largely been superceded by Con Kolivas's cgminer fork. See cgminer's official forum thread for updates and details.
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
slush
Legendary
Offline
Activity: 1386
Merit: 1097
|
|
November 25, 2010, 02:14:17 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 .
|
|
|
|
sturle
Legendary
Offline
Activity: 1437
Merit: 1002
https://bitmynt.no
|
|
November 25, 2010, 01:28:45 PM |
|
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 . 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?
|
Sjå https://bitmynt.no for veksling av bitcoin mot norske kroner. Trygt, billig, raskt og enkelt sidan 2010. I buy with EUR and other currencies at a fair market price when you want to sell. See http://bitmynt.no/eurprice.plWarning: "Bitcoin" XT, Classic, Unlimited and the likes are scams. Don't use them, and don't listen to their shills.
|
|
|
wumpus
|
|
November 25, 2010, 01:34:05 PM |
|
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
|
Bitcoin Core developer [PGP] Warning: For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through File → Backup Wallet to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
|
|
|
slush
Legendary
Offline
Activity: 1386
Merit: 1097
|
|
November 25, 2010, 02:53:20 PM |
|
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?
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.
|
|
|
|
wumpus
|
|
November 25, 2010, 02:59:26 PM |
|
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 believe that IE has cryptographic extensions that you can use from javascript. Maybe that will speed it up?
|
Bitcoin Core developer [PGP] Warning: For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through File → Backup Wallet to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
|
|
|
slush
Legendary
Offline
Activity: 1386
Merit: 1097
|
|
November 25, 2010, 04:47:30 PM |
|
I 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.
|
|
|
|
teknohog
|
|
November 26, 2010, 01:41:39 PM |
|
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 here
|
|
|
|
jgarzik (OP)
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
November 26, 2010, 06:10:29 PM |
|
Nice work. But : 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
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
jgarzik (OP)
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
November 26, 2010, 07:47:02 PM |
|
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.
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
jgarzik (OP)
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
November 26, 2010, 09:32:51 PM |
|
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
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
jgarzik (OP)
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
November 26, 2010, 09:45:54 PM Last edit: November 26, 2010, 10:33:31 PM by jgarzik |
|
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 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.
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
satoshi
Founder
Sr. Member
Offline
Activity: 364
Merit: 7248
|
|
November 26, 2010, 10:02:41 PM |
|
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.
|
|
|
|
jgarzik (OP)
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
November 26, 2010, 11:03:51 PM |
|
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++.
I'll take a look. VIA Padlock support may also be similarly easy to integrate.
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
BitLex
|
|
November 26, 2010, 11:27:55 PM |
|
I'd be interested to see how well this works on Vista, XP, 7, ... complaining about "libcurl-4.dll missing" (although it's there at c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\) it won't even start on 64bit XP&7, 32bit XP, am i missing something?
|
|
|
|
jgarzik (OP)
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
November 27, 2010, 12:06:59 AM |
|
I'd be interested to see how well this works on Vista, XP, 7, ... complaining about "libcurl-4.dll missing" (although it's there at c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\) it won't even start on 64bit XP&7, 32bit XP, am i missing something? Try adding c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\ to your PATH, then run minerd.exe?
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
slush
Legendary
Offline
Activity: 1386
Merit: 1097
|
|
November 27, 2010, 12:08:44 AM |
|
complaining about "libcurl-4.dll missing" (although it's there at c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\) it won't even start on 64bit XP&7, 32bit XP, am i missing something?
Same here (WinXP)
|
|
|
|
jgarzik (OP)
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
November 27, 2010, 12:09:30 AM |
|
You should try it with tcatm's 4-way SSE2 SHA in sha256.cpp.
Added. Users may select this by enabling SSE2 instructions in their compiler during build, and then will select the 4way implementation, rather than the default 'c' implementation. Run "minerd --help" to make sure 4way is listed as an available option first; if not, you did not build with SSE2 enabled (-msse2, or many values of -march=xxx).
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
jgarzik (OP)
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
November 27, 2010, 12:11:18 AM |
|
complaining about "libcurl-4.dll missing" (although it's there at c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\) it won't even start on 64bit XP&7, 32bit XP, am i missing something?
Same here (WinXP) Clearly my installer-maker is having a problem Will investigate (though probably tomorrow).
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
jgarzik (OP)
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
November 27, 2010, 12:32:04 AM Last edit: November 27, 2010, 12:47:09 AM by jgarzik |
|
I'd be interested to see how well this works on Vista, XP, 7, ... complaining about "libcurl-4.dll missing" (although it's there at c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\) it won't even start on 64bit XP&7, 32bit XP, am i missing something? Updated the installer at http://yyz.us/bitcoin/cpuminer-installer.zipDoes the problem still exist? EDIT: Here are the checksums for the latest Windows installer zipfile... Size: 1978933 bytes SHA1: fdea8a045db5e09b7441a4059fbdba186490e742 MD5: e60dbfb7c3b458c2a98e71cb295f9b7d
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
|