Bitcoin Mining in 4 Minutes – Computerphile


Sean>How do Bitcoin miners mine? Mike>There’s no actual digging involved. Think back to our video on hashing – so a hash function
takes a message of any length and returns a fixed length hash which
hopefully looks quite random right so if you change even a little bit of your
message the whole hash changes, so this is how Bitcoin mining works right in
brief… So we have a block and at the top of the block is the hash of the previous
block and a number right which we’re going to call our nonce this is a number
we’re making up let’s start at 1 and go up and then here we’ve got all the
transactions so transactions – one of which will give me some bitcoins because
I’m the miner. The way this works is I start with a random number here and then
I hash this entire thing and I get a hash out the bottom here. To mine
successfully this hash needs to be very very small so let’s say for example it
has ten leading zeros as an example if I successfully pick a number where when I
hash this entire thing including the number it has ten leading zeros I’ve
successfully mined that Bitcoin. Now that’s quite unlikely you’ve got to
think that each zero & one has a roughly 50% chance of being a one so to get one
leading zero it’s going to be about 50% of the time two leading zeros about 25%
of the time and so on the more leading zeros we require the harder this process
is. So it doesn’t happen yeah the first time I pick a one I hash it and it
doesn’t work so what I do is I go to 2 and I hash it again and I get a
totally different hash which maybe has a different number of leading zeroes and I
go “does this does this work?” no, ok so 3, 4 5, 6, 7, 8, 9, 10 and so on and I just keep
churning away with these random numbers in this “nonce” field here incorporating
any transactions I’ve received in the meantime until I get this kind of golden
hash that I’ve been looking for which is very very small so lets say 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 some numbers say 1 0 1 1 and something like
that right now this is sha-256 in the case of Bitcoin
so it’s 256 bits long now as soon as I’ve done that I go well brilliant I’ve got
some bitcoins i transmit this to the network and everyone sees this and goes
cool and then they take this hash and they put it in the next block and start
mining on that one as well with new random numbers
so every time someone stumbles across a hash which is small enough that’s when
they’ve mined the Bitcoin right and so that’s how the difficulty of a network
is changed – you just change the threshold of number of zeros or size of
your hash that you need to be below in order to be successful every couple of
thousand blocks the network will look at how long it took and if like a bunch
more miners have appeared so it’s actually starting to get a little bit
too easy they’ll they’ll increase this difficulty
such that hopefully a Bitcoin is mined roughly every ten minutes
now of course this process is random so it might be less, might be more but on
average… If a bunch of miners disappeared
suddenly it’s taking 50 minutes to mine a Bitcoin (Block?) they’ll just reduce this
threshold so that you can mine that little bit more easily. The number of
bitcoins that a miner is awarded is halved every so often as well – so I think is it
at 12.5 at the moment so I will have sort of plus 12.5 for Mike in here as
sort of my benefit of being the miner so this will only ever get actually put
into the blockchain if I’m the one that finds this hash otherwise unfortunately
it’ll be someone else’s name in here Sean>we’ve sat here and watched Beast churn
through billions of password hashes – How hard can it be to come up with this
number? Mike>As hard as they need it to be you’ve got to think that for all the
miners on earth at least a lot of them have got dedicated hardware many
trillions of hashes and they’re still only doing it every 10 minutes right
it’s not easy to do and they can just keep making this more
difficult until it takes about ten minutes. In some ways you can’t make the problem more easy by buying more and more hardware because it will just make
itself more difficult for you. For now most of my contact with it is via a terminal and I ask it to do things it does them very, very fast. This particular
server has four Titan X graphics cards in it a Titan X is one of the foremost
graphics cards there are new….

100 thoughts on “Bitcoin Mining in 4 Minutes – Computerphile”

  1. That last part about, scaling up the hardware being counterproductive was something I didn't realize. Great video

  2. Millions of machines working on the same problem and the result is still just 10 minute blocks. This is why Proof of Work is so stupid and will ultimately be replaced.

  3. "If you add more hardware, you are only making it harder on yourself"

    If there's 100 miners in the world with equal hardware then each of them will get (on average) one bitcoin every 1,000 minutes.
    If you then add 100 more hardware on your own. Each piece of hardware will get one bitcoin every 2,000 minutes. Except you are now gaining 50% of all bitcoins mined so you would see one for yourself every 20 minutes. Or am i missing something here?

    Either way, if bitcoin mining wasn't a profitable venture then no one would be doing it. And having MORE capacity than the competition automatically means you get MORE bitcoins. In the early days, there were miners that made millions of dollars worth of bitcoins before the rest of the world caught up with their mining hardware.

  4. Isn't there a threshold at which point it can't be made any harder? That is, when the requirement is for the hash to either equal 0 or 1, the only way to increase the difficulty would be to completely change the system to a new hashing algorithm with more bits in the output, right?

  5. I'm being picky but 2:39 – A bitcoin isn't mined every 10 minutes, a block is. Which at the moment is 12.5 BTC as Mike goes on to say.

  6. is it all based on an assumption that hash function for bitcoin is kept secret, or did I miss the whole point of explanation?

  7. I can see a flaw with bit coins based on the refresh rates. if enough miners go offline for it to say it's too difficult for current miners then the refresh rate comes around to lower it and to time that jump into it you can flood the easy to get bit coins then turn off the program saving energy and mine more coins this way before the system say ok too easy time to raise the difficulty.

  8. So, you're telling us that, it has a horribly horrible efficiency, and that it is harder and harder to mine these?
    This is just wasting hardware for nothing!

  9. Are there any particular strategies used to determine which nonces to attempt hashing with? Or do they just rely on repeatedly "randomly" assigning a nonce and trying it?

  10. So mining these looks like a complete waste of energy, but my question is are there any ways that are based on more useful distributed computing, like [email protected] for disease research, Climateprediction.net for trying to predict climate, or even stuff like finding big primes, or anything remotely useful in any way?

  11. What's the method of letting all others miners know that you've hashed a block? I'm curious because one thing I haven't seen explained is that it's a distributed system so everyone needs a copy of the blockchain to start hashing the next block, but once a block is hashed how is that sent out to every other miner out there so they know the blockchain is updated? Also, if 2 miners successfully mine a block at the same time, does it become a race condition to see who can update their block into everyones chain the fastest or how does it work?

  12. How can be sure that, changing only the nonce, we can obtain the hash with a certain number of leading zero?

  13. Am I getting this right: The miners just guess different numbers until one is right (=produces hash with enough preceeding 0s to be under the threshold)? And that's why mining rigs need to be so powerful, in order to try random numbers faster?

  14. I really love Mike Pound's presentation and am very pleased with the recent series of uploads of his content on this channel.
    You inspire me greatly as i start my college journey, thank you for going through all the trouble that goes into making all this wonderful content, Mike. Also i cannot express gratitude toward the content on these channels without mentioning Brady Haran. You're the man.

  15. That's not true. Yes, increasing the hardware you use increases the difficulty, but it does so for everyone; therefore adding more hardware does in fact allow you to mine more bitcoins than others relatively speaking as even those who have not added more hardware must still compete at the same increased difficulty as the one who has added more hardware. Your mining rate will stay the same while everyone else's mining rate will decrease somewhat. The blocks will still take 10 minutes, but those who have not upgraded their hardware will not successfully complete as many hashes.

    Tl;Dr adding more hardware does allow you to mine (relatively) faster and more efficiently than others despite the fact that more hardware increases the difficulty of the hashes.

  16. Before watching the video If it's the guy who that hates on bitcoin i'm gonna be slightly annoyed.

    Edit: I was not annoyed this guy is a nice guy without the bitcoin bias 🙂

  17. There is a very high chance that no valid hash is produced even after testing all 2^32 nonces, so other parts of the block header are also mutated to increase the parameter space. Typically the timestamp is jittered, or the merkle tree is altered in different ways to change the merkle root.

  18. I think it's easier to get how or what bitcoin is by explaining the process it uses. But no one can explain how or why bitcoin has a monetary value.

  19. As always, I recommend watching 3blue1brown's video on blockchains and cryptocurrencies if you want to learn more about all this stuff. His videos are great, and this one is amazing!

  20. This might be splitting hairs, but the difficulty is actually based not on "number of leading zeros", but rather on the magnitude of the hash being less than some fairly small number, though that is approximated by number of leading zeros.

    While I'm at it, I'll mention that (at least in the BTC version of Bitcoin) the difficulty adjustment is performed once every 2,016 blocks, which at 10 minutes per block (the target) is exactly 2 weeks. In reality, it may be slightly more or less; more often less as hashpower has tended to increase. Similar with the block reward: it is halved once every 210,000 blocks, which should be slightly less than 4 years, but has ended up being significantly less (as in, by months), due to increasing hashpower keeping the average block time slightly below 10 minutes.

  21. I've made so much trading that mining now seems too stressful and unrewarding for me. I'd rather just stick to the trade, even if half the time im not really sure whats happening, ive got a genius of a trader and i have no worries. the most important thing to me is cashing out weekly, and easily too.

  22. So people solve man-made puzzles (by cheating with computers) that let you keep the solutions as prizes, but make the solution harder to get the harder you try. And the solution to the puzzle can be swapped for real money. Sounds crazy. Whose idea was this?

  23. Once again oversimplified, the previousBlockHash, merkleTreeHash, Nonce, Bits, Timestamp, Version are the fields used in creating the block hash. They are concatenated in a specific order in little-endian before being double hashed. The transaction ID's are used which are hashes of the raw transactions that are used to create the mekleTreeHash. This merkleRootHash is then incorporated into the block hash as one of the fields. The transactions ID's are structured into a merkle tree which is a binary tree with all the leaf nodes containing transactionID hashes and the root node containing a single hash which is made up of all its child node hashes which are of the format parentHash = hash(childHASH + childHASH). This hashing process bubbles to the merkleRootHash, any change in any of the transaction IDs used as leaves produces an avalanche affect and completely changes the resulting merkleRootHash. This property provides the blockchain with data integrity. This is in itself a simplified explanation, yet it is more transparent then how the banking industry magically manifests money.

  24. Can the mining of bitcoins (and any other concurrency) contribute to building a huge rainbow table of the hash function (SHA256 for bitcoin)?

    So every time you compute a hash, regardless of mining a block or not, you store that information (i.e. associate the hash with whatever blob of data that make up the (either successful or failed) block). I suppose the problem is that you won't have enough storage, but this is in theory possible right?

  25. Cryptocrap may be the finest system for creating waste heat ever conceived. I can only assume that buttcoiners are huge fans of entropy, and just want to do their part to bring about universal heat death that much sooner.

  26. Hopefully all miners will die soon….I CAN NOT BUY A GRAPHICS CARD FOR GAMING BECAUSE OF THESE SHITHEADS

  27. i was an enthusiast for bitcoin but now i see how much energy must be spent in order to fight back 51% share in mining power of huge farms. There should be some kind of limitations to avoid this both waste and danger of being hacked

  28. And here I thought this was all at least benefiting SOME scientific calculation or SOMETHING… This whole ordeal makes less and less sense the more I hear about it and the urge to strangle people who waste resources for this is getting higher and higher.

  29. Okay, so they can bring it down to make it faster. What would a crypto-currency system look like that could handle all the Credit Cards and get a hash in under 5 seconds? Would the store just have local credit for your identity and then update their accounts every 10 minutes or so? I always suspected that Bitcoin couldn't handle all the transactions that take place on the whole planet. Of course it doesn't work when technology fails in a disaster, so physical currency will always have that one advantage.

  30. If it's automatically making itself harder, is there a point to all of this??

    I thought bit mining was auto solving complex problems, and you were rewarded with bit coins. Much like a regular job

  31. By "they" he mean bitcoin fully validating nodes.
    Which means any machine running a software compatible with cosnensus like Bitcoin core or Bitcoin knots.

  32. but where does the mined bitcoin comes from? are you stealing from a random person and adding a transfer from this person to you?

  33. So everyone starts to try to solve the hash from the #=1 and then just +1? Or do people start at different offsets, e.g. one starts at 200, another at 4030 etc.?

  34. Great video! I have two questions though: Is every miner working on the same block of transactions at the same time? What happens if two miners hash the same block successfully at the same time (I know this is highly unlikely to say the least) ?

  35. What happens to the network when in reaches the last satoshi? Since there will be basically no point of mining bitcoin- who will keep the network operational?

  36. But what benefit has that little hash? Is the 000000000101010101 hash magical or what? It makes gold from lead and wine from water, doesn't it?

  37. So if i want to give my 1 Bitcoin to John, i have to put this transaction in a network and wait until someone mine a new bitcoin and then my transaction is verified within the blockchain? Does it mean that block, which is currently mined, is constantly changing due to people adding new transactions in a network? What if someone mines a bitcoin and the block he mined doesnt have all the transactions included? Should i always be connected to the network during the mining process to gain all the information about transactions?

  38. How does varying the complexity of the hash make BitCoin more useful or secure compare to a crypto that doesn't do this? Why not use the least computation possible to guarantee the security of each block? How do we know that BitCoin isn't a con to make people believe they're doing something useful with their computers?
    The value of a conventional currency lies not in it's creation, but that in order to enter circulation it has to be lent as debt to someone who is creating a new asset. This should tally the total money in circulation with the sum value of all assets. Crypos violate this idea. New crypto "money" is created but there are no new assets created.
    Some people claim crypos aren't a currency, but are an asset themself. But assets aren't valued equally by everyone, hence there is a market to attempt to obtain the highest value. To be tradable with any asset, a currency unit must be equally valued by everyone, otherwise it's barter.
    But if crypos are an asset, what component is their lasting value? Bitcoin mining is a service: once a block is mined, the value of the mining is consumed. No one will trade for a service which is already done / or used up since it has no future potential use.

  39. so if i use my dual pentim 3 server i would not be any better off than my dual xeon x5690 server?

  40. Best brief explanation of Bitcoin mining I've seen so far, and I've seen quite a few. Brilliant explanation. Thanks Dr Pound and Computerphile!

  41. Same situation as many others. I invested USD$11,000 into Fasua Chong Mining Blc ( Google them) and whilst BTC was performing well, my payouts were consistent. I still have a running contract and I keep reinvesting with them. With over $100,000 investment with Fasua Chong so far, I am being paid over $11,000 weekly in profit after management fees.

Leave a Reply

Your email address will not be published. Required fields are marked *