Can you help with Bitcoin block hashing algorithm ( PHP, C, Python, Javascript)?

0

can you help with Bitcoin block hashing algorithm ( PHP, C, Python, Javascript) ?

I was working really hard to write block hashing algorithm in plain Javascript. Unfortunately the developed Javascript code is not generating the correct hash.

Yesterday installed Python for Windows XP 32 and run Python hashing code from https://en.bitcoin.it/wiki/Block_hashing_algorithm

and run code to get the correct hash.

Python is very slow so I plan to test block hashing algorithm in C http://pastebin.com/bW3fQA2a

in PHP and modify my Javascript code to generate the correct hash.

Next step is to download hashed blocks from Blockchain via getJason API to verify every nonce generated for the blocks hashed in the past.

Can you help or join me ?

user3198957

Posted 2014-02-04T14:37:34.490

Reputation: 1

Question was closed 2014-02-06T16:45:23.623

2Can you show us your really hard working implementation in JS? If you really worked (not just googled for 10 minutes, copied and tried to run it), you have an idea how to debug your script. In this case you can narrow it and ask a normal question on SO. Also if Python is very slow (how slow is it? slow, very slow, terribly slow are not really good metrics to describe the speed of a program) why do you think PHP and JS would be faster/much faster/incredibly fast?Salvador Dali 2014-02-05T00:17:23.627

Answers

1

for a sample Bitcoin hashing in JS you could have a look at this: https://github.com/KaSt/Jilaku It's a repo I first forked and then modified to have a "web miner" on top of GAE. I started the thing as a toy and then dropped the idea... Because...

Well, before the "because", I still don't know your actual purpose. In case it's to experiment and learn the basics of how a miner works... Then any language will do.

In case your aim is to produce a fully functional and efficient miner, then I'll continue with the "because".

I dropped the idea of developing a Javascript miner because there is no way that any interpreted code can be as fast as modern ways of mining, which include ASIC chips and the lot. Your computer will be running for ages, might find a good hash but by the time it found it, other miners might be 10 blocks ahead. That Javascript miner achieves a few thousands hashes per second. A single ASIC USB thingy will achieve 300 million hashes per second.

In case your aim is actually to experiment, then that JS piece of code could be of help.

Have fun!

Kappa

Posted 2014-02-04T14:37:34.490

Reputation: 21

0

Thanks. emailed progranism - no response Tested every plain Javacsript miner claimed to work, none worked for me.

" Download the full source code. You need a Google App Engine application defined and ready for code to be uploaded. Modify the app.yaml according to your application name, rename or copy config.py.sample to config.py and modify it to use your pool credentials. Open the "ninja" w.html page in your app path and you're off to mine! "

I don't need Google App Engine for my block hashing algorithm in plain JS. Now I need to run getJSON to get block headers from blockchain.info via API (failed to work, since I don't run web server).

You are exactly right. Block hashing in plain JS is exactly for edu purposes ( off-line mode), to verify blocks hashed in the past and learn more about Bitcoin mining.

Never seen ByteSwap, binarystring2hexstring , hexstring2binary string, littleEndian implemented in plain Javascript to work for me.

Just test any JS code from any website, claimed to work.

user3198957

Posted 2014-02-04T14:37:34.490

Reputation: 1