Closed Keith-CY closed 1 year ago
Ethereum itself is a server, because it can not only change state, but also store state. Developers only need to implement client. In contrast to CKB, it can only store state. Moreover, the storage on CKB is expensive, so the data should be stored in off-chain as much as possible. In summary, developers need to implement an additional server on top of CKB to change and store state. While CKB uses the UTXO programming model, which is difficult to understand. In addition, developers need to know a lot of details about CKB in the process of implementing the server, such as Cell model. It caused a lot of inconvenience to developers. To make it easier to develop on CKB, Kuai will provide a javascript-based development framework to help developers create high-quality services more efficiently.
Kuai is not a server, but a development framework.
Kuai will provide developers with a more friendly API for off-chain development. It helps developers change and store state in off-chain more conveniently, while only one proof of many state changes is stored in on-chain.
Kuai includes kuai-runner, kuai-convention, kuai-runtime, and kuai-testing.
At present, it is cumbersome to set up a CKB development environment locally, and developers need to know a lot of details, such as the configuration files of indexer and CKB.
kuai-runner will provide a one-click launch method to help developers to set up a development environment easily, such as:
kuai.config.js
- The configuration of a node, account and other information. It will provide the devnet related configuration by default.kuai node start|stop|restart
- Start and stop the local devnet node.kuai contract build|test|deploy
- 1) Compile the contract. 2) Test the contract, and output the test results. 3) Deploy the contract to the node according to the configuration, and output the DeploymentConfig
.As a framework, Kuai should provide clear boundaries and development standards, and provide a list of best practice tips for developers to follow.
kuai-convention is a convention document for the implementation reference of kuai-runtime and the usage guide of kuai-runtime, such as:
kuai-runtime implements the interface defined by kuai-convention, shielding implementation details for developers and provides easy-to-use APIs.
kuai-runtime provides friendly libraries/modules for building, sending, and managing transactions.
Developers can build services quickly by kuai-runtime.
The composition of kuai-runtime is as follows.
Testing is an important part of the software development process. And Kuai should provide modules that integrate with common testing frameworks on the market to help developers perform integration testing of the entire business process (dapp → service → CKB → assertion).
kuai-testing will provide a friendly integration testing environment, such as:
As an open source project, Kuai needs to provide good documentation and examples to attract and guide developers.
kuai-website provides friendly development documentation, such as:
Code Run: call a method
Is it means to use a deployed contract? Like for cheque contract, send a cheque, claim, or withdraw?
Data storage Data manipulation
Is it means to get cell data from chain? And we can use data to deploy contracts, call contracts, or get information.
@Keith-CY
kuai-convention
I thought of two ways for kuai-convention
to provide for users. We shouldn't limit user development contracts in one way.
I prefer the second method, we can accumulate many useful plugins to improve development efficiency.
I thought of two ways for
kuai-convention
to provide for users. We shouldn't limit user development contracts in one way.
You are right, but kuai-convention focuses on off-chain services, rather than on-chain contracts.
Code Run: call a method
Is it means to use a deployed contract? Like for cheque contract, send a cheque, claim, or withdraw?
Yes, Run
is used to call a method of the script/contract (Code
model). We can use the simple command as the most underlying method to change the state of the Data
model from which Code
model extends. And derive a contract object with user-friendly APIs from Code
model with ABI (TypeChain)
Data storage Data manipulation
Is it means to get cell data from chain? And we can use data to deploy contracts, call contracts, or get information.
@Keith-CY
Data storage
and Data manipulation
are mentioned in the Unified paradigm for development section, the main idea is to make base APIs uniform so all dapps following the paradigm could interact with each other smoothly.
Say DApp_A has Model A
on the chain and it's derived from Code Model
/Data Model
, then the Model A
's data are transparent to all and can be parsed and shown in every other DApp. Besides, if Model A
's ABI is public, DApp_B could overlap its own business logic over DApp_A, just like extends ERC 20 Token
Once the rule is omnipresent, all DApps are connected to each other.
Back to question 2
Is it means to get cell data from chain? And we can use data to deploy contracts, call contracts, or get information.
Yes, data storage
includes reading/writing data in a prescribed way, and data manipulation
means updating data in a well-known way.
The proposal has been drafted by https://github.com/ckb-js/topics/pull/5
Target
Unified paradigm for development
Reactive Lazy Evaluation
Struct { value actions: Action[] }