Skip to content

Commit f8d78e1

Browse files
committed
chore(publish): published 0.5.0 docs by [leventeliu]
1 parent 08de51e commit f8d78e1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

website/versioned_docs/version-0.5.0/cql_db_manage.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ The sub-command `create` sends transactions to block producers to create databas
2424

2525
For a complete help message, check [Complete Parameters](#sub-command-create-complete-parameters).
2626

27+
## Billing
28+
29+
CovenantSQL uses Gas for billing just like the [Ethereum Gas](https://www.ethos.io/what-is-ethereum-gas/). The gas unit (a.k.a., the `Gas-Price`) in stable token `Particle` is specified while creating the database, and its corresponding field is `gas-price`. If not specified in the json string, it will be set as 1 by default. Another billing-related field is `advance-payment`, which will be used as deposit and query expending. The default advance payment is 20,000,000. Creating a database with specified `Gas-Price` and `Advance-Payment`:
30+
31+
```bash
32+
cql create '{"node": 2, "gas-price": 5, "advance-payment": 500000000}'
33+
```
34+
35+
Thus we created a new database with `Gas-Price` 5 and `Advance-Payment` 500,000,000. Note that when the CovenantSQL network is short of miner resources, setting a higher `Gas-Price` will help your creation request to be accepted earlier, but it will cost you more tokens of course.
36+
37+
> At present, we only accept the CovenantSQL stable token Particle for database billing. More token types will be supported soon.
38+
39+
And the billing is processed as following:
40+
41+
- For a Read request, the result `rows_count` is counted as the `Gas` cost
42+
- For a Write request, the result `affected_rows` is counted as the `Gas` cost
43+
- The SQLChain miner does periodic billing, sums up, and reports the `Gas` cost to the main chain, and the main chain verifies and deducts `Gas` * `Gas Price` tokens from the user accounts
44+
2745
## ~~Deleting Database~~
2846

2947
~~Not yet implemented.~~
@@ -148,6 +166,8 @@ Either setting the `pattern` field to `nil` or just resetting the user permissio
148166
eventual-consistency bool // Use eventual consistency to sync among miner nodes
149167
consistency-level float // Consistency level, node*consistency_level is the node number to perform strong consistency
150168
isolation-level int // Isolation level in a single node
169+
gas-price int // Specified Gas Price of the database, default is 1 Particle
170+
advance-payment int // Specified advance payment of the database, default is 20,000,000 Particles
151171

152172
Since CovenantSQL is built on top of blockchains, you may want to wait for the transaction confirmation before the creation takes effect.
153173
e.g.

0 commit comments

Comments
 (0)