Hot answers tagged

44

They try to find a random nonce (a little random data) that goes into a block and makes the block have a (SHA256) hash that (in binary) starts with a certain amount of 0's. The more zeroes the more rare hash is. A good hash' outcome is not predictable, and so you have to try a lot of times to find a good nonce. The amount of zeroes are based on how ...


21

The hashrate can be calculated from the expected rate of finding a block (144 a day), the actual rate of finding a block and the current difficulty. So let's calculate the average hash_rate for a single day: expected_blocks = 144 difficulty = 11187257.461361 # this is on May 22nd 2013 blocks_found = 155 # Also May 22nd 2013 hash_rate = (blocks_found/...


16

(If I may repeat myself a bit...) Mining is like having a lot of people throwing weighted coins (such that 1 millionth of the time it comes up heads) and telling you when they hit a heads. If one such "heads" is reported every 10 minutes (600 seconds), you can make a very accurate estimation of how many times per second the coins are being flipped. In this ...


16

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 the leaves. Clearly when a commutative operation is used, [A,B,C,D] and [D,C,A,B] will hash to the same thing. This is not a problem if the Merkle root is ...


15

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 second call. This is easy to see as having hash(x) == hash(y) implies hash(hash(x)) == hash(hash(y)). If you really wanted to guard against this, you would do ...


15

How to calculate the target from bits Let's start with a block-header, always 80-bytes that looks like this: 04000000b9e2784a84e5d2468cee60ad14e08d0fee5dda49a37148040000000000000000e9dd2b13157508891880ef68729a1e5ecdde58062ebfa214a89f0141e5a4717faefd2b577627061880564bec From the 80-bytes, the bits are actually the 72nd to 76th byte: ...


13

The important thing here is, that every mining pool/solo miner is working on a different input: They have different coinbase transactions and are working on different sets of transactions. Further entropy can be added by changing the nonce and extra-nonce, by adding another transaction, or by changing the order of the transactions. While there can be block ...


13

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" as a key into a data structure or database table. In this sense, the hash is a pointer/key used to retrieve the information you are looking for. For example, ...


13

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. However, when we consider block hash collisions to be a realistic situation, there is another issue that may arise: If two blocks with the same hash and the same ...


12

The wiki answers this. TLDR: to prevent against birthday attacks. Bitcoin is using two hash iterations (denoted SHA256^2 ie "SHA256 function squared") and the reason for this relates to a partial attack on the smaller but related SHA1 hash. SHA1's resistance to birthday attacks has been partially broken as of 2005 in O(2^64) vs the design O(2^80). While ...


11

Assume for a second that we found a proof of work algorithm that had all of the good properties of sha256, but was also useful for SETI and maintaining world peace. Now suppose a group of miners collectively have more than 51% of the hashing power. In which of the following scenarios are they more likely to collude to double spend via a 51% attack: A) When ...


11

These charts show the approximate network hash rate on the left axis: http://bitcoin.sipa.be/ We know the network adjusts for 25 new bitcoins per 10 minutes. Together this provides enough info to give an approximate answer to your question: hashes per bitcoin = (network hash rate) / (25 BTC per 10 minutes) = (180 * Th / s) / (25 * BTC / (600 * s) ) = ...


11

note: what Nils Schneider calls 'z', i call 'm'. this gist implements all this: https://gist.github.com/nlitsme/dda36eeef541de37d996 the calculation ecdsa signing is done as follows: given a message 'm', a sign-secret 'k', a private key 'x' R = G*k (elliptic curve scalar multiplication) r = xcoordinate(R) s = (m + x * r) / k (mod q) q = the ...


10

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/56797: SHA-256(SHA-256(x)) was proposed by Ferguson and Schneier in their excellent book "Practical Cryptography" (later updated by Ferguson, Schneier, and ...


10

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 block height is not reflected in the coinbase tx, and it's still got some bugs. Currently in alpha. But it can give you some pointers. It'll construct a block on ...


9

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 formatted data. If you don't know how to do those things, then please google them first before reading this post. Also, this post will be very long, and ...


8

The network hash rate can be statistically inferred from the difficulty and the rate at which blocks are found. It's just a more complex version of the fact that if you know that someone is flipping coins and heads comes up 800 times an hour, they're flipping about 1,600 coins an hour.


8

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 secure timestamping of digitaldocuments, rather than a digital money scheme." (BaCT p.15) The chaining of Merkle trees instead of single documents was proposed in ...


8

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 produces a stream of bytes. Only when you display that bunch of bytes on your screen it's common for it to be in hexadecimal (containing "alphanumeric" ...


8

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 the block. As any two miners will have a different address they want their payout to, their coinbase transactions will be different. If the coinbase ...


8

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 explorers like blockchain.info usually expect big-endian for block hashes. The proof-of-work requirement means that the most significant bits have to be zero, ...


8

The bolded byte in the following raw transaction is the number of outputs (two in this transaction): ...


8

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 Grover's algorithm. Which components of the bitcoin blockchain would be exposed to quantum attacks? The security of SHA256 would be halved, ECDSA would be ...


8

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., the 1s, 10s, and 100s places). Using this simple hash, 5 would hash to 005, and 123,456 would hash to 456. A Bitcoin block contains a handful of fields (...


7

No, the SHA2 hashing function is not vulnerable to any known attack that significantly reduces the difficulty of finding a block, but it is a highly random process. Randomness is funny sometimes. Statistically it it works out to be even over a longer time period or larger population, but if you focus in on a small set of samples sometimes you see a cluster ...


7

Bitcoin uses the Elliptic Curve Digital Signature Algorithm (ECDSA). Your private key is used to create the signature and your public key is used to verify the signature. This allows anybody to verify your signature as long as they have your public key. For more detailed information: Digital Signature Algorithm and Elliptic Curve DSA


7

Miners task is to find a hash below a target T. Obviously if T is smaller, its more difficult to find the hash number. Difficulty D is defined by: D = Tmax/T where Tmax is: 2^224 The probability of finding the hash is: P = T/2^256 which is equal to 1/D2^32 So if you can make h number of hashes in t time, the probability of finding the target hash is: P =...


7

This is a known bug in the early days of bitcoin. Was fixed by BIP-30 https://github.com/bitcoin/bips/blob/master/bip-0030.mediawiki There is a discussion here: https://bitcointalk.org/index.php?topic=216938 And yes, 50+50 bitcoins are missed forever. In fact, there are much more missed bitcoins. For example, 2500 bitcoins were gone to nowhere in block ...


7

No, you can't. And this has nothing to do with the operating system. Your hardware has a bitcoin ASIC chip made only for doing Sha-256 calculations. Litecoin uses the Scrypt algorithm. Sha-256 and Scrypt are not the same, so what you are suggesting is impossible. You can mine other Sha-256 coins instead of Bitcoin.


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