hello everyone and welcome to this session of bitcoin mining my name is saurabh and i'm part of the simply learn team so what's in it for us today we need to know what is bitcoin we will understand the underlying technology blockchain so we will talk about that then we will see what are the advantages of bitcoin as compared to other digital currencies and other digital technologies then we will go into the concepts of bitcoin mining then what is bitcoin mining and we will do a demo on certain aspects of bitcoin mining now what is bitcoin bitcoin is the first decentralized digital currency that allows users to transfer money peer-to-peer without any intermediaries like banks governments agents brokers nothing is involved and all this is done using blockchain technology so as we saw in our previous example two parties wants to exchange money transfer money they don't need an intermediary now bitcoin can be used for online purchases e-commerce transactions it can be used as an investment instrument and it can be primarily used for payments to buy goods and services now it was created in 2009 it came into existence by a person or a group of people called satoshi nakamoto now bitcoin helps transferring of assets faster than regular fiat currencies it has definitely lower transaction fees because as it has removed the intermediaries from between the cost of transaction also goes down and it is cryptographically secure it uses cryptography infrastructure and thereby the identities of the sender and the receiver are also secure and entire transaction is cryptographically signed and the users information who are doing the transactions or are part of the networker is also hidden and secure now what are the advantages of bitcoin so it allows fast and quick peer-to-peer transactions it is impossible to counterfeit or hack the transactions which are running on a bitcoin network and it's an overall decentralized process there is no centralized body which is controlling the transactions or charging a fees in order to validate the transaction it is the participants in the decentralized network who are taking care of the sanity of the network thereby making sure that the overall transaction cost is low all the information is accessible to public it is available publicly on a public ledger anyone can go and view the transactions and the volume of the transactions happening on the bitcoin network and it is a low fee transaction it is comparatively low to other mediums and channels through which today digital transactions are made now what is blockchain so bitcoin runs on the underlying technology of blockchain blockchain is a public distributed ledger in which transactions made in bitcoins or any other digital currency are recorded in a chronological order so let's see certain features it is cryptographically secure signed using your private key and then shared on the network with the public key it is immutable any record or any transaction added on the blockchain cannot be modified or altered it is run by a decentralized system there is no centralized authority of the body and the transactions are stored in containers aggregated in containers called blocks so a block is the smallest unit of a blockchain which records all the transaction a basic structure of a block is something like this it has four fields these are the primary attributes for block it has something called as previous hash so the previous hash attribute stores the value of the hash of the previous block and that's how the blocks are linked to each other data this is the aggregated set of transactions which are included in this block so these are the set of transactions which were mined and validated and included in the block nonce so in proof of work consensus algorithm which is used in bitcoin nonce is a random value which is used to vary the output of the hash value so every block is supposed to generate a hash value and nonce is the parameter which is used to generate that hash value and the proof of work is the process of transaction verification done in blockchain now hash is the resultant hash value obtained by passing the previous hash value the data and the nonce through the sha-256 algorithm to generate the hash of this block so this is the digital signature of the block which is generated and this is the basically identity of this block now sha-256 is a cryptographic hash algorithm which produces a unique 256-bit alphanumeric hash value for any given input and that is the unique feature of this cryptographic algorithm whatever input you give it will always produce a 256 bit hash now let's understand the concepts of bitcoin mining what is bitcoin mining bitcoin mining is the process of verifying bitcoin transactions and recording them onto the public blockchain ledger in blockchain the transactions are verified by bitcoin users so basically the transactions have to be verified by none other than the participants of the network those who have the required hardware and computing power and those entities are called miners so we will be talking about them later but the point to be highlighted is that there is nothing like a centralized body as in case of legacy transactions where we used to be dependent on a regulatory or governing body or a bank to make our transactions go through now in bitcoin here any user with mining hardware and internet access can take apart that kind of computer can be a participant and contribute to the mining community process is solved based on a difficult mathematical puzzle called proof of work so every miners job is to solve the mathematical puzzle which is called proof of work in order to validate the transaction and earn the reward and all the miners as they are competing amongst themselves to mine a particular transaction the miner who first solves the puzzle gets the reward now users trying to sell the puzzle as i said are called miners they are the participants in the network who have the necessary hardware and computing power to do all the transactions to validate the transactions and validate it they are called as miners now in order to understand bitcoin mining we need to understand three major concepts of blockchain it is based on distributed public ledger it uses sha-256 encryption algorithm and proof of work is the underlying consensus algorithm for bitcoin mining so distributed public ledger a distributed ledger is a record of all transactions maintained in the blockchain network across the globe in the network the validations of transaction is done by bitcoin users called as miners sha-256 now blockchain prevents unauthorized access by using a hash function called sha-256 to ensure that the blocks are kept secure they are digitally signed their hash value once generated cannot be altered now shk 256 it takes an input string of any size and returns a fixed length 256 bit output value and that is the primary feature of shf 256 encryption algorithm you give any input it will always give you a 256 bit output and it is a one way function you cannot derive the input reversally from the output what you have generated and third is the proof of work in blockchain mining is a process to validate transactions by solving a difficult mathematical puzzle called proof of work now in order to do that the primary objective of the minor is to determine the nonce value and that nonce value is that mathematical puzzle that miners required to solve in order to generate a hash which is less than the target defined by the network for a particular block now in the bitcoin network users trying to solve mathematical puzzle are called as minus now the puzzle is solved by varying a nonce which produces a hash value lower than a predefined condition which is called as the target miners verify the transactions and add the block to the blockchain when confirmed and verified as of today the miners who solve the puzzle gets a reward of 12. 5 bitcoins now once a block is added to the blockchain the bitcoins associated with the transactions can be spent so once the block is validated then the transfer of bitcoins associated with the transactions aggregated in the block the transfers are made then from one account to the another now in order to generate the hash let's see you use the sha-256 hashing algorithm you define the hash value if it is less than the defined condition the target then the puzzle is deemed to be solved and if not then you keep on incrementing nonce value and you repeat the sh-256 hashing function passing on to the nonce value and you define generate the hash value again and you keep doing this process till the time you get the hash value which is less than the target now let's check an example so for example beyonce wants to share 10 bitcoin with jennifer now in order to do that what will be the steps so beyond transaction data is shared with bitcoin users the miners from the memory pool the transaction goes and sits in a memory pool of unmined transactions so in a memory pool set of unmined or unconfirmed transactions wait until they are verified and included in a new block they remain in that unconfirmed transaction pool now miners competing to validate the transaction using proof of work they keep on continuously pulling the unconfirmed transaction pool they pick up those transactions and start validating those transactions they aggregate in a data block and start validating they start solving the puzzle the miner who solves the puzzle first shares his result across the other nodes the other set of miners now once the block has been verified the nonce has been generated then the nodes will start granting their approval if maximum nodes grant their approval the block becomes valid and is added to the blockchain now simultaneously the miner who has solved the puzzle will also receive the reward in the meanwhile which will be of 12. 5 bitcoin which as of today stands at 98k around dollars now the bitcoins the 10 btc for which the transaction was initiated now will get triggered and will get transferred from beyond to jennifer now let's take a look at certain facts in proof of work a predefined condition the target is adjusted for every 2016 block which is approximately every 14 days and an average time to mine a block is 10 minutes so basically the target keeps automatically adjusting itself to keep the block generation within the 10 minute time frame so this is the representation so in order to keep the time frame for block generation within 10 minutes the target keeps on adjusting itself now the difficulty of the puzzle changes the target changes depending on the time it takes to mine a block so this is how a difficulty of a block is being generated it is the hash target of the first block divided by the hash target of the current block so this is the difficulty which is being changed after every 2016 blocks so basically it is very hard to generate the proof of work but it is very easy to verify by the miners so once you have solved the puzzle and you have broadcasted that yes you have earned you have validated a record you have determined the puzzle for other miners it is very easy to verify what you have done and once they give their consensus the majority then the block gets validated and gets added to the blockchain now since the difficulty depends on the hash target its value keep on changing after every 2016 block as i said and as you can see in due course from the day of inception of bitcoin in 2009 till today difficulty has increased exponentially and it has been increasing and thereby the entire effort of mining and the computing power is also increasing so as of what was the resources which were required to do mining in 2009 you require more hashing power more computing power in order to do the mining today now what if someone tries to hack the data so let's see blockchain is a chain of blocks abc now each block has solved a puzzle and generated a hash value of its own which is its identifier now suppose a person tries to tamper a block block b and tries to change the data which is aggregated in the block so if the data of the block will change the hash value which is the digital signature of the block will also change thereby it will corrupt the chain which is subsequent to it basically the blocks ahead of block b will all get dealing because the previous hash value of block c will not remain valid so in order for the hacker to make the entire blockchain valid for the block b which he has changed he has to change the hash value of all the blocks ahead of block b which will require huge huge amount of computing power which will be next to impossible so as you see the results in the following block being invalid so with this whole thing the blockchain is making sure that the entire sequence remains non-hackable and prevent data modification now let's see what are the underlying hardware requirements for bitcoin mining and how the hardware is evolved so in the early days miners used to solve the puzzles using regular processors the controlling processor unit cpus now but it used to take a lot of time for mining though the difficulty levels were low but still it used to take a lot of time now as i said the difficulties never keep on changing and growing so the miners also had to increase the processing power so this discovered that graphical processing units gpus proved to be more efficient than regular cpus so but this also had a drawback of consumption of electricity so any miner who has to calculate the return on investment on the hardware he also has to accommodate the cost of electricity and other resources which are going in in order to do the mining so finally as of today they are using a hardware called asic application specific integrated circuit which was specifically introduced for mining which consumes less power and has a higher computing power and a better hardware for mining so miners are profitable when their cost of resources to mine one block is less than the price of the reward they receive so definitely they have to have the investment less than the reward what they earn so as of today in blockchain miners use their resources to verify a transaction they each time a block is mined new bitcoins are created in the network so the bitcoin total supply is limited it is at 21 million dollars approximately 21 million bitcoin are in supply 17 to 18 million bitcoins have already been mined so only three to four million are left as of today a reward of 12.
5 bitcoin is given to the miner on doing the transaction verification but the bitcoin mining reward goes by the huffing principle the reward given to a miner is half every 210 000 blocks which is approximately every four years so then after that threshold is reached the bitcoin reward will go down to 6. 25 bitcoins so let's take an example of a lottery ticket where your chances of winning is difficult so we are talking about what is bitcoin mining pool your chances of winning the lottery is difficult but in a community if individuals buy multiple lottery tickets and pool their tickets together then this will increase their probability and chances of winning more so suppose you won the lottery then based on the contribution the reward is distributed among all the participants bitcoin mining pool is a similar thing it's a process where multiple nodes share their resources together to mine a block now when a block is solved the miners split the reward equally based on the amount of processing power they have invested so it takes the pool members to generate a final hash value then it checks how much amount of work was contributed by each pool member and as a result the bitcoin reward gets distributed proportionally amongst the participants now let's take a look at a demo on how can you see what is the bitcoin reward now this is a actual block of the bitcoin network as you can see this is a block and this is the block reward 12.