Understand the base concept of the EOS written dApp

Chain-off, designed for developers and students, Insider!

This article from the [chain off the block chain Q & A community] (https://www.liankexing.com), refused reproduced without permission.

14844519-e3576634ff1cbc1a.png

EOS Smart Contract Development: Understanding written on the EOS base concept dApp by observing the prevailing dApp stalking website, EOS application developers might be luring the EOS increasing dApp and business rates, and consider whether it should preliminary study development intelligent contracts. However, after preliminary discussions, the lack of depth with a high-quality resources, documentation and confusing environment built around intelligent contracts, they will soon lose his mind. This enables developers no choice but to put a lot of time on research, on this busy developers might not even be in. By these ongoing series of articles, we hope this article will introduce the process more smoothly, so that companies and application developers can use to develop innovative EOS loose application.

In this paper, we develop the program for the state of the system, the foundation structure contracts as a contract development (EOS CDT) of the base portion of the module concept and various types of high-level overview, resources and serves as a pointer to further discussion.

How to use this article

This article should be seen as an informal thread, it will contact a variety of important concepts together and touch all aspects of EOS development. Because of all the talk about the concept of depth in terms of skills beyond the scope of this article, we encouraged readers pointer further discussion we will supply the entire passage. In addition, in order, by reading all of the articles in this series, you can make better use of this series of articles. In future articles in this series, we will talk about all the actual development of the concept into practice.

Before reading this article, we advocate reading our top articles to understand the structure of the system architecture contrast with the EOS Ethernet Square. Let us initially it!

Quick Architecture Overview:

EOSIO supply a loose way with an operating system and other features, use it to protect the chain block the onset of this distributed approach, untrustworthy things and business ledgers. Choice who founded the new block (to negotiate agreement) is entrusted by the interests prove to be completed, which touched the tokens to get the power to block generator vote, block generator is to increase the integrity of the nodes of the new block to block chain. Because any suspected malicious activity, voters could be deleted shield producers, and vote for new producers. Within a given time, only block generator 21 to create new block, so the business processing speed becomes very fast, since the number of small proof job discuss consensus algorithm like verified.

EOSIO support the creation of smart contract, its implementation and resource-intensive applications like typical working on the same OS. Intelligent contract is written in c ++, it can be converted to web assembly.

Accounting amount and rate are depicted as bandwidth and CPU resources, durable store information is depicted as RAM. As the demand for bandwidth and CPU is temporary, since it only needs to implement some smart contract operations, so these resources are marked by a period of time (three days) achieved. This ensures that account is proportional to obtain tokens and markers, and if some of these resources are leisure (like internet connection network bandwidth), you can get more resources.

However, RAM is a durable resource, advance purchase requirements on demand. RAM is generally marked volatile memory, but in EOS, which marked durable memory intelligent contracts. RAM prices are unstable, according to the decision by the system algorithm Bancors demand and supply. Since RAM is a relatively scarce resource, the system being adopted measures to prevent its hoarding and speculative business.

It is necessary to pay attention that this information is not stored on durable block chain. Block chain only for records pointing to things and business intelligence information on contracts lasting change. Now that we are now to have a general concept EOSIO architecture, let's take a look at the development for the state system.

Expand Ecosystem

Any smart contract development needs a local node test, to some extent, the local node to communicate with the account processing wallet / keys, set the IDE / code editor and compiler / converter to convert the contract to be implemented intelligent method, a robust test structure, you can prepare a local node test new country, using GUI tools available to help close a contract with resettlement. Let us leave EOS talk about them.

Nodeos is EOSIO core node, you can use it to work with plug-ins node. It will serve as a local node, can be used for development and testing purposes, but it may be equipped with a well-node, even for the block produced.

Cleos daemon with command line interface interact with the local node, it can also be equipped to interact with long-distance node. It is used to declare the purse handle, and declared to the node with instructions related to business intelligence contracts.

Keosd assembly is securely stored in wallets.Eosio EOSIO key.

Eosio.cdt is a contract development kit, which exposes all kinds of libraries and programming structures to help develop smart contract. These structures supply programming interface to handle the various components of the EOS. Eosio.cdt also made eosio-cpp composition, eosio-cpp is as written in a c ++ contract converted into wasm (web assembly) modules. It also generates the type of contract for the ABI, which is a JSON file, specify the contracts and operations support. It is for the intelligent function integration contract with the client application.

EOSFactory by tokenika developed based on the structure of the python test, we found it to develop and test on dapp is useful. It serves a simple to interact with intelligent contact person under python interface, easy to set up and support a new node instance for testing. It even supports placement and processing contracts on public inspection and the primary network.

Scatter is a gui application that the coupling EOS network security and easy disposal of assets, similar to Ethernet Square in Metamask. It can be used as the primary means of all desktop applications use.

Since the contract is written in c ++, so any prevailing ide can be used to write intelligent contracts. However, EOSFactory supply VS code to some support in Quillhash, we use VS code intelligent development contracts, although this is more a question of personal selection.

Deal with people and rights in the EOS

Native support people and deal with rights in EOS, which makes it very powerful in the implementation of intelligent call control and authority in the contract. . They are all Active privileges. All permissions associated with the account associated with the processing stage of operation, is the parent permission Active privileges. Active privileges for common operations, such as the implementation of intelligent operation contract. For example, a transmission token, RAM and the like later. In addition to these rights, we can also create new rights, these rights can be implemented by appropriately deal with them in intelligence contracts.

Another interesting permission is eosio. If we expect the contract to intelligent programming and other communications contract, the contract will use this privilege intelligent. This permission is necessary to account carried by the intelligence contracts increased by its Active authority to promulgate their own.

Overview EOS intelligent foundation contract

Intelligent software contract is working on EOSIO node, the node's RAM memory on what action block chain and synchronize its durable data storage. EOS intelligent contracts publicly available implementation of the "action", these "action" is the implementation of specific contract operation function, by calling the shackles of restrictions and permissions account of the operation. With this in mind, we can be seen as a combination of job contracts with three aspects.

First, we have defined the function specified operating logic. Secondly, how we index table, it supplied with durable storage (RAM) coupled to the interface for us. Third, we have the "dispatcher", which acts as the action handler, and is mapped to the incoming pleading pleading operation. These three components are the foundation "skeleton" of each contract.

Each contract is defined as a class of inherited eosio :: contract class. The definition of contracts with various variables can be designated as private members of the class. Members of these classes can be specified as "Actions". EOSIO supplied EOSIO -cpp web assembly for generating byte code and various characteristics of ABI. Intelligent contract on the EOS can handle notifications from other contracts, even the invocation of other contracts, provided that they have the necessary permissions (eosio). Code License).

Whenever we invoke operations on the contract, the contract will create a new instance of the operation is destroyed in the exercise. Thus, any information indicating the contract situation at the time necessary to start the contract (in the structure function) is loaded, and (or called operation body in the destructor) stored during a prior destruction or destruction. It is necessary to pay attention to is that a situation can only be associated with a smart contract.

in conclusion

In this article, we talked about the concept of foundation on the EOS often when developing dapp. We now have a high-level overview of the eco-system and system architecture EOS now, we are ready to deepen skills and coding aspects of research contracts, and build our own dapps. In the next article, we will analyze in detail the standard eosio.token contract, in order to understand all the details of intelligent building contract touched. We will also develop a foundation of public sale of applications and loose style game contract in a future article.

Reproduced in: https: //www.jianshu.com/p/f18621d3d9ce

Guess you like

Origin blog.csdn.net/weixin_34291004/article/details/91144914