Bitcoin Forum
May 02, 2024, 02:54:08 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: bitcoin-cli submitblock template  (Read 47 times)
GoldPlebeian (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 4


View Profile
January 06, 2023, 06:16:47 PM
 #1

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
1714661648
Hero Member
*
Offline Offline

Posts: 1714661648

View Profile Personal Message (Offline)

Ignore
1714661648
Reply with quote  #2

1714661648
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
GoldPlebeian (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 4


View Profile
January 06, 2023, 10:00:02 PM
 #2

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/
NotFuzzyWarm
Legendary
*
Offline Offline

Activity: 3626
Merit: 2520


Evil beware: We have waffles!


View Profile
January 06, 2023, 11:31:06 PM
Last edit: January 08, 2023, 01:20:50 AM by NotFuzzyWarm
 #3

A better area of the Forum to ask this in the Development & Technical area of the Forum where you will find more folks working with core and its various subsystems.

- For bitcoin to succeed the community must police itself -    My info useful? Donations welcome! 1FuzzyWc2J8TMqeUQZ8yjE43Rwr7K3cxs9
 -Sole remaining active developer of cgminer, Kano's repo is here
-Support Sidehacks miner development. Donations to:   1BURGERAXHH6Yi6LRybRJK7ybEm5m5HwTr
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!