Blockchain certainly has technology , And blockchain is a complex interdisciplinary . Let's not talk about it , The humanities of blockchain , social , Economic technology , I'm not very professional . Just from the perspective of computer technology , Blockchain technology is also very complex and professional .
Start with the programming language .2018 year ,go Language is popular in blockchain , Almost all the bigger public chains are made of go Development , It's really simple and easy to use , Network processing , Command line processing , There are very rich Libraries .2019 year ,rust Language is becoming popular .Facebook Of libra All projects adopt rust Language development . Some databases of zero knowledge proof are also created by rust Language development .Rust Language types are predefined , Avoid security risks ; Fixed length of array , Prevent overflow attacks .Rust Language has a new concept , ownership （Ownership） Memory management mode of . Ownership management of memory , It allows the compiler to check at compile time . Ownership is managing the data on the heap . Through the design of ownership ,Rust At compile time , Can check and avoid Data competition （ Multiple addresses access the same data , The data must be valid when it is written, etc ）. Blockchain development , Often switch between multiple development languages ：go,rust,C++,python. sometimes , Code development is a bit of a trance ： Is the definition of variable type before or after the variable ？ Do you need a semicolon after an expression ？ Whether to add a colon after the expression ？
data structure , There are two important data structures in the blockchain ：Merkle Trees and DAG structure .Merkle Trees , By calculating the leaf nodes in pairs hash result , Generate the nodes of the upper layer , To the roots .Merkle Tree data structure , There are obvious benefits , Any changes to the leaf node , Will change the roots .Merkle Trees have another advantage , Given a certain Merkle path, It can prove that a leaf node is actually taking a root merkle on the tree .Merkle Trees , There are many varieties . Ethereum management account information （ The state of the world ）, It uses MPT Trees .MPT Tree by adding or merging nodes , To optimize the Merkle Depth of tree .Merkle A tree is usually a binary tree , In fact, it can be extended to multi tree .
DAG, Directed acyclic graph . Traditional blockchain （ such as , The currency , The etheric fang ）, Using single sequence block link mode , That is, the latter block depends on the former block . This traditional blockchain organization , Limits the performance of the transaction （TPS）. In order to improve the TPS,DAG It's a new way to organize blocks . How to be in DAG In the way of block structure , Block determination / The order of transactions , There are many related researches and algorithms .
Virtual machines and smart contracts , The virtual machine is executed safely on the blockchain “ Program ” Environment . Intelligent contract , It's a program executed in a virtual machine . Different public chains provide different types of virtual machines , Like Ethereum EVM, Star Cloud chain JVM,EOS Based on the WASM And so on . Different virtual machines have different programming specifications .
Consensus algorithm , Consensus algorithm enables data to reach consensus in a certain network environment . The most traditional is BFT/PBFT Consensus algorithm , Based on the principle of voting and majority , Just over 2/3 The data of node signature is the data of consensus .PBFT Consensus algorithm , There need to be several stages , Each stage needs to collect more than 2/3 Node signature of . This way, , Safe and reliable , There will be no block forking , But it's less efficient .PBFT The complexity of the consensus algorithm is O（N^2）. In order to improve the performance of consensus algorithm , Put forward a lot of others based on BFT The consensus algorithm of ideas , such as HoneyBadgerBFT Algorithm ,LBFT Algorithm .Algorand It's also PBFT A variant of the algorithm , First, randomly select nodes , Then let the extracted nodes use PBFT Algorithms form a consensus .POS/DPOS Consensus algorithm , Adopt and PBFT The algorithm is totally different from the consensus principle .POS/DPOS Consensus algorithm , Who will take the mortgage , Who has a high probability of thinking , Simple and crude . The more mortgages , The greater the contribution , There's also a corresponding reward .
encryption algorithm , There are many encryption algorithms in blockchain . Elliptic curve encryption , Various signature algorithms （BLS, Blind sign , Ring sign and so on ）.
Proof of zero knowledge , The theoretical basis of zero knowledge proof is more ： Elliptic curve , Big numbers , Group theory , Homomorphic encryption , Pairing function , Various algorithms of zero knowledge proof （zkSNARK,zkSTARK,BulletProof wait ）. The theory of zero knowledge proof can be traced back to 1985 year . At present, there are two directions of application ： Privacy and data compression .Zcash That is to use zero knowledge proof to achieve transaction privacy , The information of both sides of the transaction and the transaction amount are only known to both sides of the transaction .Loopring Decentralized transaction protocol for 3.0, It is to use zero knowledge proof to realize offline computing , The idea of chain validation .Filecoin Using zero knowledge proof to achieve ” Data compression “, Data stored by users （ Large amount of data ） There's no need to go straight up the chain , You just need to prove the data （ The amount of data is relatively small , Hundreds of bytes ） Store on Chain . Before zero knowledge proof technology , The blockchain world is the blockchain world , The real world is the real world . Zero knowledge proof technology , Provides a way , The real world , Partially mapped to the blockchain world .