16

Contrary to popular belief, the target is not actually based on the number of leading zeroes. This is a major simplification that is used to get the general idea across, but is not actually how the code works. Instead, the target is just a number that is adjusted by the ratio between the actual time between blocks and the expected time between blocks (with ...


14

As Andrew's answer points out, the 'number of leading zeros' is just a simplification, so I thought I would give an example to more concretely illustrate this: Block hashes are usually represented in hex format, which utilizes the character set [0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f]. But for simplicity, we can just use a base 10 number set [0,1,2,3,4,5,6,7,8,9], ...


4

nBits is a compressed representation of the target value that the block's hash must be less than. Bitcoin does not actually care about difficulty. Difficulty is just for humans to think about how much work is actually being done. Bitcoin only cares about nBits and the target value it represents. A block's hash must be less than that target value. nBits is ...


4

Difficulty progresses in epochs of 2016 blocks. The difficulty for a given epoch is calculated from the difficulty of the preceding epoch and the difference of the timestamps between the first and the last block of the preceding epoch. The rules governing difficulty are part of the consensus rules. Following the consensus rules is sort of voluntary but it's ...


3

It only considers valid chains. If either chain has an invalid block in it, it is excluded from consideration. If the chainwork (sum of the inverses of the targets of the blocks in the chain, approximately proportional to the sum of the difficulties) differs, chains with less than the maximum chainwork are excluded from consideration. If there are still ...


3

However, that implies that the adversary sticks to the network's difficulty setting. If it didn't, it could create longer chains using much less computing power. The Bitcoin network's backbone is spanned by fully validating nodes ("full nodes"). This type of Bitcoin client participates in the peer-to-peer network by unilaterally validating and ...


3

It isn't strictly the longest chain that is chosen, it is the chain that has accumulated the most work (proof of work). The reason miners can't fake the difficulty is that every node checks the difficulty of every new block. An attacker who faked this would never be able to spend the proceeds and would become isolated from other nodes as a known bad node. ...


3

nullc answered this on Reddit. Adjusting every block (or faster in general) increases user's vulnerability to isolating attacks. Say I manage to isolate your node so that it's only talking to my node -- not a particularly hard attack. Then using some mining hashpower (perhaps that I've also isolated-- which is harder, or I'm paying for myself) I mine blocks ...


2

It's important to note that "difficulty" as such doesn't actually exist in the system; it's just a convenient way of representing the target value for human consumption. Internally (and on-chain) only the "target" and "nbits" representation are used. Furthermore, the actual difficulty for the genesis block doesn't really matter, ...


2

First of all, "difficulty" as a concept does not exist in the protocol. It's a unit intended only for human consumption. Internally, the value that corresponds with it is the target. The target is a 256-bit number, computed for every block, and a block is valid if its hash (interpreted as 256-bit number as well) is less than or equal to the target. ...


2

You're trying to do 100% of the work with 70% of the workforce. The expected block interval is to the target interval of 10 minutes as the total work is to the workforce: Texp = 10 minutes × (100% ÷ 70%) = 14.3 minutes The difficulty reset would get extended by the same factor: Dreset = 14 days × 100 ÷ 70 = 20 days The expected block interval would be ...


2

that has higher difficulty than the whole "normal" blockchain accumulated. That's not possible. The difficulty of a block is solely a function of the timestamps of the blocks in its history. It does not depend on the block itself, it cannot be chosen by the miner, and isn't dependent on how low the hash is. The only thing that matters is if the ...


2

The SHA256 hash algorithm produces what looks exactly like a random number in the range 0 to 2256-1 (1.1579208923731619542357098500869e+77). Each of those values should be equally likely. So if you produce a large number of these by altering the data to be hashed, you cannot steer the results and most of the results will be a large number. Some of the ...


1

Bitcoin difficulty is not determined by the "number of zeros", but none the less the Bitcoin genesis block would satisfy a difficulty target substantially higher than might be expected. This doesn't really mean anything in the scheme of how the system operates, it's just a curiosity.


1

Your approach is interesting however to have a significant energy-consumption decrease you need to have a signficiant reward decrease which will involve a significant hash power decrease since then the security would have a significant decrease (because any old high hash power organization like current mining pool could "easily" reach 51 % of hash ...


1

difficulty = hashrate / (2^32-2^16) / 600 ) = hashrate / 7158170 ~ hashrate / (2^32 / 600) as 2^32-2^16=0xFFFF0000 in hex, a magic constant in the code.


1

The mining difficulty adjusts according to a specific algorithm. The difficulty adjusts such that, regardless the hashrate, the average time between blocks is approximately 10 minutes. The difficulty also only adjusts when there are changes to hashrate. As miners go offline, it will adjust down to become easier to mine. As miners come online, it will adjust ...


1

Bitcoin has consensus rules, not consensus voluntary agreements.


1

In theory yes but the alien super computer would have to have hash power at an incredibly large multiple of the hash power pointed towards the Bitcoin blockchain today. According to blockchain.com today's network hash rate is around 130 million terahashes per second. If the alien super computer had more than this it could likely produce the next block with ...


1

Close core, find your bitcoin.conf file, and change the datadir setting. e.g. # [core] # Specify a non-default location to store blockchain and other data. datadir=/opt/yourdisk Then re-open core. It should pick up where your wallet last synced to on the external drive.


1

If the target hash were artificially low, i.e. 3, how do miners know if there will ever be a nonce that produces such a hash? They don't. However if the difficulty were ever such that miners were unable to mine new blocks at the expected rate (1 every 10 minutes approximately), the difficulty algorithm would reduce the difficulty after a while (up to 2 ...


1

Better Late than Never. I was asking myself the same question...I thought the hash rate of the network came from Full Nodes observation on Miners...I was wrong. I was looking for this answer on Bitcoin.org, but it's on Blockchain website: https://www.blockchain.com/charts/hash-rate. Look at the methodology at the bottom of the page. Formula is Hash rate = (...


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