네트워크 거버넌스를 위해 Klaytn은 다음과 같이 governance namespace의 API를 제공합니다.
Klaytn에는 세 가지 거버넌스 모드가 있습니다.
none: 네트워크에 참여하는 모든 노드는 환경설정을 변경할 권리가 있습니다.
single: 오직 하나의 특정 노드가 환경설정을 변경할 권리를 가집니다.
ballot: 의결권이 있는 모든 노드가 환경설정 변경에 투표할 수 있습니다. 전체 의결권 중 절반 이상이 모이면 해당 의제는 통과됩니다.
거버넌스 모드 종류에 따라 제안자는 단위 가격, 최소 예치 금액 등 네트워크 파라미터에 대해 투표할 수 있습니다. 제안자가 되기 위해서 노드는 최소 기준 이상의 KLAY를 예치해야 합니다. 자격이 있는 노드들은 블록을 제안할 권리를 가지지만, 실제 제안자로 선정될 확률은 예치 금액에 따라 결정됩니다.
특정 기간 동안의 제안자 선정 슬롯(기회)의 수를 결정하기 위해 예치금 비율을 계산할 때 숫자 반올림으로 인해 노드에 슬롯이 한 개도 부여되지 않을 수 있습니다. 하지만 최소 기준 KLAY를 예치한 자격있는 노드에게는 슬롯이 보장됩니다.
노드가 자격이 없을 경우, 즉 노드가 충분한 양의 KLAY를 예치하지 않는다면, 블록을 제안하거나 검증할 기회가 주어지지 않을 것입니다.
주의 사항
거버넌스 노드는 예외적으로 single 모드에서 항상 자격이 있습니다.
블록이 제안될 때 투표가 이루어집니다. 이 투표는 블록이 제안된 주기를 포함한 두 주기 이후에 반영됩니다. 예외적으로 addValidator/removeValidator만 즉시 적용됩니다.
governance_vote
vote 메서드는 새로운 투표를 제출합니다. 거버넌스 모드에 의거하여 노드가 의결권을 가지는 경우 투표할 수 있습니다. 그렇지 않으면 오류 메시지가 반환되고 투표는 무시됩니다.
Parameters
Key : 변경하고자 하는 환경설정의 이름입니다. 키는 domain.field의 형식으로 되어 있습니다.
Value : 각 키에 대한 다양한 형태의 값입니다.
Key
Description
"governance.governancemode"
STRING. 세 거버넌스 모드 중 하나입니다. "none", "single", "ballot" 등 세 가지 모드 중 하나를 선택합니다.
"governance.governingnode"
ADDRESS. 거버넌스를 통제하는 특정 노드의 주소입니다. 거버넌스 모드가 "single"인 경우에만 해당합니다. 예를 들어, "0xe733cb4d279da696f30d470f8c04decb54fcb0d2"입니다.
"governance.unitprice"
NUMBER. 가스당 가격입니다. 예를 들어, 25000000000입니다.
"governance.addvalidator"
ADDRESS. 새로운 검증자 후보의 주소입니다. 예를 들어, 0xe733cb4d279da696f30d470f8c04decb54fcb0d2입니다.
NUMBER. Policy to generate the transaction hash and receipt hash in a block header. See here for available options. e.g., 2 (DeriveShaConcat)
"governance.govparamcontract"
ADDRESS. Address of the GovParam contract. e.g., 0xe733cb4d279da696f30d470f8c04decb54fcb0d2
"istanbul.epoch"
NUMBER. A period in which votes are gathered in blocks. When an epoch end, all votes which haven't been passed will be cleared. e.g., 86400
"istanbul.committeesize"
NUMBER. The number of validators in a committee.(sub in chain configuration) e.g., 7
"reward.mintingamount"
STRING. Amount of Peb minted when a block is generated. Double quotation marks are needed for a value. e.g., "9600000000000000000"
"reward.ratio"
STRING. Distribution rate for a CN/KGF/KIR separated by "/". The sum of all values has to be 100. e.g., "50/40/10" meaning CN 50%, KGF 40%, KIR 10%
"reward.kip82ratio"
STRING. Distribution ratio of the block proposer to stakers separated by "/". The sum of all values has to be "100". See KIP-82 for further details. e.g., "20/80" means that the proposer takes 20% while stakers take 80%.
"reward.useginicoeff"
BOOL. Use the Gini coefficient or not. true, false
"reward.deferredtxfee"
BOOL. The way of giving transaction fee to a proposer. If true, it means the tx fee will be summed up with block reward and distributed to the proposer, KIR and KGF. If not, all tx fee will be given to the proposer. true, false
"reward.minimumstake"
STRING. Amount of Klay required to be a CN (Consensus Node). Double quotation marks are needed for a value. e.g., "5000000"
"kip71.lowerboundbasefee"
NUMBER. The lowest possible base fee. See KIP-71 for further details. e.g., 25000000000
"kip71.upperboundbasefee"
NUMBER. The highest possible base fee. e.g., 750000000000
"kip71.gastarget"
NUMBER. The block gas that base fee wants to achieve. The base fee increases when parent block contains more than gas target, and decreases when parent block contains less than gas target. e.g., 30000000
"kip71.basefeedenominator"
NUMBER. Controls how fast base fee changes. e.g., 20
"kip71.maxblockgasusedforbasefee"
NUMBER. The maximum block gas perceived in base fee calculation. e.g., 60000000
Return Value
Type
Description
String
투표 제출 결과입니다.
Example
>governance.vote ("governance.governancemode","ballot")"Your vote was successfully placed.">governance.vote ("governance.governingnode","0x12345678990123456789901234567899012345678990")"Your vote was successfully placed.">governance.vote("istanbul.epoch",604800)"Your vote was successfully placed.">governance.vote("governance.unitprice",25000000000)"Your vote was successfully placed.">governance.vote("istanbul.committeesize",7)"Your vote was successfully placed.">governance.vote("reward.mintingamount","9600000000000000000")"Your vote was successfully placed.">governance.vote("reward.ratio","40/30/30")"Your vote was successfully placed.">governance.vote("reward.useginicoeff",false)"Your vote was successfully placed."// If wrong data are given>governance.vote("reward.ratio",100)"Your vote couldn't be placed. Please check your vote's key and value">governance.vote("governance.governingnode",1234)"Your vote couldn't be placed. Please check your vote's key and value"// when `governancemode` is "single" and the node is not `governingnode`>governance.vote("governance.governancemode","ballot")"You don't have the right to vote"
governance_showTally
showTally 속성은 거버넌스 투표의 현재 집계를 제공합니다. 집계된 찬성률을 백분율로 나타냅니다. 50%가 넘으면 해당 의제는 통과됩니다.
totalVotingPower 속성은 CN들이 보유한 의결권 합계를 나타냅니다. 각 CN은 1.0 ~ 2.0의 의결권을 가집니다. "none", "single" 거버넌스 모드에서는 totalVotingPower 속성을 통해 제공하는 정보가 없습니다.
Parameters
None
Return Value
Type
Description
Float
총 의결권 또는 오류 메시지를 반환합니다.
Example
// In "ballot" governance mode>governance.totalVotingPower32.452// In "none", "single" governance mode>governance.totalVotingPower"In current governance mode, voting power is not available"
governance_myVotingPower
myVotingPower 속성은 노드가 보유한 의결권을 나타냅니다. The voting power can be 1.0 ~ 2.0. In "none", "single" governance mode, totalVotingPower don't provide any information.
Parameters
None
Return Value
Type
Description
Float
노드의 의결권 또는 오류 메시지를 반환합니다.
Example
// In "ballot" governance mode>governance.myVotingPower1.323// In "none", "single" governance mode>governance.myVotingPower"In current governance mode, voting power is not available"
governance_myVotes
myVotes 속성은 투표 주기 동안의 투표 정보를 나타냅니다. 사용자의 노드가 새로운 블록을 생성할 때 각 투표가 블록에 저장됩니다. 현재 투표 주기가 종료되면 이 정보는 사라집니다.
Parameters
None
Return Value
Type
Description
Vote List
Node's Voting status in the epoch
- BlockNum: The block number that this vote is stored
- Casted: If this vote is stored in a block or not
- Key/Value: The content of the vote
Example
>governance.vote("governance.governancemode","ballot")"Your vote was successfully placed.">governance.myVotes[{ BlockNum:403, Casted:true, Key:"governance.governancemode", Value:"ballot"}]
governance_getChainConfig
The getChainConfig returns the chain configuration at a specific block. If the parameter is not set, it returns the chain configuration at the latest block.
Parameters
Type
Description
QUANTITY | TAG
Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter.
NOTE: The block number can be larger than the latest block number, in which case the API returns the tentative value based on the current chain state. The future governance parameters are subject to change via additional governance votes or GovParam contract state changes.
NOTE: the RPC API will be deprecated since v1.11. However, the governance.chainConfig property in the Klaytn JavaScript console is removed since Klaytn v1.10.2.
NOTE: In versions earlier than Klaytn v1.10.0, this API returned the initial chain configuration. However, due to its confusing name, it is updated since Klaytn v1.10.0. To query the initial chain configuration, use chainConfigAt(0) instead.
The chainConfigAt returns the chain configuration at a specific block. If the parameter is not set, it returns the chain configuration at the latest block.
Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter.
NOTE: The block number can be larger than the latest block number, in which case the API returns the tentative value based on the current chain state. The future governance parameters are subject to change via additional governance votes or GovParam contract state changes.
The nodeAddress property provides the address of the node that a user is using. It is derived from the nodekey and used to sign consensus messages. And the value of "governingnode" has to be one of validator's node address.
The getParams returns governance parameters at a specific block.
Parameters
Type
Description
QUANTITY | TAG
Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter.
NOTE: The block number can be larger than the latest block number, in which case the API returns the tentative value based on the current chain state. The future governance parameters are subject to change via additional governance votes or GovParam contract state changes.
Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter.
NOTE: In versions earlier than Klaytn v1.7.0, only integer block number, the string "earliest" and "latest" are available.
NOTE: The block number can be larger than the latest block number, in which case the API returns the tentative value based on the current chain state. The future governance parameters are subject to change via additional governance votes or GovParam contract state changes.
The pendingChanges returns the list of items that have received enough number of votes but not yet finalized. At the end of the current epoch, these changes will be finalized and the result will be in effect from the epoch after next epoch.
Parameters
None
Return Value
Type
Description
Vote List
Currently pending changes composed of keys and values
The idxCache property returns an array of current idxCache in the memory cache. idxCache contains the block numbers where governance change happened. The cache can have up to 1000 block numbers in memory by default.
Parameters
None
Return Value
Type
Description
uint64 array
Block numbers where governance change happened
Example
>governance.idxCache[0,30]
governance_idxCacheFromDb
The idxCacheFromDb returns an array that contains all block numbers on which a governance change ever happened. The result of idxCacheFromDb is the same or longer than that of idxCache
Parameters
None
Return Value
Type
Description
uint64 array
Every block numbers where governance change happened
Example
>governance.idxCacheFromDb[0,30]
governance_itemCacheFromDb
The itemCacheFromDb returns the governance information stored in the given block. If no changes were stored in the given block, the function returns null.
Parameters
Type
Description
uint64
A block number to query the governance change made in the block.
Returns the rewards information accumulated within the given block range [first, last].
NOTE: The block range should be less than 604800 (about 7 days) to protect endpoints from the resource exhaustion.
Parameters
Type
Description
QUANTITY | TAG
Accumulation start (first) block number, inclusive. Integer of a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.
QUANTITY | TAG
Accumulation end (last) block number, inclusive. Integer of a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.