Description
Purpose of this transaction
Currently, CodeChain has a static scheme fixed from the genesis. In other words, CodeChain cannot change the operating rule, which is problematic when it comes to adding a new rule or changing the existing rule, such as the minimum fee.
So I want to add a new transaction to change the scheme.
What this transaction does
This transaction will change only the common parameters if enough stakeholders agree. The current stakes necessary to change the common parameters is more than 67% of the total stakes.
What this transaction doesn't do
Changing the fields other than the common parameters
It does not change the other fields of the scheme file, because there are fields related to the genesis block.
Voting
It does not provide a feature of voting. Voting makes the rule complicated. Instead of voting on the chain, the voting initiator should collect the signature through the off-chain.
[ [CHANGE_PARAMETERS_ID, metadata_seq, new_parameters], signatures ]
CHANGE_PARAMETERS_ID := u16
metadata_seq := 0
new_parameters := string
signatures := array of string
Transaction Properties
CHANGE_PARAMETERS_ID
0xFF
It's a constant number to distinguish from other transaction type.
metadata_seq
This field is introduced to prevent a replay attack. The metadata has a field to store seq
. It's increased when the parameter is changed.
new_parameters
new_parameters := [ new_parameter(, new_parameter)* ]
new_parameter := [ key ]
| [ key, value ]
key := string
value := usize | u64 | boolean | string
The list that has the fields that this transaction will change.
The stakeholder MUST NOT sign the transaction when it the type of value is not a type that the key expected.
The parameters that are not in the new_parameters
are kept as the previous value.
signatures
The ChangeParameters transaction is valid only when the sum of the stakes that signed in the transaction is greater than the threshold. It's the signature of [CHANGE_PARAMETERS_ID, metadata_seq, new_parameters]
.
State change
Metadata
Metadata state is affected.
One field is added to Metadata.
seq
It is a u32
field to prevent replay attacks. The transaction is invalid if the metadata_seq
of the transaction and seq
of the current metadata status is not the same.
To provide backward compatibility this field is not included in the RLP encoding when the value is zero.
Parameter
New state Parameter
is added. The prefix of Parameter
is "P"
.
The address of the Parameter
is blake256_with_key(parameter_name, 0)
The value is Option
of usize | u64 | bool | String
. It's None
when the parameter is explicitly deleted by transaction.
Each parameter field has a type it wants. The transaction that has a parameter of an unexpected type must be rejected.
To provide backward compatibility, this field is not included in the RLP encoding when seq
is zero.