Bitcoin Mining in 4 Minutes – Computerphile

How do Bitcoin miners mine?

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

we’ve sat here and watched Beast churn through billions of password hashes –

How hard can it be to come up with this number?

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….

Leave a Reply

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