|
9 | 9 | | **RELEASE_PERIOD** | 240 **TERM**s | |
10 | 10 | | **WITHDRAW_DELAY** | 1 **TERM** | |
11 | 11 | | **MAX_NUM_OF_VALIDATORS** | 30 | |
12 | | -| **MIN_NUM_OF_VALIDATORS** | TBD | |
| 12 | +| **MIN_NUM_OF_VALIDATORS** | 4 | |
13 | 13 | | **MIN_CCS_RATE_TO_BE_VALIDATOR** | 0.01 | |
14 | 14 | | **MIN_DEPOSIT** | TBD CCC | |
15 | 15 |
|
16 | 16 |
|
17 | 17 | ## FSM of Account States |
18 | | -``` |
19 | | - +--------+ |
20 | | - /--------->| Banned |<---+-------\ |
21 | | - | +--------+ | | |
22 | | - (6) (6) | |
23 | | - | | | |
24 | | -+----------------+ -(1)--> +-----------+ -(3)--> +-----------+ | |
25 | | -| Normal Account | | Candidate | | Validator | | |
26 | | -+----------------+ <--(2)- +-----------+ <--(4)- +-----------+ | |
27 | | - ^ ^ | | |
28 | | - | | +--------+ <--(5)-/ | |
29 | | - | \-(7)- | Jailed | -(6)-----------/ |
30 | | - \-------------------(9)- +--------+ |
31 | | - ^ | |
32 | | - | | |
33 | | - \-(8)-/ |
| 18 | +` |
| 19 | + +--------+ |
| 20 | + /--------->| Banned |<---+-------\ |
| 21 | + | +--------+ | | |
| 22 | + (6) (6) | |
| 23 | + | | | |
| 24 | ++----------+ -(1)--> +-----------+ -(3)--> +-----------+ | |
| 25 | +| Eligible | | Candidate | | Validator | | |
| 26 | ++----------+ <--(2)- +-----------+ <--(4)- +-----------+ | |
| 27 | + ^ ^ | | |
| 28 | + | | +--------+ <--(5)-/ | |
| 29 | + | \-(7)- | Jailed | -(6)-----------/ |
| 30 | + \-------------------(9)- +--------+ |
| 31 | + ^ | |
| 32 | + | | |
| 33 | + \-(8)-/ |
34 | 34 | ``` |
35 | 35 | 1. Send *SELF_NOMINATE* |
36 | 36 | 2. No *SELF_NOMINATE* while **NOMINATE_EXPIRATION** terms |
37 | 37 | 3. Elected |
38 | 38 | 4. End of term and the validator worked |
39 | 39 | 5. End of term and the validator didn't work |
40 | | -6. Double Vote dected |
| 40 | +6. Double Vote detected |
41 | 41 | 7. Send *SELF_NOMINATE* after **CUSTODY_PERIOD** |
42 | 42 | 8. Send *SELF_NOMINATE* before **CUSTODY_PERIOD** |
43 | 43 | 9. No *SELF_NOMINATE* during **RELEASE_PERIOD** |
44 | 44 |
|
45 | 45 | ## Term |
46 | | -Term is a period that one elected validator set works. |
47 | | -The term is almost one hour. |
48 | | -The block that's generation hour is different from the parent block's is the last block of a term. |
49 | | -CodeChain elects new validator set after all reward of the block is given. |
| 46 | +The term is a period when one elected validator set works, and lasts for almost an hour |
| 47 | +The block that has a different generation hour from the parent block's is the last block of a term. |
| 48 | +CodeChain elects a new validator set after all rewards of the block is given. |
50 | 49 |
|
51 | 50 | ## Nomination |
52 | | -Any account, that are not banned, can nominate itself. |
| 51 | +Any account that is not banned can nominate itself. |
53 | 52 | The account becomes a candidate when the sum of the deposit is more than **MIN_DEPOSIT**. |
54 | | -The nomination expires after **NOMINATION_EXPIRATION**; the account who wants to remain a candidate must nominate itself before the previous nomination expires. |
55 | | -The deposit revert to the account when it becomes a normal account. |
| 53 | +The nomination expires after **NOMINATION_EXPIRATION**; the account that wants to remain a candidate must nominate itself before the previous nomination expires. |
| 54 | +The deposit reverts to the account when it becomes an eligible account. |
| 55 | +
|
| 56 | +### Minimum Deposit |
| 57 | +TBD |
56 | 58 |
|
57 | 59 | ## Delegation |
58 | | -The stakeholders have the right to choose validators as must as their shares. |
59 | | -It's called a delegation. |
60 | | -And the stakeholders who has been delegated called delegators. |
61 | | -The delegation is valid only when the delegatee is not a normal account or not banned. |
62 | | -The delegated stakes are returned when the account becomes a normal account or banned. |
| 60 | +The stakeholders have the right to choose validators as much as their shares. |
| 61 | +This is called delegation, and the stakeholders who have been delegated called delegators. |
| 62 | +The delegation is valid only when the delegatee is not an eligible or not banned. |
| 63 | +The delegation is valid only when the delegatee is not eligible or banned. |
| 64 | +The delegated stakes are returned when the account becomes an eligible account or a banned account. |
63 | 65 |
|
64 | 66 | ## Election |
65 | | -The process that elects validators of a term is called election. |
66 | | -The election selects validators as the following rule. |
67 | | -<<<<<<< |
68 | | -1. **MAX_NUM_OF_VALIDATORS** accounts in order of having received many delegations. |
69 | | -2. Pick **MIN_NUM_OF_VALIDATORS** accounts; they become validators. |
70 | | -3. In the rest of them, drops the accounts having received less than **MIN_CCS_RATE_TO_BE_VALIDATOR**. |
71 | | -4. The remains become validators. |
72 | | -======= |
73 | | -The initial *MIN_DELEGATION* is **MIN_CCS_RATE_TO_BE_VALIDATOR**. |
74 | | -1. Pick accounts in order of having received many delegations. |
75 | | -2. Drops the accounts having received more than *MIN_DELEGATION* |
76 | | -3. If the number of accounts are more than **MIN_NUM_OF_VALIDATORS** selects top **MAX_NUM_OF_VALIDATORS** accounts. |
77 | | -4. Otherwise, repeat from step 1 after changing *MIN_DELEGATION* to half. |
78 | | ->>>>>>> |
| 67 | +The election is a process that elects validators of a term according to the following rule: |
| 68 | +
|
| 69 | +1. TBD |
| 70 | +
|
| 71 | +## Voting Power |
| 72 | +Each elected validators has different voting power. |
| 73 | +The voting power is based on the delegation that the validator received at the election. |
| 74 | +The block is valid only if the sum of voting power is more than 2/3 of the total delegations that the elected validators received. |
| 75 | +
|
| 76 | +## Validator Reward |
| 77 | +The block proposer gets the express fee of the blocks at the end of a term. |
| 78 | +Validators can get the reward after **WITHDRAW_DELAY** terms; however, the proposers cannot get all the reward if they are not loyal to their duty. |
| 79 | +The reward is decreased according to the rate of the blocks the validator misses to sign. |
| 80 | +TBD: The rate of decreasing. |
| 81 | +
|
| 82 | +## Punishment for Validators |
| 83 | +### Downtime |
| 84 | +The validator who doesn't produce blocks is jailed for a while. |
| 85 | +The jailed account cannot be a candidate during **CUSTODY_PERIOD**. |
| 86 | +*SELF_NOMINATE* transactions of the account are rejected; however, this is not a punishment. |
| 87 | +It is to give validators time to fix the nodes that they manage. |
| 88 | +The jailed account can nominate itself again after **CUSTODY_PERIOD**. |
| 89 | +
|
| 90 | +### Disloyal Validators |
| 91 | +CodeChain gives a penalty to validators who doesn't participate in signing the blocks proposed by other nodes. |
| 92 | +See [Validator Reward](#Validator-Reward) for more information. |
| 93 | +
|
| 94 | +### Double Vote |
| 95 | +CodeChain bans the account who double voted. |
| 96 | +The deposit and the reward the criminal earns is slashed and is given to the informant reporting the double vote. |
79 | 97 |
|
80 | 98 | ## Transactions |
81 | 99 | ### SELF_NOMIATION |
82 | 100 | * quantity |
83 | 101 | * metadata(TBD) |
84 | 102 |
|
| 103 | +This transaction registers the sender to the candidate when the sum of the deposit is larger than **MIN_DEPOSIT**. |
| 104 | +The nomination is valid in **NOMINATE_EXPIRATION**. |
| 105 | +
|
| 106 | +The account cannot withdraw the deposit manually, and is returned automatically when the account becomes an eligible account. |
| 107 | +
|
85 | 108 | ### WITHDRAW |
86 | 109 | * quantity |
87 | 110 |
|
88 | | -### DELEGATION |
| 111 | +This transaction withdraws the reward that the node earns as a validator. |
| 112 | +But the validator cannot withdraw the reward before **WITHDRAW_DELAY** passes. |
| 113 | +
|
| 114 | +The transaction that tries to withdraw more than what the account has will fail. |
| 115 | +
|
| 116 | +### DELEGATE |
89 | 117 | * delegatee |
90 | 118 | * quantity |
91 | 119 |
|
92 | | -### REVOCATION |
| 120 | +It's a transaction used by the stakeholders to select the validators. |
| 121 | +The validator can delegate as much stakes as they have. |
| 122 | +The validator can delegate any candidates, including validators and jailed accounts. |
| 123 | +The delegations return automatically when the delegatee becomes eligible or banned. |
| 124 | +
|
| 125 | +*DELEGATE* transactions to banned or eligible accounts fail. |
| 126 | +
|
| 127 | +
|
| 128 | +### REVOKE |
93 | 129 | * delegatee |
94 | 130 | * quantity |
95 | 131 |
|
96 | | -### DOUBLE_VOTE |
| 132 | +It's a transaction used by the stakeholders to revoke the delegation. |
| 133 | +The validator can revoke delegations at any time without delay. |
| 134 | +The revoke occurs immediately, but the validator cannot be ousted before its term is over. |
| 135 | +
|
| 136 | +The transaction fails when the delegator revokes more than it delegates. |
| 137 | +
|
| 138 | +### REPORT_DOUBLE_VOTE |
97 | 139 | * header1 |
98 | | -* seig1 |
| 140 | +* sig1 |
99 | 141 | * header2 |
100 | 142 | * sig2 |
| 143 | +
|
| 144 | +This is a transaction that reports malicious validator. |
| 145 | +The **REPORT_DOUBLE_VOTE** should be reported during **WITHDRAW_DELAY**. |
| 146 | +The transaction that reports a double vote have occurred before **WITHDRAW_DELAY** fails. |
| 147 | +
|
| 148 | +The criminal loses all his deposit and rewards and is banned immediately; it is the only case where a validator set is changed during the term. |
| 149 | +
|
| 150 | +The informant receives all deposit and rewards(TBD) as prize money immediately. |
| 151 | +
|
| 152 | +The criminal becomes a banned account. |
| 153 | +The account cannot become a candidate anymore. |
| 154 | +In other words, the *DELEGATE* transaction to the banned account and the *SELF_NOMINATE* transaction from the banned account fal. |
0 commit comments