<p>for a sample Bitcoin hashing in JS you could have a look at this:
<a href="https://github.com/KaSt/Jilaku" rel="nofollow">https://github.com/KaSt/Jilaku</a>
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...</p>

<p>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.</p>

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

<p>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. </p>

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

<p>Have fun!</p>

CC BY-SA 3.0
2014-02-05T22:44:35.017Z
2014-02-05T22:44:35.017Z
Kappa
<p>Thanks.
emailed progranism - no response
Tested every plain Javacsript miner claimed to work,
none worked for me.</p>

<p>"
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!
" </p>

<p>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).</p>

<p>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.</p>

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

<p>Just test any JS code from any website, claimed to work.</p>

CC BY-SA 3.0
2014-02-06T13:59:18.687Z
2014-02-06T13:59:18.687Z
user3198957
<p>can you help with Bitcoin block hashing algorithm ( PHP, C, Python, Javascript) ?</p>

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

<p>Yesterday installed Python for Windows XP 32 and run Python hashing code
from
<a href="https://en.bitcoin.it/wiki/Block_hashing_algorithm" rel="nofollow">https://en.bitcoin.it/wiki/Block_hashing_algorithm</a></p>

<p>and run code to get the correct hash.</p>

<p>Python is very slow so I plan to test block hashing algorithm in C 
<a href="http://pastebin.com/bW3fQA2a" rel="nofollow">http://pastebin.com/bW3fQA2a</a></p>

<p>in PHP and modify my Javascript code to generate the correct hash.</p>

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

<p>Can you help or join me ?</p>

CC BY-SA 3.0
2014-02-05T00:17:23.627Z
Can 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
<blockchain><block><hash>
Can you help with Bitcoin block hashing algorithm ( PHP, C, Python, Javascript)?
user3198957
# Can you help with Bitcoin block hashing algorithm ( PHP, C, Python, Javascript)?

(Asked by: username_0 on 2014-02-04)

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 ?

**Tags:** blockchain, block, hash

> **Comments:**
> **username_1**: Can 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?  

---

## 2 answers

### Answer by username_2 on 2014-02-05. Score: 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!


---

### Answer by username_0 on 2014-02-06. Score: 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.


---

