|
| 1 | +# Dynamic Validator |
| 2 | + |
| 3 | +## Constants |
| 4 | +| name | value | |
| 5 | +|----------------------------------|---------------| |
| 6 | +| **TERM** | 1 hour | |
| 7 | +| **NOMINATION_EXPIRATION** | 24 **TERM**s | |
| 8 | +| **CUSTODY_PERIOD** | 24 **TERM**s | |
| 9 | +| **RELEASE_PERIOD** | 240 **TERM**s | |
| 10 | +| **WITHDRAW_DELAY** | 1 **TERM** | |
| 11 | +| **MAX_NUM_OF_VALIDATORS** | 30 | |
| 12 | +| **MIN_NUM_OF_VALIDATORS** | TBD | |
| 13 | +| **MIN_CCS_RATE_TO_BE_VALIDATOR** | 0.01 | |
| 14 | +| **MIN_DEPOSIT** | TBD CCC | |
| 15 | + |
| 16 | + |
| 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)-/ |
| 34 | +``` |
| 35 | +1. Send *SELF_NOMINATE* |
| 36 | +2. No *SELF_NOMINATE* while **NOMINATE_EXPIRATION** terms |
| 37 | +3. Elected |
| 38 | +4. End of term and the validator worked |
| 39 | +5. End of term and the validator didn't work |
| 40 | +6. Double Vote dected |
| 41 | +7. Send *SELF_NOMINATE* after **CUSTODY_PERIOD** |
| 42 | +8. Send *SELF_NOMINATE* before **CUSTODY_PERIOD** |
| 43 | +9. No *SELF_NOMINATE* during **RELEASE_PERIOD** |
| 44 | + |
| 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. |
| 50 | + |
| 51 | +## Nomination |
| 52 | +Any account, that are not banned, can nominate itself. |
| 53 | +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. |
| 56 | + |
| 57 | +## 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. |
| 63 | + |
| 64 | +## 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 | +>>>>>>> |
| 79 | +
|
| 80 | +## Transactions |
| 81 | +### SELF_NOMIATION |
| 82 | +* quantity |
| 83 | +* metadata(TBD) |
| 84 | + |
| 85 | +### WITHDRAW |
| 86 | +* quantity |
| 87 | + |
| 88 | +### DELEGATION |
| 89 | +* delegatee |
| 90 | +* quantity |
| 91 | + |
| 92 | +### REVOCATION |
| 93 | +* delegatee |
| 94 | +* quantity |
| 95 | + |
| 96 | +### DOUBLE_VOTE |
| 97 | +* header1 |
| 98 | +* seig1 |
| 99 | +* header2 |
| 100 | +* sig2 |
0 commit comments