Bitcoin Forum
June 20, 2024, 09:18:45 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Mining support / Re: bitcoin-cli submitblock template on: January 06, 2023, 10:00:02 PM
Answer to 1.
The block header is being hashed and consists of six variables: [ 0]

Version + hashPrevBlock + hashMerkleRoot + Time + Bits + Nonce

Answer to 2.
The getblocktemplate method returns the proper template for the blocksubmit method. The getblocktemplate documentation is available in the Bitcoin Core Docs. [ 1] To get a block template, run bitcoin-cli getblocktemplate.


[ 0] https://en.bitcoin.it/wiki/Block_hashing_algorithm

[ 1] https://bitcoincore.org/en/doc/0.16.0/rpc/mining/getblocktemplate/
2  Bitcoin / Mining support / bitcoin-cli submitblock template on: January 06, 2023, 06:16:47 PM
Thank you in advance for your time in reading. I am working on developing a template for the bitcoin-cli submitblock [1] method. I have posted Issue #26830 on the Bitcoin Core GitHub [2]. Issue #26830 provides a detailed overview of all available information relating to the proper form for block hashing and submission for validation. However, there are still two keystone questions I have to be able to get started:

1. What, exactly, is being hashed?
2. What, exactly, is the required format for submissions?

As far as I can tell, block hashing requires hashing six variables, Version + hashPrevBlock + hashMerkleRoot + Time + Bits + Nonce. However, my previous impression was that hashing was a method for finding a nonce value, such that the nonce when hashed would produce a hash lower than the hash of the previous block. So, I am having trouble working through the logic. I am also struggling to understand what the file format for block submissions should be and how to format the file. It is not clear to me whether JSON or hexadigit format should be used nor how such file should be structured.

Any advice or suggestions would be sincerely appreciated.


References
[1] https://bitcoincore.org/en/doc/0.16.0/rpc/mining/submitblock
[2] https://github.com/bitcoin/bitcoin/issues/26830
3  Bitcoin / Mining support / Re: Mathematical Inputs and Outputs for Mining on: October 14, 2022, 02:00:36 AM
Answers to 0 and 1.

Version, hashPrevBlock, hashMerkleRoot, Time, Bits, Nonce

Source: https://en.bitcoin.it/wiki/Block_hashing_algorithm

Answer to 2.

No.

Answer to 3.

"The lower the target, the more difficult it is to generate a block."
"difficulty = difficulty_1_target / current_target"

Source: https://en.bitcoin.it/wiki/Difficulty

Answer to 4.

Miners do not submit a target hash. Miners submit a nonce to the network, that when hashed, is less than or equal to the target hash. The nonce is a 32-bit number and the target hash is a 256-bit number.
4  Bitcoin / Mining support / Mathematical Inputs and Outputs for Mining on: October 13, 2022, 09:29:56 PM
All else being peripheral, I appreciate your time in reading and any advice you may be able to provide – thank you.

I am learning about the mathematics behind the proof of work. As I understand it, the basic concept is predicated upon the SHA-256 hashing algorithm. The idea is that the blockchain sends out a target hash, which miners compete to solve by producing a hash equal to or below the target hash value. The target hash is a 64-bit hexadecimal string. However, the first eight digits are always 0, leaving 56-bits to be solved.

The maximum target hash is:

00000000ffff0000000000000000000000000000000000000000000000000000

To win a block, one must: 1) produce a string with the correct number of zeros; and 2) get a number lower than the target hash. Generally, the winning hash must be lower than the hash of the previous block.

However, I am still struggling to find a way to interact with the network to get some hands on experience and visually see the algorithms running the mining process. Some ongoing questions I have are:

Question 0: What are the specific inputs necessary to mine a block?

Question 1: What is the specific value presented to miners that is being hashed?

Question 2: Is it necessary to get the right number of zeros if the value is lower than the target?

Question 3: How does the difficulty mechanism impact or effect the target hash?  

Question 4: How can one submit a target hash to the network for validation?
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!