CITA is one of the few domestic alliance chain development frameworks. Today this article will summarize CITA-related materials to establish an understanding of CITA for readers.
First of all, the development of the alliance chain and the public chain are common, so DApp is also developed on CITA, and in order to realize the development of DApp, a complete set of components is required, and finally a solution is summarized.
CITA’s complete solution is embodied in CITAHub, which provides a complete set of open source blockchain solutions. In CITAHub, CITA is the core of the underlying blockchain. And around CITA, the open source tool chain CITA Toolchain is provided to improve the infrastructure, so that operators, developers and end users can quickly use it.
CITA SDK and CITA CLI directly interact with CITA. The official has built 4 tools based on the CITA SDK: ReBirth, CITA IDE, CITA Truffle Box, CITA Web Debugger.
It also provides 3 tools for specific business needs and development scenarios: Microscope, Cyton Wallet, and CITA CLI. There is also a first-forever-demo. By developing or running this demo, you can be familiar with most of the sub-tools of CITA Toolchain and basically master the operation process of developing DApp on CITA.
From the perspective of functional positioning, CITA is a high-performance blockchain core supporting smart contracts for enterprise-level applications. It aims to provide a stable, efficient, flexible, and future-adaptable operating platform for enterprise-level blockchain applications.
Because of the engineering implementation ideas, in the context of the development of blockchain technology, CITA decouples the necessary functions of blockchain nodes into six microservices: RPC, Auth, Consensus, Chain, Executor, and Network. The components exchange information through the message bus to cooperate with each other. By configuring and customizing corresponding services, CITA can meet all the needs of enterprise-level users.
The complete composition of the entire CITAHub is shown in the figure below, and each part becomes the carrier after each function is decoupled. Let’s look at the functional decomposition of each part in detail.
CITA splits the consensus, network, computing, RPC and other functions of a blockchain node into microservices. Each microservice can have multiple instances, and these instances work together to complete the accounting function of a node. In this way, the expansion problem of the blockchain performance can be transformed into the expansion problem of the node. When the performance is insufficient, a server can be inserted to share the work pressure of the node. At the same time, the consensus mechanism and underlying logic have been deeply optimized, such as adopting all codes in the Rust language architecture.
Measured data: The performance of CITA composed of a 4-core 8G cloud host can reach 2,900 simple transactions per second; the performance of CITA composed of a 32-core 64G cloud host exceeds 15,000 simple transactions per second. If a cluster is used to build nodes, the performance will be higher, so the performance of CITA is sufficient to cope with most application scenarios.
As an important part of the CITA ecosystem, CITA Toolchain aims to make it more convenient for developers to use CITA or build applications based on CITA.
CITA SDK and CITA CLI directly interact with CITA.
The CITA SDK is the core of Toolchain. It encapsulates the repetitive and tedious operations on CITA and exposes simple interfaces to developers. Developers can use this SDK to build applications.
The official has built 4 tools based on the CITA SDK: ReBirth, CITA IDE, CITA Truffle Box, CITA Web Debugger.
CITA CLI is a very friendly system operation and maintenance tool.
The Java SDK integrates the function of interacting with the CITA client, which can be used to send transactions to CITA, deploy smart contracts, call contract methods, perform system configuration, and query other information.
Swift SDK is used to build Cyton Wallet iOS.
The Ruby SDK is used to build ReBirth.
The Rust SDK is a Rust implementation of the CITA JSON-RPC client.
ReBirth is a block chain cache server provided by CITA, which can meet the requirements of searching blocks, providing ERC20 transaction lists and other business functions. If such functions are directly implemented at the bottom layer, performance will be affected.
CITA IDE is a smart contract editor for CITA, capable of writing, compiling, debugging, and deploying smart contracts.
CITA Truffle Box
CITA Truffle Box is an all-round development framework for DApps tailored to CITA based on Truffle Box, including writing contracts, compiling contracts, testing contracts, deploying contracts, and building DApps. Therefore, the experience of developing DApps on CITA is more consistent with that on Ethereum.
CITA Web Debugger
As a DApp debugging tool, CITA Web Debugger is a plug-in based on the Chrome browser. When developing DApps, it is inconvenient to debug on the mobile phone. Using CITA Web Debugger can debug transaction functions on the browser, which can be easily obtained. Transaction specific details and feedback.
In addition, the official also provides 3 tools for specific business needs and development scenarios: Cyton Wallet, CITA CLI, and Microscope.
Cyton Wallet is divided into Android version and iOS version. It provides account management functions (private keys, mnemonics, keystore), Token management and transfer functions, and a built-in DApp browser. At the same time, it relies on ReBirth to provide a list of native tokens and ERC20 token transactions.
CITA CLI is a command line tool for debugging CITA during development. The interaction with the CITA chain can be operated through CITA CLI. It supports search history commands and supports secp256k1 and SM2 encryption algorithms by default.
The Microscope blockchain browser can be used to query all CITA chain information, and supports CITA-based multi-chain. You can switch the target chain in the metadata panel. Support searching blocks, transactions, account information and calling smart contract methods. It can also be used with ReBirth to realize advanced functions such as querying the block transaction list with specified combination conditions and analyzing the working status of CITA.
Economic Model Selection in CITA
As a high-performance blockchain core for enterprises, CITA has a virtual machine that supports smart contracts. Every operation in the user’s transaction (transfer, call contract, deployment contract) will consume a certain amount of resources, and the resources consumed here are taken as Quota Unit to count.
In order to manage and control the limited computing resources on the chain, the economic model of the chain needs to be designed. In actual business scenarios, there are generally chain operators (initiating the chain, maintaining the ecology of the chain such as browsers), bookkeepers (miners, providing computing resources), users (consuming computing resources on the chain) and other participant roles. Among them, the operator and the bookkeeper may be undertaken by the same party, or they may be different parties with independent interests.
As a general blockchain kernel, CITA provides many configuration parameters, allowing users to customize economic models according to their own business scenarios. Generally speaking, it can be divided into two modes:
No token mode, the system default mode. The system only counts the resources consumed by user transactions.
parameter settings. By setting Quota Limit, the system can limit the overall resource consumption of transactions in the block, or set a limit on the consumption of transaction resources in a block for a single account. See Quota mode for details and operations.
Examples of scenarios:
Several companies form an alliance to run the blockchain, and each member is both a “miner” (maintaining the blockchain ledger) and a user (consuming computing resources). The miners work “free of charge” in order to maintain the stability of the system. Quota mode can be selected for this kind of scene.
There is a token model, and native tokens are issued on the chain. The system first counts the resources consumed by users’ transactions (quotaUsed), and converts them into native tokens to charge users. There are a variety of flexible distribution methods for the collected fees, which is convenient for users to customize according to business scenarios.
parameter settings. Like Quota mode, charge mode can also set Quota Limit to limit the overall resource consumption of transactions in the block, and set resource consumption limits for a single transaction of the account. And can flexibly set the total amount of tokens and distribution methods. During the operation of the chain, the commission can also be adjusted by setting QuotaPrice.
CITA’s choice of privacy protection
In the CITA architecture, in order to protect the privacy of the “ledger”, a variety of technical solutions are adopted to protect the privacy of user identities and on-chain data.
If a cryptographic scheme is used, all participants have participated in the verification of the validity and legality of the data, but they can only provide transfer privacy, which poses a forward security risk. Privacy protection of user identity and transaction data can be carried out.
If zero-knowledge proof technology is used. The certifier provides the verifier with proof of the identity of the sender and receiver of the transaction and the details of the transaction, and the content of the certificate does not reveal the identity of the parties to the transaction, transaction details and other relevant information. Data is effectively isolated; there is no forward security risk. You can protect the privacy of transaction data.
After combining several multi-chain and cross-chain solutions, CITA implemented a side-chain solution at the bottom to realize private transactions. Several related partners jointly build a main chain, and some of the participants can register a side chain with the main chain, and perform transactions and verifications on the side chain, thereby isolating the side chain data from the main chain data, thereby achieving Privacy protection of side chain transaction data. This solution has no centralization risk and is more flexible.
In addition, the core data that needs to participate in consensus and need to be shared will be separated from other data such as contract plaintext, bulk data, privacy, and personal information. After data desensitization, it will be uploaded to the chain, or the data summary will be uploaded to the chain, if necessary. Authorize access to other data such as plaintext. The off-chain storage is the private data to be protected, and the on-chain is the data that can be disclosed. This method is currently a feasible solution and can be designed and implemented based on CITA.
Finally, if you use trusted hardware, you can make the overall architecture simple, have low storage space requirements, and have high flexibility; however, it is subject to manufacturers. This method can protect the privacy of user identities, on-chain data (transaction data, deposit data) and smart contracts.
For example, using the SGX privacy protection technology to build a trusted execution environment TEE through the computer’s core processor CPU, SGX can encapsulate the key operations in the smart contract into the Enclave, and even the operating system or VMM (Hypervisor) cannot affect the contents of the Enclave. Code and data. The security boundary of Enclave only includes the CPU and itself, which greatly guarantees the security of the data. CITA stated that at present, existing projects have built a CITA consortium chain platform and used SGX trusted execution environment technology to achieve the privacy of transaction data and the penetration of supervision.
Posted by:CoinYuppie，Reprinted with attribution to:https://coinyuppie.com/understand-cita-consortium-chain-solution-in-one-article/
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.