• About
  • FAQ
  • Earn Bitcoin while Surfing the net
  • Buy & Sell Crypto on Paxful
Newsletter
Approx Foundation
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
Approx Foundation
No Result
View All Result
Home Bitcoin

blockchain – How to build a Block Header from pool data?

Moussa by Moussa
February 13, 2025
in Bitcoin
0
peer discovery – how to obtain the IP addresses of nodes for mining pools?
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter


and thanks in advance for your help!

I’m new to the forum, but I’ve read quite a bit of documentation, and I still can’t figure out how to properly construct the block header from the data provided by a mining pool. I’m really interested in mining lately and would like to understand the process in detail.

Let’s go through a practical example:

1. Subscribing to the Pool

When I send mining.subscribe, I receive:

[[["mining.set_difficulty","0HN9B1NBLO9DQ"],["mining.notify","0HN9B1NBLO9DQ"]],"2006be21",4]

From this, I get:

  • Extranonce1 = "2006be21"
  • Extranonce2 must be 4 bytes (e.g., "c95fc1a9").

2. Receiving Work from the Pool

After mining.authorize, I receive a mining.notify message:

["00059c50","cd6f21657c8eb8301949442a3fff2e78a9cb857e01b2a0120000000000000000",
"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1503e4810d0474d9ad6700",
"027a690000000001bae6a212000000001976a9143e5509507b08938f58bdb9d9d8e860e0d0d084dc88ac00000000",
["6cffdce483ddf6d154b90eaa262e63e0f4fddd17bea7730af0cb070a2482e800",
"11f5139edbd86f6497e8341b195d435694c0b482babf9e6ff9c68f3d2cfd9cc8",
"879bf96a7f01f34dd6f9e14e91cd4153da922e136ded76c4d76376dc4aa2bffb",
"579a25a2a4e4844aca8d357d0ef3ab4269cb06aeba874e3a7945ec04b6a207eb",
"4f4cd551e8ab18716ac53a1460c77f795c1999dd983a98f030500ca646790f86",
"2806126621f7fe529e08b0cdf7f502ccae77a27d2f9c9f1c3f39d5849f885c70",
"d1a498f3adc3db8f7b3bca34427d7d5e22caee7ef8ef63e681f92e64bd9bc0c4"],
"20000000","1802b50e","67add974",false]

From this, I extract the following:

  • jobID: "00059c50"
  • previous hash: "cd6f21657c8eb8301949442a3fff2e78a9cb857e01b2a0120000000000000000"
  • Coinbase1: "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1503e4810d0474d9ad6700"
  • Coinbase2: "027a690000000001bae6a212000000001976a9143e5509507b08938f58bdb9d9d8e860e0d0d084dc88ac00000000"
  • Merkle branch: [...]
  • Version: "20000000"
  • nBits: "1802b50e"
  • nTime: "67add974"

3. Constructing the Coinbase Transaction

I concatenate:

Coinbase1 + Extranonce1 + Extranonce2 + Coinbase2

Resulting in:

"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1503e4810d0474d9ad67002006be21c95fc1a9027a690000000001bae6a212000000001976a9143e5509507b08938f58bdb9d9d8e860e0d0d084dc88ac00000000"

4. Computing the Merkle Root

I compute sha256(sha256(CoinbaseTransaction)), then hash it with the Merkle branch using:

DoubleSha256(merkleBranch[i] + merkleBranch[i + 1])

This results in the Merkle root:

"6e7770d16e88b3effd401a58e47a22ac1eaba562543620bf673ff8d40548ae56"

5. Constructing the Block Header

I format the block header as:

"00000020" + previousHash + merkleRoot + nTime + nBits + nonce

Example with nonce d1002500 (- are added to make it more readable):

"00000020-cd6f21657c8eb8301949442a3fff2e78a9cb857e01b2a0120000000000000000-56ae4805d4f83f67bf20365462a5ab1eac227ae4581a40fdefb3886ed170776e-74d9ad67-0eb50218-d1002500"

Computing the double SHA-256:

cc8c028e85d85cdfd07541cc50d7e5c7e10fa708c39a3c942d0083238e020000

6. Submitting the Work

I send a mining.submit with:

jobID: "00059c50"
ExtraNonce2: "c95fc1a9"
nTime: "67add974"
nOnce: "d1002500"

Issue

Even when I submit a hash with a higher difficulty, the pool eventually returns a “low difficulty” error (e.g., E-10, E-9). This suggests I’m incorrectly constructing the block header or calculating the Merkle root incorrectly.

Can anyone help me figure out what I’m doing wrong?

Thanks a lot! 😊



Source link

Related articles

‘gettransaction’ returns empty details for some wallet transactions but not others

August 27, 2026
Bitcoin Price Prediction: Stablecoins Now Back Most Futures Positions

Bitcoin Price Prediction: Stablecoins Now Back Most Futures Positions

August 27, 2026
Share76Tweet47

Related Posts

‘gettransaction’ returns empty details for some wallet transactions but not others

by Moussa
August 27, 2026
0

Bitcoin Knots 29.3, single descriptor wallet managed by Sparrow, four 2-of-3 multisig wallets registered in it. Three transactions from one...

Bitcoin Price Prediction: Stablecoins Now Back Most Futures Positions

Bitcoin Price Prediction: Stablecoins Now Back Most Futures Positions

by Moussa
August 27, 2026
0

Bitcoin prediction traders on futures have largely moved away from using Bitcoin as collateral as the price rises. The share...

Ethereum Quantum-Proof Account Proposal Could Make Wallet Protection Cheap

Cardano CIP-0197 Targets Quantum-Proof Wallet Protection

by Moussa
August 27, 2026
0

Trusted Editorial content, reviewed by leading industry experts and seasoned editors. Ad Disclosure Cardano has opened formal review on CIP-0197,...

Tron Inc. Expands TRX Treasury To $245M In Nasdaq Corporate Crypto Bet

Tron Inc. Expands TRX Treasury To $245M In Nasdaq Corporate Crypto Bet

by Moussa
August 27, 2026
0

Nasdaq-listed Tron Inc. has expanded its corporate treasury to 711.2 million TRX, bringing the value of its token holdings to...

Bitcoin ETFs Draw Billions In New Investment

Bitcoin ETFs Draw Billions In New Investment

by Moussa
August 27, 2026
0

Bitcoin exchange-traded funds have continued their winning streak, attracting billions of dollars in new investment over the past week.  U.S....

Load More

youssufi.com

sephina.com

[vc_row full_width="stretch_row" parallax="content-moving" vc_row_background="" background_repeat="no-repeat" background_position="center center" footer_scheme="dark" css=".vc_custom_1517813231908{padding-top: 60px !important;padding-bottom: 30px !important;background-color: #191818 !important;background-position: center;background-repeat: no-repeat !important;background-size: cover !important;}" footer_widget_title_color="#fcbf46" footer_button_bg="#fcb11e"][vc_column width="1/4"]

We bring you the latest in Crypto News

[/vc_column][vc_column width="1/4"][vc_wp_categories]
[/vc_column][vc_column width="1/4"][vc_wp_tagcloud taxonomy="post_tag"][/vc_column][vc_column width="1/4"]

Newsletter

[vc_raw_html]JTNDcCUzRSUzQ2RpdiUyMGNsYXNzJTNEJTIydG5wJTIwdG5wLXN1YnNjcmlwdGlvbiUyMiUzRSUwQSUzQ2Zvcm0lMjBtZXRob2QlM0QlMjJwb3N0JTIyJTIwYWN0aW9uJTNEJTIyaHR0cHMlM0ElMkYlMkZhcHByb3gub3JnJTJGJTNGbmElM0RzJTIyJTNFJTBBJTBBJTNDaW5wdXQlMjB0eXBlJTNEJTIyaGlkZGVuJTIyJTIwbmFtZSUzRCUyMm5sYW5nJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1maXJzdG5hbWUlMjIlM0UlM0NsYWJlbCUyMGZvciUzRCUyMnRucC0xJTIyJTNFRmlyc3QlMjBuYW1lJTIwb3IlMjBmdWxsJTIwbmFtZSUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1uYW1lJTIyJTIwdHlwZSUzRCUyMnRleHQlMjIlMjBuYW1lJTNEJTIybm4lMjIlMjBpZCUzRCUyMnRucC0xJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0MlMkZkaXYlM0UlMEElM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1lbWFpbCUyMiUzRSUzQ2xhYmVsJTIwZm9yJTNEJTIydG5wLTIlMjIlM0VFbWFpbCUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1lbWFpbCUyMiUyMHR5cGUlM0QlMjJlbWFpbCUyMiUyMG5hbWUlM0QlMjJuZSUyMiUyMGlkJTNEJTIydG5wLTIlMjIlMjB2YWx1ZSUzRCUyMiUyMiUyMHJlcXVpcmVkJTNFJTNDJTJGZGl2JTNFJTBBJTNDZGl2JTIwY2xhc3MlM0QlMjJ0bnAtZmllbGQlMjB0bnAtcHJpdmFjeS1maWVsZCUyMiUzRSUzQ2xhYmVsJTNFJTNDaW5wdXQlMjB0eXBlJTNEJTIyY2hlY2tib3glMjIlMjBuYW1lJTNEJTIybnklMjIlMjByZXF1aXJlZCUyMGNsYXNzJTNEJTIydG5wLXByaXZhY3klMjIlM0UlQzIlQTBCeSUyMGNvbnRpbnVpbmclMkMlMjB5b3UlMjBhY2NlcHQlMjB0aGUlMjBwcml2YWN5JTIwcG9saWN5JTNDJTJGbGFiZWwlM0UlM0MlMkZkaXYlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1idXR0b24lMjIlM0UlM0NpbnB1dCUyMGNsYXNzJTNEJTIydG5wLXN1Ym1pdCUyMiUyMHR5cGUlM0QlMjJzdWJtaXQlMjIlMjB2YWx1ZSUzRCUyMlN1YnNjcmliZSUyMiUyMCUzRSUwQSUzQyUyRmRpdiUzRSUwQSUzQyUyRmZvcm0lM0UlMEElM0MlMkZkaXYlM0UlM0NiciUyRiUzRSUzQyUyRnAlM0U=[/vc_raw_html][/vc_column][/vc_row]
No Result
View All Result
  • Contact Us
  • Homepages
  • Business
  • Guide

© 2024 APPROX FOUNDATION - The Crypto Currency News