Bitcoin Forum
April 18, 2014, 02:18:47 PM *
News: Due to the OpenSSL heartbleed bug, changing your forum password is recommended.
 
   Home   Help Search Donate Login Register  
Pages: [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
  Print  
Author Topic: New demonstration CPU miner available  (Read 304915 times)
jgarzik
Staff
Hero Member
*****
Offline Offline

Activity: 1260


View Profile

Ignore
November 25, 2010, 12:45:23 AM
 #1

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.  See cgminer's official forum thread for updates and details.


Jeff Garzik, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
1397830727
Hero Member
*
Offline Offline

Posts: 1397830727

View Profile Personal Message (Offline)

Ignore
1397830727
Reply with quote  #2

1397830727
Report to moderator
1397830727
Hero Member
*
Offline Offline

Posts: 1397830727

View Profile Personal Message (Offline)

Ignore
1397830727
Reply with quote  #2

1397830727
Report to moderator
1397830727
Hero Member
*
Offline Offline

Posts: 1397830727

View Profile Personal Message (Offline)

Ignore
1397830727
Reply with quote  #2

1397830727
Report to moderator
GAWMiners.com - FREE Hosting & Electricity for 1 Year!
Exclusive Offer Code: GAWHOST1
Mining Made Easy
For Everyone

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1397830727
Hero Member
*
Offline Offline

Posts: 1397830727

View Profile Personal Message (Offline)

Ignore
1397830727
Reply with quote  #2

1397830727
Report to moderator
slush
Hero Member
*****
Offline Offline

Activity: 1078



View Profile WWW

Ignore
November 25, 2010, 02:14:17 AM
 #2

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.

sturle
Hero Member
*****
Offline Offline

Activity: 1064

http://bitmynt.no


View Profile WWW

Ignore
November 25, 2010, 01:28:45 PM
 #3

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?

Sjå http://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.pl
wumpus
Hero Member
*****
Offline Offline

Activity: 630

No Maps for These Territories


View Profile

Ignore
November 25, 2010, 01:34:05 PM
 #4

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

Bitcoin Core developer [PGP]  Tips: 1L125pF2e7himW43Qu752ZFLtBLicxQmng Warning: For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through FileBackup Wallet to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
slush
Hero Member
*****
Offline Offline

Activity: 1078



View Profile WWW

Ignore
November 25, 2010, 02:53:20 PM
 #5

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
Hero Member
*****
Offline Offline

Activity: 630

No Maps for These Territories


View Profile

Ignore
November 25, 2010, 02:59:26 PM
 #6

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]  Tips: 1L125pF2e7himW43Qu752ZFLtBLicxQmng Warning: For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through FileBackup Wallet to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
slush
Hero Member
*****
Offline Offline

Activity: 1078



View Profile WWW

Ignore
November 25, 2010, 04:47:30 PM
 #7

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.

bugmenot
Newbie
*
Offline Offline

Activity: 1


View Profile

Ignore
November 26, 2010, 12:08:00 PM
 #8

Nice 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.
teknohog
Sr. Member
****
Offline Offline

Activity: 272



View Profile WWW

Ignore
November 26, 2010, 01:41:39 PM
 #9

Should I use a particular version of jansson? I installed it from git, and get the following compile error:

Code:
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

So Lazy, Obviously True Hodler Sf67i4Xeqkn7mMcJ2nNT7uPUZXnoeqWfZh
jgarzik
Staff
Hero Member
*****
Offline Offline

Activity: 1260


View Profile

Ignore
November 26, 2010, 06:10:29 PM
 #10

Nice 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

Jeff Garzik, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
jgarzik
Staff
Hero Member
*****
Offline Offline

Activity: 1260


View Profile

Ignore
November 26, 2010, 07:47:02 PM
 #11

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, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
jgarzik
Staff
Hero Member
*****
Offline Offline

Activity: 1260


View Profile

Ignore
November 26, 2010, 09:32:51 PM
 #12

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, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
jgarzik
Staff
Hero Member
*****
Offline Offline

Activity: 1260


View Profile

Ignore
November 26, 2010, 09:45:54 PM
 #13

Should I use a particular version of jansson? I installed it from git, and get the following compile error:

Code:
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, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
satoshi
Founder
Sr. Member
*
Offline Offline

Activity: 364


View Profile

Ignore
November 26, 2010, 10:02:41 PM
 #14

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
Staff
Hero Member
*****
Offline Offline

Activity: 1260


View Profile

Ignore
November 26, 2010, 11:03:51 PM
 #15

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, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
BitLex
Staff
Hero Member
*****
Offline Offline

Activity: 868


View Profile WWW

Ignore
November 26, 2010, 11:27:55 PM
 #16

Quote
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
Staff
Hero Member
*****
Offline Offline

Activity: 1260


View Profile

Ignore
November 27, 2010, 12:06:59 AM
 #17

Quote
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, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
slush
Hero Member
*****
Offline Offline

Activity: 1078



View Profile WWW

Ignore
November 27, 2010, 12:08:44 AM
 #18

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
Staff
Hero Member
*****
Offline Offline

Activity: 1260


View Profile

Ignore
November 27, 2010, 12:09:30 AM
 #19

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

Code:
$ minerd --algo=4way

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, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
jgarzik
Staff
Hero Member
*****
Offline Offline

Activity: 1260


View Profile

Ignore
November 27, 2010, 12:11:18 AM
 #20

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  Sad   Will investigate (though probably tomorrow).

Jeff Garzik, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
Pages: [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!