Blockchain Git
blockchain is a digital account book that can be jointly bookkept, and will record all transactions that have occurred and have been unanimously recognized by the system it's the same as the whole family. You're bookkeeping, and your father and mother are also bookkeeping. They can see the general ledger, but the saved information can't be tampered with any more
In 2008, Nakamoto first proposed the concept of blockchain subsequently, blockchain has become the core component of electronic currency bitcoin, which serves as the public account book for all transactions. By using peer-to-peer network and distributed timestamp server, the blockchain database can be managed independentlyextended data:
type of blockchain
1, public blockchain
any indivial or group in the world can send transactions, and transactions can be effectively confirmed by the blockchain, and anyone can participate in its consensus process. Public blockchain is the earliest and the most widely used blockchain. The virtual digital currencies of bitcoin series are all based on public blockchain. There is only one blockchain corresponding to this currency in the world
2, Alliance (instry) blockchain
instry blockchain: multiple preselected nodes are designated as bookkeepers within a group, and the generation of each block is jointly determined by all preselected nodes (preselected nodes participate in the consensus process), and other access nodes can participate in the transaction, However, regardless of the bookkeeping process (in essence, it is still managed bookkeeping, only distributed bookkeeping, how many preselected nodes, and how to determine the bookkeeper of each block to become the main risk point of the blockchain), anyone else can conct limited query through the open API of the blockchain
3, private blockchain
only uses the general ledger technology of blockchain for bookkeeping. It can be a company or an indivial, and enjoys the write permission of the blockchain. This blockchain is not very different from other distributed storage schemes
core analysis:
1. Transparency, 2. Openness, 3. Information can not be tampered with, 4. Decentralization,
5. Detailed analysis
blockchain is a new application mode of distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and other computer technologies. The so-called consensus mechanism is a mathematical algorithm to establish trust and obtain interests between different nodes in the blockchain system
1. In a narrow sense, blockchain is a kind of chained data structure composed of data blocks connected in sequence according to the time sequence, and it can not be tampered with and forged by cryptography
2. Broadly speaking, blockchain technology uses blockchain data structure to verify and store data, uses distributed node consensus algorithm to generate and update data, and uses cryptography to ensure the security of data transmission and access It is a new distributed infrastructure and computing method to program and operate data by using intelligent contract composed of automated script code.
blockchain (English: blockchain or block chain) is a kind of distributed database . You may have heard about bitcoin, which is the core technology. Blockchain is a series of data blocks generated by cryptography. Each data block contains the information of a network transaction, which is used to verify the validity of the information and generate the next block. In a popular concept, blockchain is an account that everyone can keep. In a company or organization, most people only have the right to keep accounts, while only a few people with professional training have the right to keep accounts. Of course, blockchain is not an account book in the traditional sense. It has the following three key points in technical principle: first, decentralization. In a network practicing blockchain technology, each computer covered by it can read and add records. From the perspective of account book, they are the people who keep accounts together, and there is no authoritative person to guide and correct them. Second, asymmetric encryption. Although everyone can remember this account, they will not be able to read it unless they are in the Bureau. Because, in the accounting process, everyone follows the unified encryption rules, but when reading, they must use their own unique decryption method. Therefore, although everyone keeps this constantly updated account, the part they can read is only the one they can decrypt, that is, the part related to themselves. Third, time stamp. That is, time stamp (English: timestamp), refers to the string or coded information used to identify the recorded time and date. Each block on the blockchain is arranged in sequence according to the time it is generated, and is confirmed by collective authentication. Moreover, previous records cannot be modified. Just like in an account, we can index and verify the previous content through the records after a point in time. Once these contents are confirmed, it will be more difficult to tamper with them
blockchain technology is to maintain a growing distributed database of data records. These data are associated with all the data written before through cryptography technology, which makes it difficult for the third party or even the owner of the node to tamper with. Block contains the data that need to be saved in the database, and these data are written into the database through block organization. Chain usually refers to the use of Merkle tree and other methods to check whether all the current blocks have been modified. This is familiar to code farmers who have used git for a long time. Recall how to modify git's history
blockchain technology is mainly divided into three categories, which are open, collaborative and private
public blockchain
example: bitcoin, Ethereum frontier. The data on the public blockchain can be accessed by all people, and all people can issue transactions waiting to be written into the blockchain. Participants in the consensus process (corresponding to the miners in bitcoin) maintain the security of the database through cryptography technology and built-in economic incentives. Open blockchain is completely distributed
highlights and pain points: the open blockchain is completely distributed and has all the characteristics of bitcoin. However, it needs sufficient cost to maintain the system operation and relies on built-in incentives. At present, only bitcoin in the public blockchain is safe enough. If the algorithm is the same as bitcoin, it will be safe; There are no built-in rewards, but they are not; It's easy to concentrate on the attack of computing power (for example, as long as the raid sweeps goods and a large number of graphics cards), and take jujube pills. The more valuable the data on the open blockchain is, the more important it is to examine its security, transaction cost and system scalability
federated blockchain
example: audit system tried by hyperledger and Deloitte. The nodes participating in the blockchain are selected in advance, and there is likely to be a good network connection between the nodes. Other consensus algorithms without workload proof can be used on such a blockchain. For example, a blockchain has been established among 100 financial institutions, and more than 67 institutions must agree to reach a consensus. The data on such a blockchain can be public or internal to these node participants. Distributed in a partial sense
highlights and pain points: collaborative blockchain can achieve a good connection between nodes, only need a little cost to maintain operation, provide rapid transaction processing and low transaction costs, has good scalability (but the scalability will decline with the increase of nodes), and data can have certain privacy. Developers have the ability to change the protocol under the consensus. There is no problem with bitcoin hard fork, but it also means that everyone can tamper with the data together under the consensus. Collaborative blockchain also means that the application scope of this blockchain will not be too wide, lacking the network propagation effect of bitcoin
private blockchain
example: Eris instries. The participating nodes are only users themselves, and the access and use of data have strict authority management. Most of the blockchain technologies recently announced by some financial institutions for internal use are vague, but they are probably all within this scope
highlights and pain points: private blockchain is actually a confusing term. Such a system is nothing more than a shared database in the traditional sense. Merkle tree and other methods are used to try to show that the data in it is verifiable. There are already mature solutions for such databases, and Merkle tree is only one of many mature solutions. It's easy for these projects to be "like eggs". Because the user has the final say, the data inside can not be changed, and there is not much protection for the third party. Therefore, many private blockchains exist by attaching to bitcoin, such as recording system snapshots to bitcoin regularly
Fourth, decentralization. Decentralization is the most basic feature of the blockchain, which means that the blockchain no longer depends on the central processing node and realizes the distributed recording, storage and updating of data. In the traditional centralized network, attacking a central node can destroy the whole system, while in a decentralized blockchain network, attacking a single node cannot control or destroy the whole network. More than 5% of the nodes in the master network are just the beginning of gaining control. 2019 is the first year for the commercial application of blockchain technology, and the stimulation of favorable policies will make the development of blockchain technology more stable
with the application of blockchain technology graally penetrating into many fields such as digital finance and Internet, we have a clearer understanding of the value of blockchain
blockchain has formed a situation of global competition, and all countries are seizing the development opportunities, let alone China; Therefore, there is no doubt that blockchain has become a national strategy.
but if bitcoin trading goes to the exchange, the exchange will charge a handling fee
distributed
git ensures that each code warehouse maintains a complete project library locally, not just the branch in which it works and its own submission history. At the same time, it also keeps all the snapshot and index information after the latest pull
on the blockchain, each node keeps a complete database locally, not just its own transaction information
traceability
in Git commit chain, each commit object contains a parent object (the object of the last commit, except the first commit), which can trace all the previous records
on the blockchain, each block contains the index of the previous block (except the genesis block), which can trace all valid transactions before<
tamper proof
in Git's commit chain, each object itself calculates a checksum before storing, and then references it with a checksum. Once modified, the checksums will not be correct, which means that it is impossible to change the contents of any file or directory without git's knowledge< The mechanism used by git to calculate the checksums is called SHA-1 hash. This is a string composed of 40 hexadecimal characters (0-9 and A-F), which is calculated based on the content or directory structure of the file in GIT. SHA-1 hash looks like this:
in the blockchain, each block contains the last block ID, and this block ID has two SHA-256 hashes, which are calculated based on the block content. Once the content is modified, the hash will change, which is inconsistent with the chain of other nodes and cannot be added to the longest chain, so the content cannot be tampered with< 2. Difference
collective consensus and central node will: 1 - blockchain merges based on collective consensus (POW / POS) to form the longest chain, which is the main chain
2 - in Git system, when multi node cooperation is carried out through the warehouse hosting platform, it is the manager of the platform project who controls the power of merge, which reflects the will of the central node<
cryptography
1 - in bitcoin blockchain, cryptography mainly uses the following methods
in the whole system of bitcoin blockchain, a large number of public encryption algorithms are used, such as Merkle tree hash number algorithm, elliptic curve algorithm, hash algorithm, symmetric encryption algorithm and some coding algorithms. The functions of various algorithms in bitcoin blockchain are as follows:
A) hash algorithm
the two hash functions used in bitcoin system are: 1. SHA-256, which is mainly used to complete pow (proof of workload) calculation; 2. Ripemd160, mainly used to generate bitcoin address
b) Merkle hash tree
binary tree or multi tree based on hash value. In the computer field, Merkle tree is mostly used for integrity verification. In the distributed environment, integrity verification can greatly rece the complexity of data transmission and calculation<
C) elliptic curve algorithm
in bitcoin, the public key cryptography algorithm based on secp256k1 elliptic curve mathematics is used for signature and verification. On the one hand, it can ensure that the user's account is not replaced by an impostor, on the other hand, it can ensure that the user can not deny the signed transaction. The private key is used to sign the transaction information, and the user's public key is used to verify the signature. If the verification is passed, the transaction information will be recorded and the transaction will be completed
d) symmetric encryption algorithm
the official bitcoin client uses AES (symmetric block cipher algorithm) to encrypt the wallet file. After the user sets the password, the private key of the wallet is encrypted by the user set password through AES to ensure the security of the private key of the client
e) base58 encoding
base58 is a unique encoding method used in bitcoin. It is mainly used to generate the wallet address of bitcoin, which is similar to the permutation algorithm mechanism in classical cryptography. Its purpose is to increase the readability of bitcoin and change the binary hash value into the address we see
2 - git: SSH key is mainly used for remote login verification, SHA-1 is used for code content checking sum<
SSH is the abbreviation of secure shell, developed by IETF's network working group. It is a protocol designed to provide security for remote login sessions and other network services. SSH protocol can effectively prevent information leakage in the process of remote management< The process of SSH transmission is as follows: (1) the remote host receives the user's login request and sends its public key to the user 2) The user uses the public key to encrypt the login password and send it back 3) The remote host uses its own private key to decrypt the login password. If the password is correct, the user is allowed to log in.