Hot answers tagged

21 votes
Accepted

Won't ASIC miners eventually break SHA-256 encryption?

Another way to look at it is to take a look at a recent block that was mined, for example, block 388368. Looking at this block on blockchain.info, you can see that the hash for this block is: ...
user avatar
  • 687
16 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 ...
user avatar
  • 261
12 votes
Accepted

What is the reasoning behind the choice of 2^256-2^32-977 for the prime on the secp256k1 curve?

Secp256k1 was designed to be a 256-bit size elliptic curve without cofactor and admitting an efficient endomorphism for optimization purposes. The choices of the relevant parameters are derived from ...
user avatar
  • 7,499
11 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/...
user avatar
11 votes
Accepted

checksum = SHA256(SHA256(prefix+data)) - why double hashing?

Satoshi standardized on using double-SHA256 for 32-byte hashes, and SHA256+RIPEMD160 (each once) for 20-byte hashes, presumably because of (likely misguided) concern about certain attacks (like length ...
user avatar
10 votes
Accepted

Visualize Bitcoin Hashing

I got linked this question. I made a tool which includes a component that allows one to simulate mining: http://yogh.io/#mine:last It's not entirely accurate; it doesn't support BIP 34, so the ...
user avatar
  • 116
10 votes
Accepted

Did Satoshi intend to allow midstate computation to speed up hashing?

I think Satoshi was not aware that the hashing routine could be optimized by the use of a midstate when he first created bitcoin. If you look here, you can see that the first version of bitcoin that ...
user avatar
  • 13.7k
9 votes
Accepted

Is the SHA256 value in the bitcoin address wiki accurate?

The problem is that you're treating the pubkey as string data. What you need to do is treat it as raw binary hexadecimal. If you use fileformat.info and calculate it using Binary Hash hex bytes you do ...
user avatar
  • 603
9 votes
Accepted

How to generate a Bitcoin Private Key Checksum

F29E9187 are indeed the first four bytes of the double sha256 of the bytes: 802CF24DBA5FB0A30E26E83B2AC5B9E29E1B161E5C1FA7425E73043362938B982401 In order to check this, you need to compute the ...
user avatar
9 votes

Why does the TXID have 256 bits when Bitcoin's address security is 160-bit?

Security levels First of all, the relation between security level and the number of bits involved is non-trivial, and depends on the sort of attack we're talking about. For what follows, there are ...
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 ...
user avatar
  • 6,208
8 votes
Accepted

Is Bitcoin PoW actually SHA256 + Merkle generation? Or have I misunderstood coinbase/append?

You are correct that effectively Bitcoin PoW involves computing the Merkle root every now and then in addition to the hash grinding. However, this is negligable. Even ignoring nTime rolling, the ...
user avatar
7 votes
Accepted

What are the 3 arguments called in function SHA256?

Let's disect this function call: void sha256(struct sha256 *sha, const void *p, size_t size) First we realize that the return value is void which means the function does not return the sha256 of the ...
user avatar
6 votes
Accepted

What is a midstate? How does using a midstate speed up hashing?

People often talk about SHA256 like it's a single operation, but it isn't. Rather, the input is broken up into 64-byte chunks, and then each chunk is put into a compression function. The state of the ...
user avatar
  • 28.7k
6 votes
Accepted

Does every nonce really have an equal chance of winning?

It's not unevenly distributed. The reason it appears that way in the graphs above is because the x-axis is plotted in logarithmic units. Here's what it looks like in linear units:
user avatar
  • 4,307
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, ...
user avatar
  • 3,154
6 votes
Accepted

What previously existing technologies made Bitcoin possible?

Arvind Narayanan and Jeremy Clark wrote an excellent paper about that: Bitcoin's Academic Pedigree. I recommend reading the paper in full, but the following briefly summarizes the paper's content. ...
user avatar
  • 64.4k
5 votes

How can I convert a SHA256 hash into a Bitcoin base58 private key?

If you don't want to compute the key manually, there's a useful command-line utility for this called bitcoin-tool: $ ./bitcoin-tool \ --input-file <(echo -n 'Hi guys!' | openssl dgst -sha256 -...
user avatar
5 votes

How do you perform double-SHA-256 encoding?

For the second round of sha256, you need to hash the raw binary output from the first round, not the textual version. A sha256 hash is 256 bits, or 32 bytes. Thus for the second round you should be ...
user avatar
5 votes

Why don't any of the SHA-256 vulnerabilities matter for mining?

The attacks are against a "poor man's" version of SHA-256, where less rounds are performed than in the real SHA-256. They are useless for breaking SHA-256 itself, and more so for the double SHA-256 ...
user avatar
5 votes

Does every nonce really have an equal chance of winning?

As you noted, the logarithmic scale skews it right, because the number of nonces within log(10, nonce) > 9 is 3 times larger than log(10, nonce) < 9 The other factor that might skew the nonces ...
user avatar
  • 28.7k
5 votes
Accepted

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

The hash is not alphanumeric, it's hexadecimal, that is base-16. You can convert that to a decimal number. In your case: 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 = ...
user avatar
  • 7,639
5 votes
Accepted

How to compute double sha256 shown in examples of bip 143?

Do this: echo -n $PREV_OUT | xxd -r -p | openssl dgst -sha256 -binary | openssl dgst -sha256 Explanation You want to do this: prevout (raw bytes) -> sha256 -> sha256 -> convert to hex You're ...
user avatar
  • 28.7k
5 votes
Accepted

Which is the smallest hash that has ever been hashed?

The 12 lowest block hashes in Bitcoin, at the time of writing (Dec 16 2017): Block 458091 (00000000000000000000011246f099d94f91628d71c9d75ad2f9a06e2beb7e92) Block 368527 (...
user avatar
5 votes
Accepted

Do pools distribute "jobs" to miners based on "failed" solutions which have already been submitted?

I've read simplistic descriptions of mining as simply incrementing the nonce until a solution is found, but I've also read much more detailed explanations which would imply much more is involved. Even ...
user avatar
  • 62.2k
4 votes
Accepted

Is it computationally feasible to find two transaction IDs with the same first 20 bytes?

Is it computationally feasible to find two transaction IDs with the same first 20 bytes? 20 bytes is still 160 bits of security, which is considered very secure. If you are sure that you only need ...
user avatar
  • 13.7k
4 votes
Accepted

Why is the block header 80 bytes, not 128 bytes (= two SHA-256 blocks)?

It could have been done that way, at the cost of increasing the amount of space it takes to store and send block headers. It seems like block header storage was a big concern for Satoshi, (there's ...
user avatar
  • 28.7k
4 votes
Accepted

Mining for nil-transaction blocks only - gaming the incentive scheme by rogue miners / consortium?

(I'm certain this has been asked before, but I can't find the previous question.) That would be true, except for the presence of the nonce and extraNonce fields. The point of these fields is that you ...
user avatar
  • 28.7k
4 votes
Accepted

How do I calculate the txid of this raw transaction?

TXIDs have two forms; the form used internally for outpoints and merkle leaves (internal byte order), and the form used in RPC calls and block explorers (RPC byte order). These are often called, ...
user avatar
4 votes

Why don't any of the SHA-256 vulnerabilities matter for mining?

Sha256 has no known vulnerabilities as of yet. As Meni Rosenfeld mentioned, the mentioned attacks only concern part of the rounds of Sha256, in order to have an actuall effective attack you'd have to ...
user avatar

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