3

Ethereum practice collation (1) basic knowledge of blockchain
practice finishing (2) Ethereum Geth client
practice finishing (3) Remix development and deployment of smart contracts
practice finishing (4) Truffle smart contract development framework
practice finishing (5) DApp development process record (part 1)
practice finishing (5) DApp development process record (part 2)
practice sorting (6) file decentralized storage


Before starting to learn Ethereum development, it is necessary to have an understanding of blockchain knowledge and simply sort out some terminology explanations.

transaction

In decentralized applications, requests sent to nodes usually become "transactions", including transfers, deploying smart contracts, and calling smart contract functions, all of which are transactions; transaction data needs to be signed by the associated wallet and sent to the node.

Block

A block is a data storage unit in the blockchain. Each block stores a set of transaction information and hash data of these transaction information. Each block also stores the hash information of the previous block.

Blocks are linked by hash information to form a blockchain

Node client

The blockchain is a distributed network, and everyone can deploy their own nodes to join the blockchain network and become one of the nodes. The Ethereum client is a node program in the Ethereum network. After running the client, the node joins the Ethereum network. At the same time, this node program can complete tasks such as creating accounts, initiating transactions, deploying contracts, executing contracts, and mining blocks. For example, geth is an Ethereum client.

mining

The process of generating blocks by nodes is called mining. Mining means that nodes pack a batch of transaction data into a new block, and then broadcast this block to the blockchain network. Other nodes will verify the validity. After successful verification, each The node stores it locally as a new block, and then continues to compete for mining based on the new block. Node miners who have successfully mined are motivated by digital currency, so many nodes will join the competition to produce blocks.

Consensus Algorithm

In the process of mining, miners need to pay computing power to find a number that meets the conditions. This computing power payment cannot be forged. After a certain node calculates the number, other nodes can quickly verify the validity of the number. This kind of scheme recognized by all network nodes in order to continuously generate blocks is called a consensus algorithm, and a consensus algorithm that pays computing power to prove its work is called a PoW (Proof of Work) consensus algorithm.

  • Proof of Work (PoW)

    POW is a consensus algorithm used by Bitcoin in the block generation process, and it can also be said to be the most primitive blockchain consensus algorithm. The proof of POW workload is simply to understand that a certain amount of work has been done through a certificate. Ethereum 1.× also uses the Pow consensus algorithm. Blockchains using this consensus algorithm tend to have lower transaction TPS and longer block generation intervals because they require a longer period of time for verification.

  • Pos (Proof of Stake) Proof of Stake

    Due to the huge energy consumption of the PoW mechanism and the long transaction confirmation time, POS proof of rights has evolved. In the blockchain system based on the proof of equity consensus, the role of the participant is the Validator. You only need to invest in the digital currency of the system and verify whether you are the creator of the next block within a certain period of time to complete the next block. Creation. The creator of the next block is selected in a certain way. The probability of a validator being selected as the creator of the next block is proportional to the amount of digital currency in the system that it owns, that is, a validator with 300 coins The probability of being selected is 3 times that of a validator with 100 coins.

  • DPos (Delegated Proof of Stake) Authorized Proof of Stake

    The principle is to let everyone who holds the coin vote, thereby generating a certain number of representatives. We can understand it as a super node, and these super nodes have equal rights with each other. DPOS is a bit like a parliamentary system or a people’s congress system. If the representatives cannot perform their duties (when it is their turn, they fail to generate a block), they will be delisted and the network will select a new super node to replace them. DPOS ensures security through its algorithm of selecting block producers and verifying the quality of nodes, and at the same time eliminates the time consumption of waiting for a certain number of blocks to be verified by untrusted nodes. By reducing the requirements for confirmation, the DPOS algorithm greatly improves the speed of transactions.

Smart Contract

A smart contract is a program running on the blockchain. Like other programs, it is composed of code and data. Before Ethereum, transactions on the blockchain were generally cryptocurrencies like Bitcoin, and at most some information was added to the transaction postscript. Ethereum has introduced smart contracts to expand the boundaries of transactions. It allows a piece of code to be executed while the transaction occurs. This means that the transaction itself has logic. After all, many transactions in reality will be accompanied by logic, such as installment payments or insurance. The execution of the contract is also subject to the conditions agreed in advance.

Ethereum provides an almost Turing complete programming language. The result is that in theory, developers can write arbitrarily complex logic on top of the Ethereum smart contract, and even implement any program they can think of. Thanks to this, various centralized applications (DAPP) have appeared on Ethereum.

Virtual Machine (EVM)

The Ethereum virtual machine is used to execute transactions on the Ethereum and provide an operating environment for smart contracts. Students who are familiar with Java can think of EVM as JVM. EVM is also a container for running programs. The Ethereum virtual machine runs on the Ethereum node client.

type

  • Public chain

    The public chain is an open and transparent blockchain. Anyone can access the blockchain and become one of the nodes. The public chain is usually open source. The public chain is completely decentralized, and no single person or organization owns the public chain. In the two most basic blockchain operations of "transaction" and "query", everyone is equal. This equality means that everyone has a public chain, and it also means that no organization can close a public chain. In order to reward the nodes participating in the operation of the blockchain, the public chain has a certain economic stimulus mechanism. Node mining, which is to complete the block packaging of transaction data, usually receives a certain digital currency reward.

  • Private chain

    The private chain is owned by a specific individual or organization. Different organizations can build their own private chains with the same code, and the nodes in the chain and the records on the chain are independent of each other. As a user, you must obtain the permission of the owner of the private chain to initiate operations such as transfers and inquiries. As a node, permission is also required to join the private chain network.

  • Alliance chain

    From the perspective of various attributes, the alliance chain is almost the same as the private chain. The alliance chain can be understood as a special private chain, which is publicly owned by multiple organizations. From a value point of view, the alliance chain allows different organizations to share data, which can greatly improve the efficiency of business activities. At the same time, because there are multiple participants and each participant plays games with each other, the situation of the private chain that can be arbitrarily modified is much better, so it has certain advantages of the public chain.

token

We often hear that "issue currency" is based on the blockchain to issue tokens. This kind of token issued is essentially different from the original coins produced by mining on the blockchain itself. Token is to generate a set of digital assets through smart contract. By writing code through smart contracts, you can specify the total amount of a certain token and operations such as transfer, collection and even destruction.

TEDA Coin

Tether (USDT) is a virtual currency that links cryptocurrency to the legal tender U.S. dollar. It is a virtual currency stored in a foreign exchange reserve account and supported by legal tender. It is endorsed by the centralized organization Tether. The support system behind it is that Tether guarantees that every usdt coin has a reserve of one dollar. The price of digital currency is unstable. In order to ensure the timeliness of transactions and the consideration of short positions, virtual currency exchanges need to have such a digital currency with a constant value. Different countries have different regulations on the transaction of legal currency and virtual currency. USDT avoids the direct transaction of legal currency with virtual currency. Usually, the legal currency is converted into USDT first, and then USDT is used to trade various virtual currencies. In essence, USDT is a token. The differences between the USDT tokens issued by Tether based on the token protocol of the Bitcoin network, the Ethereum network and the TRON network are as follows:

截屏2021-09-17 下午4.56.07.png

Wallet client

In addition to the relatively "heavy" Ethereum client like geth, there is also a relatively "light" client: wallet. Ordinary users use imToken more often, while the wallet commonly used by developers is MetaMask, which is a browser plug-in wallet that can deploy and execute smart contracts.

Anyone can develop a wallet client based on the open RPC interface of the blockchain.

Block Explorer

A blockchain browser is a website. Through this website, you can query some information on the blockchain, such as search transaction records, detailed information of a certain block, and the height of the current chain. You can also query the balance or transaction details through the wallet address or transaction ID. So the blockchain browser is not a program built on the blockchain public chain. Simply put, it is a website that can query blockchain data. And it is built on an ordinary centralized network. It is the external window of blockchain data, and the block explorer allows ordinary users to witness the openness and transparency of the public chain.

DAPP

Conventional Internet applications are front-end requests to a centralized server, and the server responds to data synchronously. DAPP is a front-end request for any node in the decentralized network. After the node receives the transaction request, it is broadcast to the entire network, and a consensus is reached in the network to complete the transaction.

In the DAPP application, the request sent to the node is called a "transaction", and it needs to be signed by the associated wallet before it can be sent to the node; in addition, because the transaction needs to wait for the network consensus, most of it is asynchronous, and the result is generally obtained through event callback.

The two most important parts of developing DAPP applications are front-end applications and smart contracts. The smart contract runs on the Ethereum Virtual Machine (EVM), and the front end calls the smart contract by initiating a request to the node. The front-end part is the same as the Internet front-end application, you can use any front-end framework you are good at, such as Vue or React to develop, and then call the smart contract through the web3.js function library.


Ethereum practice collation (1) basic knowledge of blockchain
practice finishing (2) Ethereum Geth client
practice finishing (3) Remix development and deployment of smart contracts
practice finishing (4) Truffle smart contract development framework
practice finishing (5) DApp development process record (part 1)
practice finishing (5) DApp development process record (Part 2)
practice sorting (6) file decentralized storage


zhutianxiang
1.5k 声望327 粉丝