PHP source code of blockchain mining
In 2009, bencong invented bitcoin, and set that there are only 21 million bitcoins. By participating in the proction of blocks and providing proof of work (POW), he can get the reward of bitcoin network. This process is mining
the concept of "mining" comes from the existing concepts in our real economic life, such as gold mining and silver mining. Because minerals are valuable, it drives people to pay labor to dig
another important point of bitcoin mining is that the miners who participate in mining recognize the value of bitcoin, and some of them are willing to spend money in the bitcoin market. Therefore, the mining of bitcoin is meaningful
extended data
currency characteristics of bitcoin
1, decentralized
bitcoin is the first distributed virtual currency, and the whole network is composed of users without central bank. Decentralization is the guarantee of bitcoin's security and freedom
2, bitcoin can be managed on any computer connected to the Internet. No matter where you are, anyone can dig, buy, sell or collect bitcoin
3, exclusive ownership
controlling bitcoin requires a private key, which can be stored in any storage medium in isolation. No one can get it except the user himself
4, low transaction cost
bitcoin can be remitted free of charge, but in the end, about 1 bitfen transaction fee will be charged for each transaction to ensure faster transaction execution
5, no hidden cost
as a means of payment from a to B, bitcoin has no cumbersome limit of quota and proceres. If you know the other party's bitcoin address, you can pay
6, cross platform mining
users can explore the computing power of different hardware on many platforms
let me analyze it:
1: bitcoin has been broken in China, and its price has dropped sharply, which is unexpected by the global mining pool
2: compared with the current mining cost of bitcoin, it makes money entirely by cheap electricity bills
3: there are only 21 million bitcoins, and most of them have been g up in the early stage, which makes it difficult to dig those bitcoins that have not been g up in the future, and there is too much competition. Many small mines are in a state of loss
and why do many well-known mines turn to TCD
first of all, bitcoin is the optimized and upgraded version of bitcoin, with a constant number of 100 million. The early mining is very good. Unlike bitcoin, which has too high cost and low cost performance ratio, it is appropriate to use bitcoin as a supplement to compare bitcoin. Bitcoin is used for large amount payment and bitcoin is used for small amount payment.
Yes
use PHP code to define blocks:
class block {
public $prevhash
public $hash;
public $timeStamp;
public $data;
}
prevhash: the hash value of the previous block; Hash: hash value of the current block; Timestamp: the time stamp generated by the block; Data: data stored in the block; The fields prevhash, hash and timestamp are called block headers in the blockchain, and the hash value of the block is calculated by SHA-256 algorithm
extended data
the practical use and significance of blockchain:
blockchain is a decentralized distributed ledger. What is decentralization? There is no center, or everyone can be a center. This is different from the traditional way of centralization. Distributed ledger means that the storage of data is not only on each node, but each node will and share the data of the whole ledger
In addition, blockchain has the characteristics of disintermediation and information transparency. For example, for example, when we shop on Taobao, after we place the order, the cost we pay is first hit in Alipay. After we receive the courier and confirm the receipt, the money will be transferred to the seller's account. In the blockchain, buyers and sellers can trade directly without any platform as a third-party certification authoritythe system will broadcast the transaction information of both parties. All hosts will record and back up the transaction data after receiving the information. If the order of one machine is wrong, the backup data of other machines will not be affected