Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
9

Stratum: the server gives the client templates that the client can use to generate its own work. Only the block header and first transaction (generation transaction) are included. Stratum uses the least bandwidth of all the protocols. Stratum also makes it very fast and efficient to switch to new work data when there is a block change, which can help keep ...


6

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 template to each miner. To generate work for itself the miner is allowed to change the nonce, the timestamp and the extranonce. The nonce is just a 32-bit number ...


6

When there were no pools, all of the first mining clients interfaced directly with Bitcoin. They connected to Bitcoin's JSON-RPC interface and used the getwork RPC method to get the required work. Getting work from a pool is the same as getting work from Bitcoin. The client connects to the pool over HTTP, often using the same HTTP authentication that Bitcoin'...


6

getwork is for all intents, completely deprecated due to it's inefficiency. At this point a single ASIC device can completely swamp a bitcoind with requests as they're able to exhaust the 32bit nonce in a fraction of a second. The situation is severe enough that pools like BTC Guild have extraordinary large (6%+) fees on clients using getwork in order to get ...


4

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 limit of 1mb (which can be done by command-line flag). The specific piece of code that decides on the transactions that should be included in a block can be found ...


3

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, priority based selection was used for the entire block. It was a means to encourage the young Bitcoin economy to grow. However, it also had a minimum ...


3

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 the miner (or anyone they choose). But the miner can only put one, valid coinbase transaction in a block because otherwise the block as a whole would be ...


2

The wiki has an extremely good explanation, with a python run-through that takes you from GBT output to share submission. You could also have a look at some of the implementation in Luke-Jr's "gmp-proxy", which translates GBT reponses into a getwork compatible interface. https://en.bitcoin.it/wiki/Getblocktemplate https://gitlab.com/bitcoin/eloipool/blob/...


2

The advantage of getblocktemplate is that work units from it last longer, because you can change the extraNonce field. That's nice if you're writing an fpga miner, because it saves bandwidth. getwork will probably never go away. It's useful and not very hard to maintain. Note that that's a personal opinion; I'm not one of the Bitcoin developers. Edit: ...


2

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 height 546. So until your client has mined 546 blocks, you will continue to get this message. Unfortunately, when you do mine block number 546, it will be ...


2

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. The timestamp in the header can be updated if needed, this is known in old software as nRollTime. This method is generally not used anymore because you only get ...


2

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 transactions. Each package consists of an unconfirmed transaction and its children (if any) to cover the case of Child-Pays-For-Parent. The transaction fee rate is ...


2

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 make the blockchain "recent". Just use the generate command. You can do: ./src/bitcoin-cli -regtest -port=8333 -rpcport=8332 -rpcuser=test -rpcpassword=test ...


1

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 on the output script (i.e. address) that the pool wants to use. The stratum protocol says that the hex for the coinbase transaction is coinb1 + hex(extranonce2) ...


1

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 looks far more as I expected. Block #517361 (compare above)


1

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) return console.log(error); txhashes = template.transactions.map(function(tx){ return Buffer.from(tx.txid, 'hex').reverse() }); merkleRoot = fastMerkleRoot(...


1

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 only way around this is to mine a block now. You can modify the source code to bypass this warning so that you can mine a block.


1

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 chain, it will become the accepted chain. The age of the block shouldn't matter.


1

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": [{"capabilities": ["coinbasetxn", "workid", "coinbase/append"]}]} as taken from https://en.bitcoin.it/wiki/Getblocktemplate you will get a coinbasetxn field returned in ...


1

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 include transactions that have just arrived, or when someone else has found a block. The reason GetWork rates varied was that each request was only valid for a ...


1

You probably want to look at BIPs 22 and 23, as well as the libblkmaker source code (which includes an example of usage).


1

One fundamental, expected way to make a valid template invalid: someone else finds a block, and it's time to switch. You can technically keep incrementing "curtime" until it's 2 hours in the future, though my gut tells me I should try to avoid pushing "curtime" anywhere near that far into the future until after I've exhausted everything else. I haven't ...


1

When the mutation "coinbase" (see BIP 23) is present, the key "coinbaseaux" sets rules for what MUST be in a coinbase if/when one is built/modified. The key "coinbasetxn" is optional, and if omitted the mutation "coinbase" is assumed and the implication is that "coinbaseaux" MAY define requirements for building the coinbase. The key "coinbaseaux" is also ...


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