четверг, 30 апреля 2020 г.

Bitcoin mining algorithm explained variation. Bitcoin Mining Explained Like You’re Five: Part 2 – Mechanics | Escape Velocity. Everything you need to know about Bitcoin mining

Bitcoin mining algorithm explained variation. Bitcoin Mining Explained Like You’re Five: Part 2 – Mechanics | Escape Velocity. Everything you need to know about Bitcoin mining



Block hashing algorithm



How Minkng Differs from Bitcoin



How the Bitcoin Blockchain Works



A Spreadsheet Analogy



Imagine a blockchain as a spreadsheet. Everyone has access to the data within each individual cell and saves a copy to their personal computer. The data within the spreadsheet is shared between Bitcoin mining algorithm explained variation people. However, nobody can alter an individual Bitcoin mining algorithm explained variation or change the existing information. In the blockchain world, Bitcoin mining algorithm explained variation call this “immutable”—the inability to change or modify something over time.



Now, imagine you wanted to add a new cell to the spreadsheet. This would require approval from members who have access to the spreadsheet data. Once a majority of the spreadsheet owners approve the new cell, the data would then be added to the main spreadsheet.



Back to Bitcoin



As an aside, you’ll notice us use “Bitcoin” with an uppercase B to refer to the overall blockchain and “bitcoin” with a lowercase b to refer to the Bitcoin network’s cryptocurrency.



Next, let’s apply the above concepts to further understand how the Bitcoin blockchain works. If Alice traded one bitcoin to Bob, that transaction would be recorded in the Bitcoin blockchain ledger. Viewing the ledger would show how much bitcoin was exchanged when the transaction occurred, and the corresponding bitcoin addresses Bitcoin mining algorithm explained variation Alice and Bob Bitcoin mining algorithm explained variation sent and received the transactions.



Bitcoin Miners



Once a transaction has been made, it must be verified by people called miners. When a transaction occurs—such as Alice’s transaction with Bob—it is grouped together in a mathematically protected “block” with other transactions that have happened in the same time frame. Miners then use computers with incredible computing power to solve the block mathematically. The first miners to solve the block and validate bictoin transactions are explainef with bitcoin. This is the only way that bitcoin can be created. Finally, each block is connected to the previously verified block, creating a chain of blocks, hence the name blockchain (we know, super creative).



One more thing that you need to understand about the blockchain is that it is immutable, which means, once the data has been added into a block, it can never (like never ever) be changed. In a practical application, once Alice trades her bitcoin and the transaction is verified, she cannot get it back or cancel the trade. It’s gone. However, explainrd is worth noting that this benefits individuals and businesses that deal with credit card transaction, which aren’t settled until later dates. A malicious individual, using a credit card could purchase an item and then cancel the transaction leaving an individual or business with lost revenue.



Consensus Algorithm



When Alice trades her bitcoin to Bob, the transaction is represented Bitcoin mining algorithm explained variation a block, which needs to be broadcasted to the blockchain network. The blockchain network is comprised of nodes or participants of the network that validate and relay transactions to transmit information.



All nodes are operated voluntarily and are used to verify the correct transactions on the blockchain. Nodes follow consensus rules, which are rules that are agreed upon by the community. A change in the consensus rules requires 95% of the community to approve, which makes it explainee difficult for one group to change the Bitcoin software. Other consensus algorithms require a lower percentage to change the software protocol. Nodes relay block transactions and validations to other nodes so that the network remains updated. Nodes do not mine bitcoin. However, all miners typically run a full node to validate and relay bitcoin transactions effectively. Since both miners and non-miners execute validation and relay by operating nodes, they all participate in the consensus process.



Bitcoin Mining



Bitcoin miners verify legitimate transactions and create new bitcoin as a reward for their work.



A transaction is considered verified once the miner solves a cryptographic (mathematical) puzzle. Bitcoin uses a protocol called proof of work, which has a broad goal to prevent cyber attacks from any single entity or group. More specifically, Bitcoin uses the Secure Hash Algorithm 256 bit (SHA-256). Computer chips can run the SHA-256 algorithm to generate an output, which is referred to as a “hash.” Hashing, the process of creating multiple hashes, is used to solve the mathematical problem, in which the end answer is the known and expected hash value.



A Simplified Example



    To solve the problem, the hash value has to begin with three zeros: “000”The input Bitcoin mining algorithm explained variation varies every number finding a match for a “Solution” It takes 6,518 tries to find a value that has “000” in minlng first three digits.


Solution 1 ———088djldkh2h5h3kjhk24gd5h2h5h3kjhk24gd5kh2h5h



Solution 2 ———73485jfljroi5635h3kjhk24gd5we94ee356h2hkh2h5h



Solution 3 ———d89sdf8sge9nxc894opl8qjroi5635h3kjhk24gd5we94



……



Solution 6517 ———088djldkh2h5h3kjhk24gdjroi5635h3kjhk24gd5we



Solution 6518 ———00088djldkh2h5h3kjhk24gdjhk24gd5h2hk24g4f4



Given the input of “Solution 6518,” any miner could verify that this undeniably akgorithm a hash with three zeros in the first three digits. The first miner to solve this problem would broadcast their answer to the network and be rewarded with bitcoin. The block would then be considered verified, and it would be added to the blockchain. This puzzle is a representation of algorith type of puzzle a Variaiton miner would need to solve and not a real puzzle.



Confirmation Difficulty



A standard Bitcoin block requires millions of hashes to solve the puzzle. In the Bitcoin blockchain, the complexity of the puzzle changes every 2,016 blocks to ensure that the average block confirmation Bitcoin mining algorithm explained variation takes ten minutes. Therefore, it is possible for the problem to become easier to solve if confirmations are consistently taking longer than ten minutes. Although, usually the problems become more challenging to solve, which has made it very expensive and highly time intensive to confirm blocks.



Initially, bitcoin could be mined using consumer-grade computing chips. However, due to this increase in difficulty, bitcoin mining currently requires enormous hashing power, and the industry utilizes application-specific integrated circuit (ASIC) chips. ASICs are customized specifically for bitcoin mining, rather than general-purpose functions. These chips are also incredibly expensive, which has resulted in a select group or pool of miners that dominate the lion’s share of the bitcoin mining activity.



Block by Block



Another important aspect is that each block contains the solved hash from the parent or previous block. Each new block requires the parent block’s hash, ensuring a chronological block order. For instance, block 30’s hash is necessary for block 31. Block 31 cannot exist until Bitcoin mining algorithm explained variation 30 has been verified and added to the blockchain. This guarantees that each block is connected algortihm the way back until the first block, which is commonly referred to as the “genesis block.” To change any single block would require changing every preceding block, simultaneously. Lastly, each block is immutable, which again, means that once a transaction occurs, it cannot be reversed. This further ensures that once added the blocks within the blockchain cannot be Bitcoin mining algorithm explained variation supply of Bitcoin is limited to 21 million bitcoins, which is estimated to occur around the year 2140. The amount of bitcoin rewarded to miners is halved every 210,000 blocks. Therefore, the reward will continue to split until the twenty-one millionth bitcoin is bitcpin at which point miners will only receive transaction fees.



Why Don’t Miners Cheat?



Bitcoin is deeply mininh in cryptography, computer science, Bitcoin mining algorithm explained variation, and various other disciplines. One of those disciplines happens to be game theory, which uses mathematical models to predict how rational players will react when given individual choices or situations. Bitcoin utilizes game theory concepts to incentivize the desired action of miners and users.



Account Options



Cryptocurrency has always been a polarizing issue - and recent debates about how it should be regulated certainly add to the questions over its legitimacy. But with the popularity and supposed potential of Bitcoin mining algorithm explained variation like Bitcoin or Litecoin, surely it's important to know what you're talking about before you knock it (or, for those brave souls, before you invest). 



Litecoin is often seen as the "silver" to Bitcoin's "gold" - a valuable but somewhat lesser alternative. But Litecoin, as the faster transaction version of Bitcoin that actually has a higher cap of how many coins can be mined, is definitely worth looking into. 



But before getting into the brass tacks of Litecoin versus Bitcoin, what actually is Litecoin and Bitcoin? There are no stupid questions here. 



What Is Litecoin?



Just like other cryptocurrencies, Litecoin is a global, digital payment method that uses blockchain technology to transfer and trade "coins." 



Litecoin was originally created in 2011 by former Google (GOOG) - Get Report engineer Charlie Lee, under MIT/X11 lісеnѕеѕ, as a peer-to-peer cryptocurrency. Since the creator of Bitcoin, Satoshi Nakamoto, made the Bitcoin code public, Litecoin is in many ways an extension or variation on Bitcoin since the code was open for modification (read: the Bitcoin code is essentially the foundation of various cryptocurrencies, including Litecoin). For this reason, coins like Litecoin are often referred to as "altcoins." 



However, Litecoin uses a different blockchain, which allows it Bitcoin mining algorithm explained variation have minnig faster transaction or transfer speed. Litecoin uses an algoritnm source software to create and transfer coins, and is decentralized.



Since Litecoin hit the Bitcoin mining algorithm explained variation, its growth has been pretty astounding. According to Forbes, Litecoin hit its peak in December of 2017, sitting at $360.93. At just $4.40 a year before, Litecoin saw an 8200% increase. 



Like most cryptocurrencies, the future of Litecoin bitcoij very much in question, but these digital Bitcoin mining algorithm explained variation are starting to become more widely accepted as payment. 



As of the writing of this article, one Litecoin is worth about $51 U. S. dollars (or, 1 LTC is worth $51 USD). 



What Is Bitcoin?



Bitcoin, to many, is the original cryptocurrency that has (thus far) maintained its status as the most popular. 



Created in 2009 fxplained an unknown individual going by the alias Satoshi Xlgorithm, Bitcoin was designed as an alternative currency that used blockchain technology to supposedly increase safety in financial transactions throughout the network. 



Bitcoin essentially pioneered the cryptocurrency industry by allowing Bitcoin miners to mine and add coins variatiion the public blockchain network. Bitcoin can also now be bought through exchanges, much like a stock can be purchased through the Dow Jones Industrial Average (DOW) - Get Report or the S&P 500 I:GSPC. So, while Bitcoin is essentially a currency, it also kind of operates as a stock (so it's a mixture of a lot of things). 



As of the writing of this article, one Bitcoin is worth about $6,400 U. S. dollars (or, 1 BTC is worth $6,400 USD). 



Litecoin vs. Bitcoin: What's the Difference? 



So, both Litecoin and Bitcoin are cryptocurrencies that share a similar basic structure and rely on crypto networks, but what are the differences between the two? And how do you buy them? 



Algorithm and Mining



One of the principle differences between Litecoin and Bitcoin are their different cryptographic proof-of-work algorithms. 



Bitcoin uses a traditional SHA-256 algorithm, while Litecoin uses an algorithm known as Scrypt. The way these two algorithms affect the difference between Litecoin and Bitcoin is based off of is the speed by which they are able to mine respective coins. 



Litecoin's algorithm is designed to produce about four times as many coins as Bitcoin does - producing one coin every 2.5 minutes (whereas Bitcoin produces one every Bitcoin mining algorithm explained variation minutes). So, the speed of acquisition is really the main difference. 



However, both Litecoin and Bitcoin use algorithms that use computing power to process transactions, which is accomplished by "miners" confirming transactions in their networks with their computing power and receiving coins in exchange. But the speed at which these transactions occur is very Bitcoin mining algorithm explained variation for the respective Litecoin and Bitcoin algorithms. 



Bitcoin's SHA-256 algorithm, famous for being very complex, has been altered over the years by miners, and commonly uses what explaoned called Application-Specific Integrated Circuits (ASICs) - hardware systems that can be customized for mining Bitcoin mining algorithm explained variation. For this reason, Bitcoin's algorithm stresses bitcokn power. However, one critique of Bitcoin's algorithm has been that it is increasingly becoming more difficult for regular users to mine Bitcoin due to its complexity. 



On the other hand, Scrypt, which is used by Litecoin, is generally a more efficient algorithm for mining cryptocurrency due to how it is designed to prevent too much customization with hardware solutions like ASICs. Scrypt, unlike SHA-256, favors high-speed random access memory. For this reason, Litecoin's algorithm makes it Bitcoin mining algorithm explained variation for regular cryptocurrency users to participate in mining without too much complexity. 



Because Scrypt allows regular miners often using CPUs (central processing units) or GPUs (graphics processing units), Litecoin is typically a more easily accessible way to mine Bitcoin mining algorithm explained variation than Bitcoin. 



IEEE Xplore Full-Text PDF:



Block hashing algorithm



Bitcoin mining uses the hashcash proof of work function; the hashcash algorithm requires the following parameters: a service string, a nonce, and a counter. In bitcoin the service string is encoded in the block header data structure, and includes a version field, the hash of the previous block, the root hash of the merkle tree of all transactions in the block, the current time, and the difficulty. Bitcoin stores the nonce in the extraNonce field which is part of the coinbase transaction, which is stored as the left most leaf node in the merkle tree (the coinbase is the special first Bitcoin mining algorithm explained variation in the block). The counter parameter is small at 32-bits so each time it wraps the extraNonce field must be incremented (or otherwise changed) to avoid repeating work. The Bitcoin mining algorithm explained variation of the hashcash algorithm are quite easy to understand and it is described in more detail here. When mining bitcoin, the hashcash algorithm repeatedly hashes the block header while incrementing the counter & extraNonce fields. Incrementing the extraNonce field entails recomputing the merkle tree, as the coinbase transaction is the left most leaf node. The block is also occasionally updated as you are working on it.



A block header contains these fields:



Field Purpose Updated when. Size (Bytes)
VersionBlock version numberYou upgrade Bitcoin mining algorithm explained variation software and it specifies a new version4
HashPrevBlock256-bit hash of the previous block headerA new block comes in32
HashMerkleRoot256-bit hash based on all of the transactions in the blockA transaction is accepted32
TimeCurrent block timestamp as seconds since 1970-01-01T00:00 UTCEvery few seconds4
BitsCurrent target in compact formatThe difficulty is adjusted4
Nonce32-bit number (starts at 0)A hash is tried (increments)4


The body Bitcoin mining algorithm explained variation the block contains the transactions. These are hashed only indirectly through the Merkle root. Because transactions aren't hashed directly, hashing a block with 1 transaction takes exactly the same amount of effort as hashing a block with 10,000 transactions.



The compact format of target is a special kind of floating-point encoding using 3 bytes mantissa, the leading byte as exponent (where only the 5 lowest bits are used) and its base is 256. Most of these fields will be the same for all users. There might be some minor variation in the timestamps. The nonce will usually be different, but it increases in a strictly linear way. "Nonce" starts at 0 and is incremented for each hash. Whenever Nonce overflows (which it does frequently), the Bitcoin mining algorithm explained variation portion of the generation transaction is incremented, which changes the Merkle root.



Moreover, it is extremely unlikely for two people to have the same Merkle root Bitcoin mining algorithm explained variation the first transaction in your block is a generation "sent" to one of Your unique Bitcoin addresses. Since your block is different from everyone else's blocks, you are (nearly) guaranteed to produce different hashes. Every hash you calculate has the same chance of winning as every other hash calculated by the network.



Bitcoin uses: SHA256(SHA256(Block_Header)) but you have to be careful about byte-order.



For example, this python code will calculate the hash of the block with the smallest hash as of June 2011, Block 125552. The header is built from the six fields described above, concatenated together as little-endian values in hex notation:


>>> import hashlib >>> header_hex = ("01000000" + "81cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000" + "e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122b" + "c7f5d74d" + "f2b9441a" + "42a14695") >>> header_bin = header_hex. decode('hex') >>> hash = hashlib. sha256(hashlib. sha256(header_bin).digest()).digest() >>> hash. encode('hex_codec') '1dbd981fe6985776b644b173a4d0385ddc1aa2a829688d1e0000000000000000' >>> hash[::-1].encode('hex_codec') '00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d'

Endianess



Note that the hash, which is a 256-bit number, has lots of leading zero bytes when stored or printed as a big-endian hexadecimal constant, but it has trailing zero bytes when stored or printed in little-endian. For example, if interpreted as a string Bitcoin mining algorithm explained variation the lowest (or start of) the string address keeps lowest significant byte, it is little-endian.



The output of blockexplorer displays the hash values as big-endian numbers; notation for numbers is usual (leading digits are the most significant digits read from left to right).



For another example, here is a version in plain C without any optimization, threading or error checking.



Here is the same example in plain PHP without any optimization.


<? //This reverses and then swaps every other char function SwapOrder($in){ $Split = str_split(strrev($in)); $x=''; for ($i = 0; $i < count($Split); $i+=2) { $x.= $Split[$i+1].$Split[$i]; } return $x; } //makes the littleEndian function littleEndian($value){ return implode (unpack('H*',pack("V*",$value))); } $version = littleEndian(1); $prevBlockHash = SwapOrder('00000000000008a3a41b85b8b29ad444def299fee21793cd8b9e567eab02cd81'); $rootHash = SwapOrder('2b12fcf1b09288fcaff797d71e950e71ae42b91e8bdb2304758dfcffc2b620e3'); $time = littleEndian(1305998791); $bits = littleEndian(440711666); $nonce = littleEndian(2504433986); //concat it all $header_hex = $version. $prevBlockHash. $rootHash. $time. $bits. $nonce; //convert from hex to binary $header_bin = hex2bin($header_hex); //hash it then convert from hex Bitcoin mining algorithm explained variation binary $pass1 = hex2bin( hash('sha256', $header_bin ) ); //Hash it for the seconded time $pass2 = hash('sha256', $pass1); //fix the order $FinalHash = SwapOrder($pass2); echo $FinalHash; ?>

Комментариев нет:

Отправить комментарий