1. Reference documents
2. The source paper of Bitcoin
3. Asymmetric encryption
Encryption and decryption require a pair of keys: a public key and a private key. You have a pair of keys, the public key can tell anyone publicly, the private key cannot tell anyone, only you know, can not leak.
Scenario 1: A person wants to send you a message, TA uses your public key to encrypt the message, and then sends it to you, then you can decrypt it with the private key and read the message.
Scenario 2: Someone has sent a message to everyone/anyone in your name, how to let everyone/anyone believe that you sent it. The TA decrypts the message with your public key, and if the decrypted result is readable and usable, it can be confirmed that you sent it. The encrypted message cannot be decrypted with your public key without the other person's private key.
Scenario 3: Someone used Bitcoin to give you a sum of money, with your public key to encrypt the money, you received, decrypted with the private key to get the money.
4. Bitcoin Wallet
than a special purse is a pair of keys: the private key and the public key. Public key length is 512-bit binary, too long, and for it to generate a 160-bit binary fingerprint, written in 16, is 26~35 characters, this string is the address of the wallet, is unique. When you collect money from others, give the address to someone else. Private key, to protect good, do not throw away.
5. Bitcoin Trading
The steps are as follows:
One person to declare a transaction, address A to address B to pay 10 Bitcoin. The declaration parameter includes: the hash of the last transaction of address A; The address of both parties to the transaction; The public key of a address; A digital signature generated by the private key of a address.
Service-Side verification transactions: Find the last transaction of address A to confirm that the payment is in a reasonable source of bitcoin; Calculates the public key fingerprint of address A, confirms the same address as the payer, verifies the public key is true; Use the public key of address A to unlock the digital signature to ensure the private key is true. After these three steps, verify that the private key is true.
6. Transaction confirmation and block chain
After the transaction is confirmed, the transaction information should be written to the database, and after the whole network is synchronized, the address B can receive the real money. This database is the block chain Blcokchain.
For Bitcoin, all transaction data is sent to the miners, who write the transaction data to the block chain. A block chain is 1M, a transaction of 500 bytes, so a block to write up to 2000 transactions. The miners packed 2000 deals together, forming a block to compute the hash. Calculation Hash is also called mining. Who is the first to take the new blocks into the block chain, enjoy the proceeds of mining. Once the transaction is written, it cannot be undone.
Digging into a new block, miners will be encouraged to start with 50 Bitcoin, halving every 4 years.
Bitcoin full network, every 10 minutes to generate a block, that is, 2000 transactions, that is, 3~5 per second pen. Slow.
One option is to increase the block to 2M and increase the speed by twice times. One solution is the BCH scheme, which enlarges the block to 8 m and increases it by 8 times times. But in essence it is useless to ascend to 100M. The lifting block size is not solvable.
7. Block Chain Full Network
Peer-to-peer network, countless nodes, each node contains all the data block chain, is currently around 100g, will continue to increase.
8. Block Chain Essence
Block chain is a kind of special distributed database, which can write data and read data. Each node is equal in status. Each node stores all of the information for the entire chain.
Anyone can set up a server to do a new node to join the network, all nodes will be synchronized to ensure that the block chain consistent.
A chunk block, which is a 1M of data. A block consists of two parts: a block head; Block body. The block size is filled with multiple parameters of the current block: The generation time of this chunk, the data hash of the block body storing the data; Hash of the previous block, and so on. In other words, according to the block head, it can be traced back to the whole chain of source and whole chain completely. On the data structure, it is a single chain pointing from the tail to the head.