Questions tagged [block-header]
The block header is a portion of each block in the block chain that identifies the basic parameters of that particular block such as the block version, the time it was generated, the hash of the previous block, and the hash of the transactions in that block.
138
questions
2
votes
2
answers
60
views
What is the source for the "hash" field reported by the 'bitcoin-cli getblock' command?
It is stated that the header of a block does not contain a 'hash' field (see e.g. Bitcoin-Wiki: Block hashing algorithm or Antonopolous' Mastering Bitcoin 2nd Ed.).
This makes sense since including ...
26
votes
3
answers
82k
views
The bitcoin mining algorithm from a programmer's viewpoint
This page: Blocks said mining is actually to solve a mathematical problem, but reading Block hashing algorithm doesn't give much help.
I also tried reading bitcoind source code, but reading code takes ...
2
votes
1
answer
436
views
How to build coinbase transaction from bitcoin core?
I am coding a program that connects to bitcoin-qt as local server. For building the blockheader i need the merkleroot, to build the merkle root, i need the coinbase transaction (which is not provided ...
2
votes
2
answers
335
views
How to download just the blockheaders for the blockchain
I'd like to download all the blockheaders for the blockchain directly from the network (not an external API) ... what is the best way to do this?
I don't actually care about the transaction data and ...
1
vote
1
answer
149
views
What does the block time represent?
I've always been under the impression that a block's timestamp represents the second at which a block was found.
For this to be true, it would seem that the time header field must be modified along ...
0
votes
0
answers
72
views
How should I order the block header data in messages with the pool?
First i am creating this post to benefit all of you who are really into understanding and building your own miner from the scratch. There is so many materials but rarely have anything in common.
I ...
0
votes
0
answers
42
views
Valid block header versions bits
I am currently trying to learn what values miners can adjust in the block headers when hashing them. I see that the version number is routinely changed to some random bit string (which seems a bit odd ...
1
vote
1
answer
69
views
In what order is the blockheader hashed?
In what order are the hash of the previous block, the root of the merkle and the nonce hashed to produce the hash of the next bitcoin block?
8
votes
2
answers
570
views
How does headers-first prevent disk-fill attack?
Checkpoints prevented an attack where a node could mine many many low-difficulty blocks from an early point in the blockchain and serve those blocks to syncing nodes who would see their disks fill up. ...
16
votes
1
answer
1k
views
How does block synchronization work in Bitcoin Core today?
When a Bitcoin (full) node connects to the network, it has to synchronize its blockchain with its peers, i.e. learn about the best chain the network knows.
There are many aspects to this (learning ...
2
votes
0
answers
61
views
Headers-first sync and malicious peers [duplicate]
Since headers-first syncing specifies that the entire header chain is downloaded from a single peer, how does the downloading node know that it is not being served a manufactured out-of-consensus ...
1
vote
1
answer
51
views
What is pchCommand?
BIP152 and BIP130 are using this term. What does it mean? Command name in message header?
0
votes
0
answers
65
views
What are all the consensus rules for the block version value? [duplicate]
I am interested in what are the all consensus rules for block version number in a block header?
Found some answer here.
Andrew Chow said that it can be whatever value we want except some specific ...
2
votes
1
answer
71
views
What are the exact degrees of freedom in finding a valid block?
I am working on an educational project for bitcoin mining. I searched as much as I could but still haven't understood the following questions:
What are the "exact" degrees of freedom in ...
4
votes
2
answers
148
views
What if a miner just broadcasts the header and never gives the body? What will happen?
What if a miner just broadcasts the header and never broadcasts the body?
For example:
A miner, after having successfully mined some block, just broadcasts the header for all other miners and hide the ...
3
votes
2
answers
810
views
Calculate/Verify the Hash of a Bitcoin Block Header
I want to calculate/verify the hash for block #722,460.
Here is the JSON:
"hash": "00000000000000000002b73f69e81b8b5e98dff0f2b7632fcb83c050c3b099a1",
"confirmations": ...
1
vote
3
answers
111
views
How does hash work in a block for many transactions?
I know that a block in a chain has prev.hash and hash. The prev.hash is the previous block's hash. The hash is the current block's hash which is calculated based on nonce.
One block can also have up ...
2
votes
1
answer
694
views
What are the components of the raw block shown in this image?
I'm wondering what the portion between the block header and the transaction data (the un-annotated section) is. I can't seem to find any information on it.
1
vote
1
answer
136
views
How are the block header bytes treated when calculating the block size in weight?
In pre-segwit, block header bytes were counted as "1 byte" and participated equally in the block size up to 1MB. Since the header is 80 bytes, we would actually have 999,917 bytes (1,000,000 ...
16
votes
3
answers
25k
views
What is a nonce?
When I see the block info on blockchain, I see that there is a field named "nonce", I could not find any relevant information on web regarding what a nonce is. Please explain what a nonce is what is ...
0
votes
1
answer
416
views
how to hash block header in c++
I want to hash a block header in C++ but dont know how.
Im just using a test block at the moment, so that I know what the expected outcome is. https://www.blockchain.com/btc/block/669892
I have a ...
4
votes
1
answer
475
views
How do I hash header block with C++
So im trying to hash a header in C++ and I am having some trouble.
I have tried different libraries (cryptopp, openssl) can't seem to hash the header correctly.
This is the block which I am testing: ...
2
votes
1
answer
762
views
Do you know any download site for full blockchain header data (6) in CSV ASCII format?
do you know any download site for full blockchain header data (6 variables) in CSV ASCII format ?
I would like to enter block header data for every block from No.0 to latest into mining simulator to ...
2
votes
1
answer
173
views
What is the nBits field in the CBlockHeader class?
In the source code for the CBlockHeader class, there is a field called nBits.
/** Nodes collect new transactions into a block, hash them into a hash tree,
* and scan through nonce values to make the ...
8
votes
1
answer
402
views
What restrictions does the version field in the block header have?
We are seeing a lot of funky values in the block version since blocks are getting mined using the version field for additional entropy. This made me wonder, what range of values are permitted in the ...
0
votes
1
answer
204
views
What parts of a block, other than the nonce, can a miner vary
What are the list of all the variables whose values that the miner can cycle or modify to get a valid hash for this block (with very high probability) ? The only one I am aware of is:
Nonce - 4 Bytes....
1
vote
0
answers
106
views
How can I hash a block header using bitcoin-cli and terminal commands?
I would like to hash a block header using terminal commands and look at all the pretty leading 0s, but I can't figure out how to do this correctly using block header data from bitcoin-cli.
Here is ...
0
votes
1
answer
63
views
Trusting only the proof of work to receive payments
I understand that a pruned node needs to download all the blockchain in order to verify the blocks and construct the UTXO set.
But wouldn't be possible to download the headers only?
Let's say if the ...
3
votes
2
answers
313
views
What data is hashed to produce the block hash?
Exactly which items from a block are included in the data that is hashed to produce the block hash?
4
votes
1
answer
3k
views
Why is the block header 80 bytes, not 128 bytes (= two SHA-256 blocks)?
According to the Bitcoin Developer Reference, the block header is 80 bytes total:
BYTES NAME
4 version
32 previous block header hash
32 merkle root hash
4 time
4 nonce
...
1
vote
1
answer
808
views
Why is the block header version value different from the getblocktemplate version value in the bitcoin blockchain?
When looking at block header for block 746632 I see that the version is 1073676292 or 3fff0004 or when reversed 0400ff3f, but the version I received from a getblocktemplate request is 536870912 or ...
7
votes
1
answer
485
views
Is it necessary for blocks to record the nBits difficulty parameter?
The next difficulty to solve a block is determined from how fast blocks were solved before it. In addition, the difficulty only changes once every two weeks or so.
So, couldn't every node keep track ...
0
votes
0
answers
16
views
Mining against candidate block hash or previous block hash? [duplicate]
When mining...;
a) Is the block header hash of the candidate block used
b) OR the block header hash of the previous block + noonce used?
If it is a), which I presume, is it then correct that the ...
1
vote
2
answers
106
views
How to calculate the version (eg. in Python)?
I'm working through this medium post that describes all header fields of a block. The explanation of the version field is a little unclear for me.
For starters I'm trying to consider version = 1, as ...
0
votes
1
answer
311
views
What actual steps are required to calculate a block's header hash?
From my knowledge a header hash will be calculated like this:
serialize all header fields, including "the nonce"
hash the serialized header once
hash the hashed serialized header again
...
1
vote
1
answer
662
views
If a lot of miners start at nonce 0, how are there no ties?
I understand what happens with ties (in the long term, the longest chain wins), however, if a majority of miners start with a nonce of zero, does it just matter who has the fastest hardware, or is ...
3
votes
3
answers
4k
views
Are there any blockchain explorers that provide raw Tx data and block headers?
I've looked at some of the more popular blockchain explorers, but none of them seem to provide the feature I'm looking for. I'd like to find a blockchain explorer that allows you to see raw Tx data ...
0
votes
1
answer
1k
views
What is the correct way to calculate timestamp for a Block(125552)?
I am just learning mining process.
Today I learned that we have to find nonce for given block header.
And for block header we need timestamp in UTC
I took the timestamp data from below link of 125552 ...
2
votes
2
answers
374
views
Merkle root with one transaction
I am trying to build a merkle root which contains only the coinbase transaction from bitcoind.
After creating the coinbase transaction, do I need to convert it to little endian, hash it twice and then ...
0
votes
1
answer
149
views
How to pad Bitcoin Header in the SHA Algorithm Passes?
For any bitcoin block we combine various Header fields to create a string which is an input to a 2 pass SHA algorithm. The resultant hash must match with the Hash in the Block header for the Block to ...
0
votes
2
answers
252
views
A query regarding Bitcoin Header Format
I am new to Bitcoins and still learning thus please bear with me. As I read Bitcoin Block header (on which the Block Hash is computed) is supposed to be:
hash - 32 Bytes
ver - 4 Bytes
prev_block - ...
1
vote
2
answers
1k
views
How strict are the Unix Epoch time validation rules?
According to bitcoin.org, full nodes have a strict requirement on the deviation of time within certain boundaries.
The block time is a Unix epoch time when the miner started hashing the header (...
1
vote
2
answers
196
views
Why does the Genesis block appear to have a lower hash than necessary?
The hash of the genesis block of bitcoin has two extra 0 as compared to other block hashes. According to the logic, it should have been the same as they all have the same difficulty. Why is it so? Was ...
1
vote
1
answer
64
views
Do peers advertise their chain work?
If yes, is this how a node decides that the peer has the best chain for headers-first download?
5
votes
1
answer
1k
views
"New rules activated" warning after upgrading to 0.20.0
I've upgraded a node from the previous release. It's up and running but for some reasons I get this warning.
How can it be related to the upgrade?
$ bitcoin-cli -testnet getblockchaininfo | jq
{
"...
1
vote
1
answer
37
views
What exactly happens to leaves when forming nodes?
If you hash TXIDs with sha256 twice, you get the leaves of the merkle tree. As far as I understand the two outputs of the TXIDs are concatenated / paired. What does that mean? Are they added together?
0
votes
1
answer
1k
views
How to get the list of blockheader
I know that i can use getheader 'hash' from bitcoin core, but i can't use it for all blocks, it's time consuming.
Is there a site where i can find all bitcoin blockheader? Like a blockchain site but ...
1
vote
1
answer
124
views
Does the Merkle Root get constantly updated inside the block or does it only get added once the block is completed?
So, pretty much just the title. I'm just wondering how the Merkle Root works exactly. I know it's the result of pairing transactions and then hashing them until the last transaction in the block, but ...
0
votes
1
answer
68
views
What is the difference between the two transaction headers on the Bitcoin Liquid sidechain network?
You can see transactions for this asset
https://blockstream.info/liquid/address/H4UWQS836njW4QJ6WfkGAPjaYtK2twLnZE
For the second transaction, it has a header of
...
7
votes
3
answers
11k
views
Full example data for scrypt Stratum-client [closed]
I'm trying to write a Mining client for Scrypt-based mining using Stratum Communication.
As of now, I have some trouble verifying all my bit orders and sequences. Hashes I'm generating get always ...