Skip to content

Commit 3c396df

Browse files
Seung Woo Kimkseo
authored andcommitted
Add information about sharding
1 parent 88a89d0 commit 3c396df

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

docs/sharding.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.. _sharding:
2+
3+
#########################
4+
Sharding
5+
#########################
6+
When it comes to blockchain technology that utilize PoW consensus algorithms, there exists issues related to scalability. In order to scale out, CodeChain provides sharding.
7+
8+
To provide sharding, we divide CodeChain’s state into two. The top-level state contains data necessary to operate CodeChain. For instance, these data could be a shard’s root,
9+
a platform account that holds CCC, or a dynamic validator set. The other state, known as the shard-level state, contains data that are related to the assets, such as the asset
10+
scheme. Thus, sharding allows CodeChain to divide and store all data related to assets. In other words, CodeChain can be viewed as having a single top-level state with multiple
11+
shard-level states branching out.
12+
13+
A node that only has a top-level state without a shard-level state, is called a top-level node. Conversely, a node that has all the shard states is called a full node. If a node
14+
contains a top-level state with certain shard states, it is called a shard node.
15+
16+
However, this does not mean that sharding is always necessary. Sharding is a solution for PoW’s scalability issue. Thus, if Tendermint, or a similar consensus algorithm, is used,
17+
then sharding is not necessary. For these scenarios, you can configure the specific chain that you are using to utilize sharding. However, even if you do not use sharding, it does
18+
not mean that the two state levels will become one. If sharding is not used, then the beacons will behave as the top-level node, and will verify every transaction.
19+
20+
In the case where sharding is used, it is sufficient for the beacon to be the top-level node. In this situation, the verification of ChangeShardState parcel is delegated to the
21+
shard validator, and beacon uses the verified ChangeShardState parcel to generate the block using only the top-level state.
22+
23+
Shard Validator
24+
==========================
25+
When using a shard, the ChangeShardState action must be verified by the Shard Validator. The Shard Validator is randomly selected from the registered shard validator pool.
26+
27+
TBC
28+
==========================
29+
[TO BE COMPLETED]
30+
31+
RPC
32+
==========================
33+
When using shards, ChangeShardState action can only take place once validator signatures are gathered. The RPCs that exist for this purpose are `shardValidator_registerAction
34+
<https://github.com/CodeChain-io/codechain/blob/master/spec/JSON-RPC.md#shardvalidator_registeraction>`_ and `shardValidator_getSignatures
35+
<https://github.com/CodeChain-io/codechain/blob/master/spec/JSON-RPC.md#shardvalidator_getsignatures>`_. shardValidator_registerAction propagates the surrounding nodes
36+
so that the shard validator can accept and sign an action. The shard validator that receives the action verifies the action and propagates its signature around it.
37+
Through shardValidator_getSignatures, the node can get the signatures it receives.
38+
39+
how-to-configure.rst
40+
==========================
41+
::
42+
43+
[shard_validator]
44+
disable = true
45+
46+
47+
CLI Options for CodeChain client
48+
``--shard-validator=[ACCOUNT]`` Specify the account for shard validator.
49+
``--shard-validator-password-path=[PATH]`` Specify the password path of account for shard validator.
50+

0 commit comments

Comments
 (0)