Skip to content

Commit 6f16816

Browse files
laodouyalaodouya
authored andcommitted
chore(publish): published 0.7.0 docs by [laodouya]
1 parent fa6e6aa commit 6f16816

File tree

9 files changed

+102
-11
lines changed

9 files changed

+102
-11
lines changed

docs/arch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ CQL supports 2 kinds of consensus algorithm:
2525
1. DPoS (Delegated Proof-of-Stake) is applied in `Eventually consistency mode` database and also `Layer 1 (Global Consensus Layer)` in BlockProducer. CQL miners pack all SQL queries and its signatures by the client into blocks thus form a blockchain. We named the algorithm [`Xenomint`](https://github.com/CovenantSQL/CovenantSQL/tree/develop/xenomint).
2626
2. BFT-Raft (Byzantine Fault-Toleranted Raft)<sup>[bft-raft](#bft-raft)</sup> is applied in `Strong consistency mode` database. We named our implementation [`Kayak`](https://github.com/CovenantSQL/CovenantSQL/tree/develop/kayak). The CQL miner leader does a `Two-Phase Commit` with `Kayak` to support `Transaction`.<sup>[transaction](#transaction)</sup>
2727

28-
CQL database consistency mode and node count can be selected in database creation with command `cql create '{"UseEventualConsistency": true, "Node": 3}'`
28+
CQL database consistency mode and node count can be selected in database creation with command `cql create -db-eventual-consistency -db-node 3`
2929

3030
## Comparison
3131

docs/arch_layers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CQL uses a layered architecture for database creation and operation. A typical d
1010

1111
1. Miner will automatically register with the MainChain after startup. The registration information includes: "Minimum acceptable Gas price", "System metrics", "External IP and port", etc.
1212
2. Miner subscribes to and pays attention to information related to themselves through ChainBus;
13-
3. The client runs `cql create '{"node":2}'` to send a signed database creation request to any BP (Block Producer) in the MainChain;
13+
3. The client runs `cql create -db-node 2` to send a signed database creation request to any BP (Block Producer) in the MainChain;
1414
4. The BP that received the request performs a match of Miner and database creation request in the process of producing the block (see: [MainChain Produce Block] (#mainchain-produce-block));
1515
5. Database creation requests and matching results are verified and confirmed at other BP nodes;
1616
6. The Miner subscription receives the database task;

docs/deploy_miner.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,13 @@ docker run -it --rm -v $(pwd)/testnet/:/app/config/ \
233233

234234
由于需要在指定的 Miner 上创建 DB,需要在创建 DB 时指定提供服务的 Miner 列表
235235

236-
> `create` 命令接受一个 DB 实例的 json 描述;将 `node_count` 替换为所需的节点数量,例如 1 代表创建一个节点的 DB SideChain;`targetminers` 提供指定 miner 的钱包地址列表;另外需要格外注意的时,所需创建的 DB SideChain 的节点数量需要小于或等于提供的指定 miner 数量,否则 CovenantSQL 会在指定 miner 之外的公用 miner 中随机分配节点以满足用户所需节点数量要求。
236+
> `create` 命令接收一系列描述 DB 实例的参数,可以用 `cql help create` 查看详细参数;将 `node_count` 替换为所需的节点数量,例如 1 代表创建一个节点的 DB SideChain;`miner1_wallet_address, miner2_wallet_address ` 等替换为指定 miner 的钱包地址列表;另外需要格外注意的时,所需创建的 DB SideChain 的节点数量需要小于或等于提供的指定 miner 数量,否则 CovenantSQL 会在指定 miner 之外的公用 miner 中随机分配节点以满足用户所需节点数量要求。
237237
238238
```shell
239239
docker run -it --rm -v $(pwd)/client_config/:/app/config/ \
240240
--entrypoint /app/cql covenantsql/covenantsql:latest -- \
241241
create -config /app/config/config.yaml -wait-tx-confirm \
242-
'{"node": <node_count>, "targetminers": ["<miner1_wallet_address>", "<miner2_wallet_address>" ...]}'
242+
-db-node <node_count> -db-target-miners "<miner1_wallet_address>, <miner2_wallet_address>, ..."
243243
```
244244

245245
命令执行完成后将会有类似如下的输出:

website/translated_docs/zh-CN/version-0.7.0/arch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ CQL 支持两种共识算法:
2727
1. DPoS (委任权益证明) 应用在数据库的 `最终一致性` 和 Block Producer 所在的 `第一层 (全局共识层)` ,CQL 的矿工在客户端将所有SQL查询及其签名打包成块,从而形成整个区块链,我们把这个算法命名为 [`Xenomint`](https://github.com/CovenantSQL/CovenantSQL/tree/develop/xenomint)
2828
2. BFT-Raft (拜占庭容错算法)<sup>[bft-raft](#bft-raft)</sup> 应用于数据库的 `强一致性`。我们把这个实现命名为 [`Kayak`](https://github.com/CovenantSQL/CovenantSQL/tree/develop/kayak). 矿工 leader 会基于 `Kayak``两阶段提交` 来支持 `Transaction`.<sup>[transaction](#transaction)</sup>
2929

30-
可以用命令行 `cql create '{"UseEventualConsistency": true, "Node": 3}'` 来创建 `最终一致性` CQL 数据库
30+
可以用命令行 `cql create -db-eventual-consistency -db-node 3` 来创建 `最终一致性` CQL 数据库
3131

3232

3333
## 项目对比

website/translated_docs/zh-CN/version-0.7.0/arch_layers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CQL 采用分层的架构进行数据库的创建和运行,一个典型的数
1010

1111
1. "矿工" 启动后会自动向主链注册,注册信息包括:"最低可以接受的 Gas 价格"、"系统配置信息"、"对外 IP 及端口" 等;
1212
2. "矿工" 通过 ChainBus 订阅并关注和自己相关的信息;
13-
3. 客户端运行 `cql create '{"node":2}'` ,向主链的任一 "出块节点"(BP: Block Producer)发送经过签名的数据库创建请求;
13+
3. 客户端运行 `cql create -db-node 2` ,向主链的任一 "出块节点"(BP: Block Producer)发送经过签名的数据库创建请求;
1414
4. 收到请求的 BP 在出块的过程(详见:[主链出块流程](#主链出块流程))中进行 "矿工" 和数据库创建请求的撮合;
1515
5. 数据库创建请求 和 撮合结果 在 其它 BP 节点进行验证和确认;
1616
6. "矿工" 订阅收到数据库任务;
@@ -33,4 +33,4 @@ CQL 采用分层的架构进行数据库的创建和运行,一个典型的数
3333

3434
![MainChain Produce Block](https://cdn.jsdelivr.net/gh/CovenantSQL/docs/website/static/img/produce-block.svg)
3535

36-
查看大图请点击[这里](https://cdn.jsdelivr.net/gh/CovenantSQL/docs/website/static/img/produce-block.svg)
36+
查看大图请点击[这里](https://cdn.jsdelivr.net/gh/CovenantSQL/docs/website/static/img/produce-block.svg)

website/translated_docs/zh-CN/version-0.7.0/deploy_miner.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,13 @@ docker run -it --rm -v $(pwd)/testnet/:/app/config/ \
233233

234234
由于需要在指定的 Miner 上创建 DB,需要在创建 DB 时指定提供服务的 Miner 列表
235235

236-
> `create` 命令接受一个 DB 实例的 json 描述;将 `node_count` 替换为所需的节点数量,例如 1 代表创建一个节点的 DB SideChain;`targetminers` 提供指定 miner 的钱包地址列表;另外需要格外注意的时,所需创建的 DB SideChain 的节点数量需要小于或等于提供的指定 miner 数量,否则 CovenantSQL 会在指定 miner 之外的公用 miner 中随机分配节点以满足用户所需节点数量要求。
236+
> `create` 命令接收一系列描述 DB 实例的参数,可以用 `cql help create` 查看详细参数;将 `node_count` 替换为所需的节点数量,例如 1 代表创建一个节点的 DB SideChain;`miner1_wallet_address, miner2_wallet_address ` 等替换为指定 miner 的钱包地址列表;另外需要格外注意的时,所需创建的 DB SideChain 的节点数量需要小于或等于提供的指定 miner 数量,否则 CovenantSQL 会在指定 miner 之外的公用 miner 中随机分配节点以满足用户所需节点数量要求。
237237
238238
```shell
239239
docker run -it --rm -v $(pwd)/client_config/:/app/config/ \
240240
--entrypoint /app/cql covenantsql/covenantsql:latest -- \
241241
create -config /app/config/config.yaml -wait-tx-confirm \
242-
'{"node": <node_count>, "targetminers": ["<miner1_wallet_address>", "<miner2_wallet_address>" ...]}'
242+
-db-node <node_count> -db-target-miners "<miner1_wallet_address>, <miner2_wallet_address>, ..."
243243
```
244244

245245
命令执行完成后将会有类似如下的输出:
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
id: version-0.7.0-arch
3+
title: Architecture
4+
original_id: arch
5+
---
6+
7+
## 3 Layers Arch
8+
9+
10+
![CovenantSQL 3 Layer design](https://github.com/CovenantSQL/CovenantSQL/raw/ed2878359345cd86e4221f14cd59e4654361b64e/logo/arch.png)
11+
12+
- Layer 1: **Global Consensus Layer** (the main chain, the middle ring in the architecture diagram):
13+
- There will only be one main chain throughout the network.
14+
- Mainly responsible for database Miner and the user’s contract matching, transaction settlement, anti-cheating, shard chain lock hash and other global consensus matters.
15+
- Layer 2: **SQL Consensus Layer** (shard chain, rings on both sides):
16+
- Each database will have its own separate shard chain.
17+
- Mainly responsible for: the signature, delivery and consistency of the various Transactions of the database. The data history of the permanent traceability is mainly implemented here, and the hash lock is performed in the main chain.
18+
- Layer 3: **Datastore Layer** (database engine with SQL-92 support):
19+
- Each Database has its own independent distributed engine.
20+
- Mainly responsible for: database storage & encryption, query processing & signature, efficient indexing.
21+
22+
## Consensus Algorithm
23+
24+
CQL supports 2 kinds of consensus algorithm:
25+
26+
1. DPoS (Delegated Proof-of-Stake) is applied in `Eventually consistency mode` database and also `Layer 1 (Global Consensus Layer)` in BlockProducer. CQL miners pack all SQL queries and its signatures by the client into blocks thus form a blockchain. We named the algorithm [`Xenomint`](https://github.com/CovenantSQL/CovenantSQL/tree/develop/xenomint).
27+
2. BFT-Raft (Byzantine Fault-Toleranted Raft)<sup>[bft-raft](#bft-raft)</sup> is applied in `Strong consistency mode` database. We named our implementation [`Kayak`](https://github.com/CovenantSQL/CovenantSQL/tree/develop/kayak). The CQL miner leader does a `Two-Phase Commit` with `Kayak` to support `Transaction`.<sup>[transaction](#transaction)</sup>
28+
29+
CQL database consistency mode and node count can be selected in database creation with command `cql create -db-eventual-consistency -db-node 3`
30+
31+
## Comparison
32+
33+
| | Ethereum | Hyperledger Fabric | Amazon QLDB | CovenantSQL |
34+
| ---------------------------- | ----------------- | ---------------------- | ----------- | ------------------------------------------------------------ |
35+
| **Dev language** | Solidity, ewasm | Chaincode (Go, NodeJS) | ? | Python, Golang, Java, PHP, NodeJS, MatLab |
36+
| **Dev Pattern** | Smart Contract | Chaincode | SQL | SQL |
37+
| **Open Source** | Y | Y | N | Y |
38+
| **Nodes for HA** | 3 | 15 | ? | 3 |
39+
| **Column Level ACL** | N | Y | ? | Y |
40+
| **Data Format** | File | Key-value | Document | File<sup>[fuse](#fuse)</sup>, Key-value, Structured |
41+
| **Storage Encryption** | N | API | Y | Y |
42+
| **Data Desensitization** | N | N | N | Y |
43+
| **Multi-tenant** | DIY | DIY | N | Y |
44+
| **Throughput (1s delay)** | 15~10 tx/s | 3500 tx/s | ? | 11065 tx/s (Eventually Consistency)<br/>1866 tx/s (Strong Consistency) |
45+
| **Consistency Delay** | 2~6 min | < 1 s | ? | < 10 ms |
46+
| **Secure for Open Internet** | Y | N | Only in AWS | Y |
47+
| **Consensus** | PoW + PoS(Casper) | CFT | ? | DPoS (Eventually Consistency)<br/>BFT-Raft (Strong Consistency) |
48+
49+
### FootNotes
50+
51+
- <a name="bft-raft">BFT-Raft</a>: A CQL leader offline needs CQL Block Producer to decide whether to wait for leader online for data integrity or promote a follower node for availability. This part is still under construction and any advice is welcome.
52+
53+
- <a name="transaction">Transaction</a>: Talking about `ACID`, CQL has full "Consistency, Isolation, Durability" and a limited `Atomicity` support. That is even under strong consistency mode, CQL transaction is only supported on the leader node. If you want to do "read `v`, `v++`, write `v` back" parallelly and atomically, then the only way is "read `v` from the leader, `v++`, write `v` back to leader"
54+
55+
- <a name="fuse">FUSE</a>: CQL has a [simple FUSE](https://github.com/CovenantSQL/CovenantSQL/tree/develop/cmd/cql-fuse) support adopted from CockroachDB. The performance is not very ideal and still has some issues. But it can pass fio test like:
56+
57+
```bash
58+
fio --debug=io --loops=1 --size=8m --filename=../mnt/fiotest.tmp --stonewall --direct=1 --name=Seqread --bs=128k --rw=read --name=Seqwrite --bs=128k --rw=write --name=4krandread --bs=4k --rw=randread --name=4krandwrite --bs=4k --rw=randwrite
59+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
id: version-0.7.0-arch_layers
3+
title: Blockchains
4+
original_id: arch_layers
5+
---
6+
7+
8+
## MainChain & SQLChain
9+
10+
CQL uses a layered architecture for database creation and operation. A typical data creation process can be roughly as follows:
11+
12+
1. Miner will automatically register with the MainChain after startup. The registration information includes: "Minimum acceptable Gas price", "System metrics", "External IP and port", etc.
13+
2. Miner subscribes to and pays attention to information related to themselves through ChainBus;
14+
3. The client runs `cql create -db-node 2` to send a signed database creation request to any BP (Block Producer) in the MainChain;
15+
4. The BP that received the request performs a match of Miner and database creation request in the process of producing the block (see: [MainChain Produce Block] (#mainchain-produce-block));
16+
5. Database creation requests and matching results are verified and confirmed at other BP nodes;
17+
6. The Miner subscription receives the database task;
18+
7. Miners discover and connect with each other through Kayak to form a SQLChain database cluster;
19+
8. All miners are ready to wait for a request;
20+
9. Users can connect to the database and execute SQL through the `cql console` command.
21+
22+
See the image below to view [large picture](https://cdn.jsdelivr.net/gh/CovenantSQL/docs@b7143254adb804dff0e3bc1f2f6ab11ad9cd44f5/website/static/img/2layers.svg)
23+
24+
![2layers](https://cdn.jsdelivr.net/gh/CovenantSQL/docs@b7143254adb804dff0e3bc1f2f6ab11ad9cd44f5/website/static/img/2layers.svg)
25+
26+
27+
## MainChain Produce Block
28+
29+
The complete main chain export process is complicated. Please refer to the numbers in the figure below for understanding. For the big picture, please click [here](https://cdn.jsdelivr.net/gh/CovenantSQL/docs/website/static/img/produce-block.svg)
30+
31+
![MainChain Produce Block](https://cdn.jsdelivr.net/gh/CovenantSQL/docs/website/static/img/produce-block.svg)
32+

website/versioned_docs/version-0.7.0/deploy_miner.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,13 @@ docker run -it --rm -v $(pwd)/testnet/:/app/config/ \
234234

235235
由于需要在指定的 Miner 上创建 DB,需要在创建 DB 时指定提供服务的 Miner 列表
236236

237-
> `create` 命令接受一个 DB 实例的 json 描述;将 `node_count` 替换为所需的节点数量,例如 1 代表创建一个节点的 DB SideChain;`targetminers` 提供指定 miner 的钱包地址列表;另外需要格外注意的时,所需创建的 DB SideChain 的节点数量需要小于或等于提供的指定 miner 数量,否则 CovenantSQL 会在指定 miner 之外的公用 miner 中随机分配节点以满足用户所需节点数量要求。
237+
> `create` 命令接收一系列描述 DB 实例的参数,可以用 `cql help create` 查看详细参数;将 `node_count` 替换为所需的节点数量,例如 1 代表创建一个节点的 DB SideChain;`miner1_wallet_address, miner2_wallet_address ` 等替换为指定 miner 的钱包地址列表;另外需要格外注意的时,所需创建的 DB SideChain 的节点数量需要小于或等于提供的指定 miner 数量,否则 CovenantSQL 会在指定 miner 之外的公用 miner 中随机分配节点以满足用户所需节点数量要求。
238238
239239
```shell
240240
docker run -it --rm -v $(pwd)/client_config/:/app/config/ \
241241
--entrypoint /app/cql covenantsql/covenantsql:latest -- \
242242
create -config /app/config/config.yaml -wait-tx-confirm \
243-
'{"node": <node_count>, "targetminers": ["<miner1_wallet_address>", "<miner2_wallet_address>" ...]}'
243+
-db-node <node_count> -db-target-miners "<miner1_wallet_address>, <miner2_wallet_address>, ..."
244244
```
245245

246246
命令执行完成后将会有类似如下的输出:

0 commit comments

Comments
 (0)