Bitcoin Forum

Other => Beginners & Help => Topic started by: darius2020 on January 14, 2014, 04:30:07 PM



Title: Block hashing in Javascript - Could you help me with implementation ?
Post by: darius2020 on January 14, 2014, 04:30:07 PM
Hi,

Block hashing in Javascript  - Could you help me with implementation ?

I am looking for block hashing in Javascript demo, reading input parameters from Blockchain ( 6 parameters)
saved to database and run off-line, as demo for students to verify the calculated nonces were correct from the first block.

Looking for hashing algorithm ( sha256 in Javascript already works fine)
and 6 input parameters as datafile.

Any idea ?


Title: Re: Block hashing in Javascript - Could you help me with implementation ?
Post by: darius2020 on January 15, 2014, 03:37:08 PM
I am testing Block hashing algorithm from

https://en.bitcoin.it/wiki/Block_hashing_algorithm (https://en.bitcoin.it/wiki/Block_hashing_algorithm)

code in Python and PHP + sha256 library

+ code in plain C from
http://pastebin.com/bW3fQA2a (http://pastebin.com/bW3fQA2a)

unfortunately block header parameters from
http://blockexplorer.com/block/00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d (http://blockexplorer.com/block/00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d)

don't come in sha256 hashing format

since I need Unix time conversion for >>>  Time?: 2011-05-21 17:26:31

http://blockchain.info/en/block-index/458660/00000000000000000fcea0d175785506f4681dc94d1fcf50deeda8082caf1543 (http://blockchain.info/en/block-index/458660/00000000000000000fcea0d175785506f4681dc94d1fcf50deeda8082caf1543)

the same problem with time parameter.
Any idea how to download block headers file
as 6 parameter input into my block hashing algorithm in Javascript ?