1

I read that i have to hash 3 things(previous block's header, nonce, current block contents) using the sha 256 algorithm to get a hash that has required number of zeros at the start, in order to add my block to the blockchain.

where are the specifications for combining to form a block?

I have a sha 256 program that can perform a hash. I need to know 1. where to get the latest block? 2. what parts of the latest block to use? 3. where to get the latest transactions? 4. what parts of the latest transactions are to be put in a block? etc

there must be specifications for these. can anyone please tell me where to find it?

Thanks much, ms

1

You'll need to hash the block header, which is actually made up of 6 items: the version bit, the hash of the previous block, the merkle root of transactions you're including in your block, a timestamp, a target difficulty, and a nonce value. This page on the bitcoin wiki contains more info, I think you'll find it helpful.

  • Also, it is possible to retrieve much of the data required from Bitcoin Core's 'getblocktemplate' command. See BIP-22 – Matthew Charles Stannard Jan 4 '18 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.