Bitcoin Forum
November 01, 2024, 08:12:09 AM *
News: Bitcoin Pumpkin Carving Contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: block header parsing question from live blockchain  (Read 110 times)
ggbtctalk000 (OP)
Full Member
***
Offline Offline

Activity: 394
Merit: 101


View Profile
April 12, 2023, 06:26:11 AM
 #1

After years of interruption,  I am studying internals of bitcoin again,  starting with block header format.  I wanna see in real life,  from blockchainfo info, I can see contents of certain blocks in a web formatted output,  but nowhere seen the block header.
Is there a way to see block header from live public block chain? Any utility?
Following options are fine for me:
1. Using some utility dump header
2. Using some utility fetch (from public chain) entire block including block header write my own parser. Thanks
Sha256explorer
Jr. Member
*
Offline Offline

Activity: 47
Merit: 18


View Profile
April 12, 2023, 07:45:14 AM
 #2

I suggest to take a look at this: https://bitcointalk.org/index.php?topic=5448305.0

un_rank
Hero Member
*****
Offline Offline

Activity: 896
Merit: 855


- Jay -


View Profile WWW
April 12, 2023, 08:53:19 AM
 #3

Not entirely certain that Blockchair[1] would give you the information you need, but it is a tool I use when I want to get some information about the current or next block[2].

[1] https://blockchair.com/
[2] https://blockchair.com/bitcoin/block/785043

- Jay -

██
██
██
██
██
██
██
██
██
██
██
██
██
... LIVECASINO.io    Play Live Games with up to 20% cashback!...██
██
██
██
██
██
██
██
██
██
██
██
██
ggbtctalk000 (OP)
Full Member
***
Offline Offline

Activity: 394
Merit: 101


View Profile
April 12, 2023, 06:31:36 PM
 #4

You can use Bitcoin Core to obtain that data. Here's an example,

Code:
$ getblockhash 700000
0000000000000000000590fc0f3eba193a278534220b2b37e9849e1a770ca959
$ getblockheader 0000000000000000000590fc0f3eba193a278534220b2b37e9849e1a770ca959
{
  "hash": "0000000000000000000590fc0f3eba193a278534220b2b37e9849e1a770ca959",
  "confirmations": 84720,
  "height": 700000,
  "version": 1073733636,
  "versionHex": "3fffe004",
  "merkleroot": "1f8d213c864bfe9fb0098cecc3165cce407de88413741b0300d56ea0f4ec9c65",
  "time": 1631333672,
  "mediantime": 1631331088,
  "nonce": 2881644503,
  "bits": "170f48e4",
  "difficulty": 18415156832118.24,
  "chainwork": "0000000000000000000000000000000000000000216dd8dc61fdffabb624feeb",
  "nTx": 1276,
  "previousblockhash": "0000000000000000000aa3ce000eb559f4143be419108134e0ce71042fc636eb",
  "nextblockhash": "00000000000000000002f39baabb00ffeb47dbdb425d5077baa62c47482b7e92"
}
$ getblockheader 0000000000000000000590fc0f3eba193a278534220b2b37e9849e1a770ca959 false
04e0ff3feb36c62f0471cee034811019e43b14f459b50e00cea30a000000000000000000659cecf4a06ed500031b741384e87d40ce5c16c3ec8c09b09ffe4b863c218d1f282d3c61e4480f17d767c2ab

Although if you don't want to download whole Bitcoin blockchain, you could just get raw block data from block explorer and extract raw block header manually.

YES that is what i did, in windows. I think i will do it in linux later for easier.
I see in windows, it does download lot of blockchain files in *.data format although i am still not sure how those *dat files are organized.
My end goal is to be able to parse whole block.
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!