7 votes
Accepted

Why does the mined block differ so much from the block template?

The version of the mined block is 0x2fffe000 instead of 536870912. Many miners employ a strategy known as overt Asicboost. This strategy requires modifying the version number like the nonce, so we ...
  • 63.2k
6 votes

Work distribution in a mining pool

The pool's mining server gives each miner a template to use for generating blocks. When the server wants to update which transactions are included or which block to build upon it will push a new ...
  • 8,339
5 votes
Accepted

How does getblocktemplate select transactions?

The whole mempool won't fit in a block; getblocktemplate returns enough transactions for a block. Blocks are, by default, limited to 750kb by policy, but many miners increase the size to the block ...
4 votes
Accepted

Why is the block header version value different from the getblocktemplate version value in the bitcoin blockchain?

There is no requirement that a miner must follow the block template. They can construct their own blocks as they see fit, so long as their block follows the consensus rules. There cannot be a ...
  • 63.2k
4 votes

How to call `getblocktemplate` without running a full node?

To create a valid bitcoin block, you will need a view of the current network state. Otherwise how will you know what the previous valid block was, or what transactions are valid and worthy of being ...
  • 17.5k
4 votes
Accepted

Why does getblocktemplate use priority for transaction selection?

Getblocktemplate builds a block based on configuration parameters. In recent versions, the default is to use fee per byte as criterion for the entire block. History In versions of Bitcoin up to 0.6, ...
4 votes

Why does the mined block differ so much from the block template?

Going out on a limb here, but I would guess that your node is not running 24/7. Full nodes only rebroadcast transactions once when they first hear about them. If your node is only online ...
  • 65.3k
3 votes

How does bitcoin reward who find the block?

A miner will create a special type of transaction known as a Coinbase transaction, as the first transaction in the block. This special transaction pays the block reward (including transaction fees) to ...
  • 11.5k
3 votes
Accepted

Question about getblocktemplate

Once a client has the template it can modify it to make the header different, giving you a new nonce range to search. In modern miners this happens thousands or tens of thousands of times a second. ...
  • 15.2k
2 votes
Accepted

Bitcoin testnet: "Bitcoin is downloading blocks..." and other problem

For your first question, the message "Bitcoin is downloading blocks" is produced if the client hasn't yet downloaded all the checkpoint blocks. For testnet, there is exactly one checkpoint block, at ...
2 votes

How i can delete last block from blockchain? altcoin

You can't delete a block, just mine a new block on top of the previous block, creating a fork. Just reference the parent block as the parent of your new block, and if you mine more on top of your new ...
  • 11.5k
2 votes
Accepted

Where does this pattern in the feerate distribution per block originate from?

1) Is this known behavior of an algorithm that creates block templates? Yes. This is behavior that is present in Bitcoin Core. Bitcoin Core bundles transactions into "packages" of one or more ...
  • 63.2k
2 votes
Accepted

getblocktemplate fails in regtest mode even when it is connected to the other node

You need to mine a block so that the software thinks that the blockchain is fully synced. The most recent block in the regtest blockchain is probably old so you just need to mine one more block to ...
  • 63.2k
2 votes
Accepted

Block version 0x20000000

The bytes you would put in the block header would be, in order: 0x00 0x00 0x00 0x20. That's how the number 221 (= 0x20000000) is stored in 32-bit little endian encoding. Note that this is actually a ...
2 votes
Accepted

reconstruct block template from stratum mining.notify

If there is only one output address, we can guess here that the reward is the 8 bytes before the 1976, No, you cannot. the 1976 is the start of the output script and can/will be different depending ...
  • 63.2k
2 votes
Accepted

Can Bitcoin Core 0.9.5 still fully sync?

Yes, 0.9.5 is consensus compatible with modern Bitcoin, though it will be considerably slower than modern versions, and probably shouldn't be used for anything that's transacting real money.
  • 15.2k
1 vote

MerkleRoot requires transaction hash to build a merkle tree.... Is that the "hash" key/value within the getblocktemplate response or the "data"?

The transaction Merkle tree, whose root is stored in the block header, is computed over the individual transactions' txid value (which are the double-SHA256 of their data after stripping the witness). ...
1 vote
Accepted

What exactly is the data required when creating a coinbase transaction? How do I insert the blocks height into the coinbase transaction?

The requirement of encoding the block height in the coinbase transaction is specified in BIP34. You may want to read the actual documentation there. Specifically, it requires the scriptSig of the ...
1 vote
Accepted

How to get unconfirmed transactions

How to get unconfirmed transactions [...] To be notified of new unconfirmed transactions, to retrieve them and to make other nodes aware of blocks you have mined you will need to implement the ...
1 vote

getblocktemplate request that omits transactions?

getmininginfo or getdifficulty are useless as they return the difficulty of the most recently mined block, not the block that is currently being mined. The network difficulty is adjusted every 2016 ...
  • 17.5k
1 vote

Where does this pattern in the feerate distribution per block originate from?

As Andrew Chow pointed out, my feerate calculations were wrong. I used the totalSize of the transaction. Correct would have been to use the virtualSize. With correct calculations the visualization ...
  • 1,372
1 vote

Building the merkle root from transactions in a template block

I'm much closer now I hope this helps someone else trying to do this! REQUIREMENTS: NPM bitcoin bitcoin-js merkle-lib CODE: client.getBlockTemplate( function(error, template) { if (error) ...
  • 155
1 vote
Accepted

bitcoin fork getblocktemplate keeps reporting downloading blocks

Because block 506016 happened ~1 week ago, when you start your node software, it thinks that it is still in the initial block syncing phase because the timestamps are off of real time by a lot. The ...
  • 63.2k
1 vote

How to compute merkle root without coinbasetxn?

What pool are you using? As an example, if you hit (POST a request to) eligius pool (http://gbt.mining.eligius.st:9337) with the body as {"id": 0, "method": "getblocktemplate", "params": [{"...
1 vote
Accepted

How does the getblocktemplate request rate correlate with a miner's hashrate?

There's no relationship. With a single block template mining software can create a limitless amount of work by modifying the extranonce, the only reason they would need to update to a new one is to ...
  • 15.2k

Only top scored, non community-wiki answers of a minimum length are eligible