Governance API
This document describes the API interfaces of the Ontology Governance Contract.
Users can use governance contract to apply to participate in the consensus node election, stake to vote for candidate nodes, exit the consensus node election, and so on. Staked ONT will generate rewards according to certain rules.
API
InitConfig
InitConfig
Function: Initializes the governance contract, only called during the creation of the genesis block (system method).
Method Name: "initConfig"
Parameters: None
Return Value: bool
, error
RegisterCandidate
RegisterCandidate
Function: Stakes a certain amount of ONT and consumes some extra ONG to apply to become a candidate node.
Method Name: "registerCandidate"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Node public key |
1 |
| Wallet address |
2 |
| Amount of staked ONT |
3 |
| OntID of the caller |
4 |
| Public key index of the caller |
Return Value: bool
, error
RegisterCandidateTransferFrom
RegisterCandidateTransferFrom
Function: Stakes a certain amount of ONT and consumes some extra ONG to apply to become a candidate node, used for contract invocation.
Method Name: "registerCandidateTransferFrom"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Node public key |
1 |
| Wallet address |
2 |
| Amount of staked ONT |
3 |
| OntID of the caller |
4 |
| Public key index of the caller |
Return Value: bool
, error
QuitNode
QuitNode
Function: Node application to exit, entering the normal exit process. The wallet address must be the same as the one used for application.
Method Name: "quitNode"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Node public key |
1 |
| Wallet address |
Return Value: bool
, error
AuthorizeForPeer
AuthorizeForPeer
Function: Vote for a node by staking ONT.
Method Name: "authorizeForPeer"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Wallet address |
1 |
| List of nodes to vote for |
2 |
| Number of votes for each node |
Return Value: bool
, error
AuthorizeForPeerTransferFrom
AuthorizeForPeerTransferFrom
Function: Vote for a node by staking ONT, used for contract invocation.
Method Name: "authorizeForPeerTransferFrom"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Wallet address |
1 |
| List of nodes to vote for |
2 |
| Number of votes for each node |
Return Value: bool
, error
UnAuthorizeForPeer
UnAuthorizeForPeer
Function: Revoke the vote by redeeming the staked ONT.
Method Name: "unAuthorizeForPeer"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Wallet address |
1 |
| List of nodes to revoke votes from |
2 |
| Number of votes to revoke |
Return Value: bool
, error
Withdraw
Withdraw
Function: Withdraw staked ONT that is in an unfrozen state.
Method Name: "withdraw"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Wallet address |
1 |
| List of nodes to withdraw from |
2 |
| Amount to withdraw |
Return Value: bool
, error
WithdrawOng
WithdrawOng
Function: Withdraw unbound ONG.
Method Name: "withdrawOng"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Wallet address |
Return Value: bool
, error
WithdrawFee
WithdrawFee
Function: Withdraw fee dividends.
Method Name: "withdrawFee"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Wallet address |
Return Value: bool
, error
CommitDpos
CommitDpos
Function: Consensus switch based on the current voting results, system method.
Method Name: "commitDpos"
Parameters: None
Return Value: bool
, error
ChangeMaxAuthorization
ChangeMaxAuthorization
Function: Node modifies the maximum amount of ONT it can accept for authorization.
Method Name: "changeMaxAuthorization"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Node public key |
1 |
| Wallet address |
2 |
| Maximum amount authorized |
Return Value: bool
, error
SetFeePercentage
SetFeePercentage
Function: Allows a node to set its exclusive incentive percentage.
Method Name: "setFeePercentage"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Node public key |
1 |
| Wallet address |
2 |
| Exclusive incentive percentage for node |
3 |
| Exclusive incentive percentage for user |
Returns: bool
, error
AddInitPos
AddInitPos
Function: Increases the initial position (initPos) of the node, can only be called by the node owner.
Method Name: "addInitPos"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Node public key |
1 |
| Wallet address |
2 |
| Amount to increase in initPos |
Returns: bool
, error
ReduceInitPos
ReduceInitPos
Function: Decreases the initial position (initPos) of the node. Can only be called by the node owner. The initPos cannot be lower than the committed value and must be at least one-tenth of the authorized amount.
Method Name: "reduceInitPos"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Node public key |
1 |
| Wallet address |
2 |
| Amount to decrease in initPos |
Returns: bool
, error
GetPeerPool
GetPeerPool
Function: Retrieves detailed information about consensus nodes and candidate nodes.
Method Name: "getPeerPool"
Parameters: None
Returns: []byte
, error
Serialized Return Values:
GetPeerInfo
GetPeerInfo
Function: Retrieves detailed information about a node based on its address.
Method Name: "getPeerInfo"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Node address |
Returns: []byte
, error
Serialized Return Values:
GetPeerPoolByAddress
GetPeerPoolByAddress
Function: Retrieves a list of detailed information about nodes based on the staking address.
Method Name: "getPeerPoolByAddress"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Node address |
Returns: []byte
, error
Serialized Return Values:
GetAuthorizeInfo
GetAuthorizeInfo
Function: Retrieves authorization information for voting.
Method Name: "getAuthorizeInfo"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| Node public key |
1 |
| Voter's address |
Returns: []byte
, error
Serialized Return Values:
GetAddressFee
GetAddressFee
Function: Retrieves the reward amount for a user's address.
Method Name: "getAddressFee"
Parameters:
Index | Type | Description |
---|---|---|
0 |
| User address |
Returns: []byte
, error
Serialized Return Values:
Last updated