Hot answers tagged

36 votes
Accepted

Why does hashing public keys not actually provide any quantum resistance?

Although hashing a public key by itself does provide quantum resistance, this is really only when it is considered by itself in a vacuum. Unfortunately, public key hashes do not exist in a vacuum and ...
Andrew Chow's user avatar
  • 67.4k
18 votes
Accepted

Adding instead of concatenating hashes in Merkle trees

There are a number of issues here, with different answers. Can Merkle trees use a commutative operation in general to combine hashes? Yes, but only if they aren't intended to commit to the order of ...
Pieter Wuille's user avatar
17 votes

Why are hashes in the bitcoin protocol typically computed twice (double computed)?

The wiki claim that this is to prevent birthday attacks is wrong. If you can successfully execute a birthday attack on a single call to the hash function, you get a successful birthday attack on the ...
mikeazo's user avatar
  • 271
16 votes
Accepted

How is a block header hash compared to the target (bits)?

How to calculate the target from bits Let's start with a block-header, always 80-bytes that looks like this: ...
Jimmy Song's user avatar
  • 7,729
15 votes
Accepted

What would happen if two blocks had the same hash?

Blocks are identified by their hash. This means that in your story, in Jan 2017, when B gets broadcast, any node that it is advertized to will think "I already have this block", and ignore it. ...
Pieter Wuille's user avatar
14 votes

Why does Bitcoin Core print SHA256 hashes (uint256) bytes in reverse order?

From sipa on IRC (2023-01-06): jamesob: Probably dumb question, but why does uint256::ToString() (-> HexStr()) print out the blob in reversed byte order? sipa: Because that's what it has always ...
James O'Beirne's user avatar
13 votes
Accepted

hash versus hash pointer

I believe that the use of the term "pointer" in the this sentence is not referring to the low-level data type, such as int *pointer_to_int; would be in C. I think it's more referring to a "pointer" ...
Jestin's user avatar
  • 8,802
12 votes

Why are hashes in the bitcoin protocol typically computed twice (double computed)?

Like others have said, the wiki claim of this preventing birthday attacks is wrong. Rather, this was meant to prevent against length extension attacks. From https://crypto.stackexchange.com/a/884/...
Zain Rizvi's user avatar
11 votes

How is mining the exact same hash on every computer avoided?

Blocks commit to the set of transactions they contain, including the coinbase transaction. The coinbase transaction is the transaction which pays the subsidy/fees out to the miner who mined it. Since ...
Pieter Wuille's user avatar
9 votes
Accepted

Where did the idea of blockchain come from? Git was already using it since 2005

According to Bitcoin and Cryptocurrency Technologies (BaCT), the Princeton Bitcoin textbook, the block chain dates back to a "paper by Haber and Stornetta in 1991. Their proposal was a method for ...
Murch's user avatar
  • 71.6k
9 votes

What can be changed in signed bitcoin transaction?

Here is the list of known sources of malleability from BIP62 (which has been withdrawn, and is no longer up to date, but does give some insight): DER encoded ECDSA signatures Right now, the Bitcoin ...
Pieter Wuille's user avatar
9 votes
Accepted

How to tell which part of the previous tx I need to make the hash to sign for an old given tx?

Disclaimer: I am going to assume that you are not completely clueless and that you know what an array is, how to count from 0, and how to match brackets, quotes, and colons so that you can read JSON ...
Andrew Chow's user avatar
  • 67.4k
9 votes
Accepted

Why do two miners get different hashes for the same list of transactions?

The first transaction in a block is called the "generation" or "coinbase" transaction. It has no real inputs, and spends no coins. Instead, it pays out the subsidy and fees to the miner that generated ...
Pieter Wuille's user avatar
9 votes
Accepted

Which is the smallest hash that has ever been hashed?

The 12 lowest block hashes in Bitcoin as of Jan 22 2023: Block 756951 (0000000000000000000000005d6f06154c8685146aa7bc3dc9843876c9cefd0f) Block 742035 (...
Pieter Wuille's user avatar
8 votes

If SHA256 produces an alphanumeric hash, how can a hash be "less than a certain value"?

Not that other answers are wrong here, but just to approach your confusion from another angle: SHA256 hashing algorithm, which produces alphanumeric hashes. That's not true. The hashing algorithm ...
Jannes's user avatar
  • 6,325
8 votes
Accepted

What is Bitcoin's "genesis hash"?

They're exactly the same number; one is written in little endian notation and the other is big endian. Notice that the bytes (two-hex-digit pairs) are exactly reversed from one to the other. Block ...
Nate Eldredge's user avatar
8 votes
Accepted

Breaking down a raw transaction:

The bolded byte in the following raw transaction is the number of outputs (two in this transaction): ...
David A. Harding's user avatar
8 votes
Accepted

A security need for Bitcoin to fork to quantum resistant algorithm in a few years?

asymmetric ciphers Ones based on specific primitives, like RSA and ECDSA specifically. Symmetric algorithms are supposed to be safe. With approximately half the number of bits of security due to ...
Claris's user avatar
  • 15.3k
8 votes

How does a blockchain relying on PoW verify that a hash is computed using an algorithm and not made up by a human?

A Hash Function maps "data of arbitrary size to fixed-size values". As an incredibly simple hash, consider a function only works on numbers and simply returns the last 3 (decimal) digits (ie....
minnmass's user avatar
  • 181
7 votes
Accepted

Why was finding a hash beginning with a certain number of zeroes chosen as the proof of work?

It reuses the HashCash construct invented by Adam Back (a scheme for proving work was done to send an email, resulting in it being treated as less spammy by spam filters), though with a newer hash ...
Pieter Wuille's user avatar
7 votes
Accepted

Blockchain SHA256 hash and nonce

The block hash has to be below a certain value and the block hash depends (among others) on the nonce and on the Merkle root. The Merkle root depends on the sequence of transactions. Note that it's a ...
UTF-8's user avatar
  • 3,214
7 votes

Why does the hash-rate change so drastically?

The actual hash rate of the network is not (and likely cannot be) known. Blockchain.info and any other website that tells you the network hashrate is extrapolating it from the frequency that blocks ...
Andrew Chow's user avatar
  • 67.4k
7 votes
Accepted

Why is difficulty measured in a hash’s leading zeroes?

The "leading zeros" are a simplification. The difficulty is encoded as a target which is essentially a 256 bit number. Since block hashes are produced by SHA-256, they're also a string of 256 bits. If ...
Murch's user avatar
  • 71.6k
7 votes

How does solving a block work in relation to the first letter/number after the 0's?

The comparison used is numeric These are numbers not strings of characters. You can see this by looking at the code in the 2009 main.cpp of the Bitcoin reference implementation: uint256 ...
RedGrittyBrick's user avatar
7 votes

How does a blockchain relying on PoW verify that a hash is computed using an algorithm and not made up by a human?

Because Everyone can quickly use the transaction data to re-calculate the hash and check that it matches and is less than the target value. Computing the hash is not what takes time, it is altering ...
RedGrittyBrick's user avatar
6 votes

What is "Script Hash" address exactly and how does it work?

I recall some of these transactions and researched them. P2SH was introduced as a soft-fork, meaning old nodes technically didn't have to upgrade - the soft fork could be carried out by a hashrate ...
karimkorun's user avatar
6 votes

What is the approach to calculate an Ethereum address from a 256 bit private key?

Start with the public key bytes (a bytestring of length 64) Of that public key, take the Keccak-256 hash used ubiquitously by Ethereum (make sure you get that right, as the ultimately standardized ...
Steve Waldman's user avatar
6 votes
Accepted

How long does it take to perform a single SHA256?

Simply head over to https://en.bitcoin.it/wiki/Non-specialized_hardware_comparison#CPUs.2FAPUs and look it up. For AMD, the columns nprocs and Mhash/s are important. Divide the latter by the former, ...
UTF-8's user avatar
  • 3,214
6 votes

Why the leading zeros in the desired hash pattern?

The leading zeros are there to control the difficulty of the problem. More zeros mean a lower space of possible solutions and hence harder problems (more hashes to try before you find one that wins).
James Chapman's user avatar
6 votes

Which is the smallest hash that has ever been hashed?

Just for fun I made a program to list all record low hashes starting from block 1 ... Max block count: 773048 Block 1 : 00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048 Block ...
johanpm's user avatar
  • 106

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