Bitcoin packaged successfully
public key system: corresponds to a public key and a private key, keeps the private key in the application and publishes the public key. When Party A transmits information to Party B, it can use Party A's private key to encrypt the information, and Party B can use Party A's public key to decrypt the information, so as to ensure that the third party cannot impersonate Party A to send the information; At the same time, when Party A transmits information to Party B, it is encrypted with Party B's public key and sent to Party B, and then Party B decrypts it with his own private key, so as to ensure that the third party cannot eavesdrop on the communication between the two people. RSA is the most common public key system, but the lliptic curve digital signature algorithm is used in bitcoin protocol. What's the difference between cash and bank account? Bitcoin is an electronic currency in BTC. In this article, it is also used to refer to the whole bitcoin system. Like opening an account in a bank, the corresponding concept in bitcoin is address. Everyone can have one or more bitcoin addresses, which are used to pay and collect money. Each address is a string that starts with 1. For example, I have two bitcoin accounts, and. A bitcoin account is uniquely determined by a pair of public key and private key. To save the account, you only need to save the private key file. Unlike bank accounts, banks keep all transaction records and maintain the book balance of each account, while bitcoin's transaction records are jointly maintained by the whole P2P network through a pre agreed protocol. How much money is in my account address? Although the current account balance can be seen by bitcoin software, unlike banks, there is no place to maintain the book balance of each address. It can only calculate the account balance in real time through all historical transactions. How do I pay? When I pay from address a to address B of the other party, the payment amount is e. at this time, both parties will announce the transaction information to each network node, telling address a to pay to address B, and the payment amount is e. In order to prevent the third party from forging the transaction information, the transaction information will be encrypted with the private key of address A. at this time, the network node receiving the transaction information can use the public key of address a to verify that the transaction information is indeed sent by address a. Of course, trading software will help us do these things, we just need to input the relevant parameters in the software. What will the network node do after receiving the transaction information? This is the most important part of the bitcoin system, which needs to be elaborated. For the sake of simplicity, only bitcoin protocol has been implemented. In the current version, each network node will save all transaction information synchronously. There are two kinds of transaction information in history, one is & quot; Verified & quot; The transaction information, that is, the verified transaction information, is stored in a series of "blocks". Each & quot; block" Is the previous & quot; bock" The ID of each block is the hash code of the hash code of the block and the new transaction information (see an actual block). The other category refers to those who also & quot; Unverified & quot; The transaction information just paid above belongs to this category. When a network node receives new unverified transaction information (possibly more than one), it can calculate the book balance of each address at that time because the node keeps all the transaction information in history, so it can calculate whether the transaction information is valid, that is, whether there is enough balance in the payment account. After eliminating the invalid transaction information, it first takes out the last & quot; block" Then, the unverified transaction information is combined with the ID, and a verification code is added to form a new "block". It needs a lot of calculation to build a new block, because it needs to calculate the verification code, so that the above combination becomes a block, that is, the first several bits of the hash code of the block are 1. At present, the first 13 bits need to be 1 (generally, the specific method is uncertain), which means that if the block is generated by enumeration method, the average number of enumerations is 16 ^ 13. Using CPU resources to generate a block is called "gold mining", because the proction of the block will get a certain reward, and the reward information has been included in the block. When a network node generates a new block, it will broadcast to other network nodes. However, this network block may not be accepted by the network, because it is possible that other network nodes have proced the block earlier. Only the earliest block or the block with the largest number of subsequent blocks is valid, and the remaining blocks are no longer used as the initial blocks of the next block. How does the other party confirm that the payment is successful? When the payment information is distributed to the network node, the network node begins to calculate whether the transaction is valid (that is, whether the account balance is enough to pay), and attempts to generate blocks containing the transaction information. When six blocks (one direct block and five subsequent blocks) contain the transaction information, the transaction information is considered "verified", so that the transaction is formally confirmed, and the other party can confirm the successful payment. A possible problem is that I will pay the balance of address a to address B, and at the same time pay to address C. If I only verify that the single comparison transaction is valid. At this point, my way of cheating is to generate six blocks including B to B and six blocks including C to C before the truth is revealed. Because I need a very long CPU time to generate a block, compared with the whole network, the probability of my cheating success is very small. What is the motivation of network nodes to proce blocks? As can be seen from the above description, in order to make the transaction information effective, the network node needs to generate 1 and 5 subsequent blocks to contain the transaction information, and such block generation is very CPU intensive. How to let other network nodes help to proce blocks as soon as possible? The answer is very simple. The agreement stipulates that BTC will be rewarded for the address where the block is proced, as well as the Commission promised by both parties. At present, the reward for procing a block is 50btc, which will be halved every four years in the future. For example, the reward will be 25btc from 2013 to 2016. Is the transaction anonymous? Yes, and No. All bitcoin transactions are visible. We can check all transaction records of each account, such as mine. But what's different from the banking monetary system is that everyone's account itself is anonymous, and everyone can open many accounts. In general, anonymity is not as good as it claims. But bitcoin has another advantage in doing black market trading: it can't be frozen. Even if the police trace a bitcoin address, there is nothing they can do unless they trace the computer used by the exchange based on the Internet address. How to ensure that bitcoin does not depreciate? Generally speaking, in the case of equivalent trading activities, the value of money is inversely proportional to the amount of money issued. Unlike the traditional money market, the central bank can determine the amount of money issued. Bitcoin does not have a central issuing institution. Only by procing blocks can we get a certain amount of BTC currency. Therefore, bitcoin's new amount of money depends on: 1. The speed of procing blocks: bitcoin's agreement stipulates that the difficulty of procing blocks is fixed at an average of 2016 every two weeks, about 10 minutes. Moore's law of doubling CPU speed every 18 months will not speed up the proction of block. 2. The number of rewards for block proction: at present, 50 BTC is awarded for each block proced, which is halved every four years. In 2013, 25 BTC is awarded, and in 2017, 12.5 BTC is awarded. Considering the above two factors, bitcoin's currency issuing speed is not controlled by any single node in the network. Its protocol makes the currency stock known in advance, and the maximum stock is only 21 million BTC
When bitcoin nodes connect with each other, they will get transactions they don't have from each other. But because bitcoin has accumulated a large number of transactions for a long time, it is very difficult for two nodes to compare which transactions you are missing / which transactions I am missing one by one
to solve this problem, Nakamoto Tsung invented the important technology of block chain. Nodes use blocks to synchronize transactions, which ensures the data consistency of all nodes, and ensures the uniqueness of the blockchain by competing for block packing rights (that is, mining)
① a block and blockchain
a packet formed by a transaction over a period of time is called a block. On average, bitcoin generates a block every 10 minutes, and each block is linked to the previous block to form a blockchain
② the transaction data is synchronized with the block as a unit
the block is numbered from 1, so after node a connects with node B, it is convenient to synchronize the transaction data as long as the block number height of both parties is checked. For example, if node A's own block height is 100 and node B's block height is 110, all it needs to do is request B to synchronize the 10 blocks 101-110<
③ reward for packed blocks
in order to ensure that there are nodes to pack bitcoin transactions, bitcoin rules stipulate that nodes of packed transactions will receive bitcoin as reward
A. part of the package reward comes from the transaction fee paid by the transaction creator (100-1000 transaction fee per KB)
B. the other part comes from the initial distribution of 21 million bitcoins. At the beginning, the reward is 50 bitcoins for each block. After that, the reward will be halved for every 210000 blocks (about four years). Until about 2140, the reward for each block is less than 1, and the total reward for each block is 21 million bitcoins, This is the source of the total amount of 21 million bitcoins (2099999.97690000 to be exact)
after 2140, the package reward will only come from the transaction fee paid by the transaction creator<
④ competition for block packing right
node packing transaction only needs to consume very low-cost network and computing resources. The existence of packing reward (at present, the packing reward for each block is 25 bitcoin, about 40000 yuan), makes a large number of nodes want to pack transactions. In order to ensure the uniqueness of the blockchain, bitcoin rules stipulate that nodes use a method similar to "coin tossing" to compete for the right of transaction packaging. Nodes constantly toss coins. Whoever first throws the results that meet the rules will get the right to pack the transaction in this block, as well as the package reward of this block
there are two ways to trade bitcoin, one is spot trading, also known as currency trading, which requires the purchase of usdt (omnilayer protocol based digital assets released on bitcoin blockchain), and then the purchase of spot, and the other is futures trading. the futures trading is divided into delivery contract trading, which is generally a weekly contract, Next week contracts, quarterly contracts and perpetual contracts
6, when I successfully transfer my bitcoin recharge to the trading platform, I can sell my bitcoin on the trading platform. On the trading platform, click the "sell bitcoin" option under the trading column
7. Then select the type of order to sell, the quantity of bitcoin to sell, and click the "next order" button to continue
Similarly, the record of selling bitcoin can also be seen in the transaction query under the transaction column9, when the transaction is successful, you can withdraw RMB to your bank card. Under account management on the left side of the page, click "RMB withdrawal", and then fill in according to the required format in the right pane. Finally, click the "withdraw" button strong>
1. I now have a 100 yuan personal name coin in my hand Bitcoin)
2.. Who cares about the official account? But you need to guess the number of the money in the comments Mining, random filling, numerical solution)
try your best to guess, and you get 100 yuan in full - personal mining
pay money to gather some people to guess together - mining field
gather people you don't know to guess together, and allocate the 100 yuan in proportion through the number of guesses -
the above is a simple example of analogy, of course, You followed and guessed the number of 100 yuan in my pocket, I promise you
so what's going on with bitcoin mining
for commercial reprint, please contact the author for authorization, and for non-commercial reprint, please indicate the source
when Zhang San wants to transfer 1000 yuan to Li Si's B account through a account: ① Zhang San roars: attention, I use a account to transfer 1000 yuan to Li Si's B account. ② The villagers near Zhang San listened to Zhang San's voice and checked whether Zhang San's a account had enough balance. ③ After passing the inspection, the villagers write on their account books: account a transfers 1000 yuan to account B, and modify the balance: account a balance = 3000-1000 = 2000 yuan, account B balance = 2000 + 1000 = 3000 yuan. ④ The villagers near Zhang San told the villagers far away about the transfer, and passed it on until everyone knew about the transfer, so as to ensure the consistency of everyone's account books. Smart if you must have found out, in step 2, if Zhang San roars, and the villagers nearby pretend not to hear him, and do not check the account, then the system will stop working? In order to solve this problem, the village decided after discussion that whoever first confirmed Zhang San's voice would get 500 yuan. So everyone put up their ears and monitored every movement in the village. It's really a matter of grass and trees. Someone in the comment area asked, where did the 500 yuan come from? I would like to give a brief answer here. 1. On average, bitcoin generates a block every 10 minutes. The number of transactions that can be packaged in this block is limited. Let's count it as 800. However, absenteeism will not give you a package deal and broadcast for no reason, so you need to charge a handling fee. Moreover, because there are many people in the transaction, whose transaction to pack first also depends on the level of handling charges. So you can see that bitcoin is hot now, and the handling charges are going up. 2. We all know that the total number of bitcoin is 21 million, and the issuing mechanism is decreasing year by year. If absenteeism is the first one to successfully package this block and broadcast, and it is the longest chain, he will be rewarded. At present, there are only 12.5 bitcoins. It started with 50. It's decayed twice. Of course, there are small problems, such as why the longest chain is needed, how to determine the longest chain, and which chains will be abandoned? If you are interested, let's talk about it further. The above is the reward for absenteeism. Updated on December 8, 2017. In the world of bitcoin, one block is generated about every 10 minutes. All mining computers are trying to package the block and submit it, and the first person who successfully generates the block will get a bitcoin reward. Initially, bitcoin rewards of 50 bitcoins could be generated about every 10 minutes. But the payment is halved every four years, and now the bitcoin network can generate 25 bitcoins every 10 minutes. Well, then the story above tells that Zhang San's roar shocked the whole village, and everyone said that they were the first to hear Zhang San's voice. Who should I give the 500 yuan to? So the village discussed the new regulations, and needed evidence to prove that it was Zhang San's voice. Zhang San's cry contains specific sound data, which will be given to whoever breaks it first. In the bitcoin world, this is a new concept, consensus mechanism. Bitcoin decides the bookkeeping right through the consensus mechanism of workload proof. Generally speaking, the one who proves his workload is the biggest is responsible for bookkeeping. The amount of work is reflected by calculating the hash value of the bitcoin block header that meets a certain standard. The block header usually contains the hash value of the previous block, Merkle root, timestamp, difficulty target, and a filled random value. The node that tries to fight for the bookkeeping right is called mining node. The mining process is to find a random value that can fill the block head of this area, so that the hash value of the block head can meet a certain standard
Author: leaf
link: https://www.hu.com/question/20792042/answer/261310341
bitcoin mining is a distributed consensus system that includes the transaction data to be confirmed into the block chain to complete the confirmation of these transactions. By mining, the data in the block chain can be stored in chronological order, the neutrality of bitcoin network can be maintained, and different computers on the bitcoin network are allowed to agree on the system state. To be confirmed, a transaction must be packaged into a block that complies with very strict cryptographic rules and verified through bitcoin network. These rules can prevent the modification of existing blocks, because once there is a change, all blocks will be invalid. Mining is as difficult as winning the lottery. No one can easily and continuously add new blocks to the block chain. Therefore, no one can control what content is included in the block chain or replace part of the content in the block chain to rece their cost. At present, bitcoin mining needs a professional Avalon miner.
bookkeeping
because bookkeeping is a reward, each time you can add a certain number of bitcoin for yourself, so everyone is competing for bookkeeping, which of course leads to a problem: when there is inconsistency in bookkeeping, the system introces workload proof to solve the problem, and the rules are as follows:
1. In a period of time, only one person can succeed in bookkeeping
2. Obtain the unique bookkeeping right by solving the cryptography problem
3. Other nodes the bookkeeping results
but before the workload proof, The accounting node will do the following preparatory work:
1. Collect the original transaction information that has not been recorded in the broadcast
2. Check whether the payment address in each transaction information has enough balance
3. Verify whether the transaction has the correct signature
4. Package and record the verified transaction information
5. Add a reward transaction: add 12.5 to your address Bitcoin
if you succeed in competing for bookkeeping rights, you can get a reward of 12.5 bitcoin
workload proof
the hash value of the previous block and the current account page information will be hashed together as the original information in each bookkeeping. In order to ensure that only one person can keep accounts around 10 minutes, we have to improve the difficulty of keeping accounts. The results of hash must start with several zeros. In order to satisfy the condition, hash is to introce a random number variable
denoted by pseudo code:
1. Hash (last hash value, transaction record set) = 456635bcd
2. Hash (last hash value, transaction record set, random number) = 0000afd635bcd
if you change part of the original information of hash, the hash value will also change continuously. Therefore, when you run hash, the value of random number will change continuously, A random number can always be found so that the result of hash starts with several zeros. The node that finds the random number first obtains the unique bookkeeping right
verification
after the node successfully finds the hash value, it will broadcast and package the block to the whole network immediately, and the node of the network will verify it after receiving the broadcast. If the verification is passed, it indicates that a node has successfully decrypted, it will not compete for the current block, but will choose to accept the block and record it in its own account book for the next round of competitive guessing. Only the fastest decrypted block in the network will be added to the ledger, and other nodes will to ensure the uniqueness of the whole ledger
If a node has cheating behavior, it will cause the node of the network to fail the verification, give up its packaged block directly, and cannot be recorded in the general ledger, then the consumption cost of the cheating node will be in vain. Therefore, miners consciously abide by the consensus protocol of bitcoin system, and ensure the security of the whole system
it's like you go to the construction site to move bricks. After moving bricks for one day, the contractor asks you how can you prove that you move bricks for one day?
when we submit a transaction, under normal circumstances, the transaction will eventually be put into a certain block by miners. At this time, we can say that the transaction has obtained 0 confirmations. When there is another blockchain to this exchange in the block, that is, when this exchange in the block is the parent block, we say that this transaction has been confirmed, and so on. How many confirmations a transaction has obtained is just how many blocks the exchange links behind the block.