AElf.Contracts.Consensus.AEDPoS
AEDPoS contract.
Used to managing block producers and synchronizing data.
Implement AElf Standards ACS1, ACS4, ACS6, ACS10 and ACS11.
Contract Methods
Method Name |
Request Type |
Response Type |
Description |
---|---|---|---|
InitialAElfConsensusContract |
Initialize the consensus contract. |
||
FirstRound |
Initializes the consensus information in the first round. |
||
UpdateValue |
Update consensus information. |
||
NextRound |
Update consensus information, create a new round. |
||
NextTerm |
Update consensus information, create a new term. |
||
UpdateTinyBlockInformation |
Update consensus tiny block information. |
||
SetMaximumMinersCount |
Set the maximum count of miners, by default, is unlimited. If you want to control the count of miners, you need to set it through parliament. |
||
ChangeMaximumMinersCountController |
The authority information for SetMaximumMinersCount, by default, is governed by parliament. |
||
RecordCandidateReplacement |
Election Contract can notify AEDPoS Contract to aware candidate replacement happened. |
||
GetCurrentMinerList |
Get the list of current miners. |
||
GetCurrentMinerPubkeyList |
Get the list of current miners (hexadecimal format). |
||
GetCurrentMinerListWithRoundNumber |
Get the list of current miners and current round number. |
||
GetRoundInformation |
Get information of the round according to round number. |
||
GetCurrentRoundNumber |
Get the current round number. |
||
GetCurrentRoundInformation |
Get the current round information. |
||
GetPreviousRoundInformation |
Get the previous round information. |
||
GetCurrentTermNumber |
Get the current term number. |
||
GetCurrentTermMiningReward |
Get the welfare reward the current term. |
||
GetMinerList |
Get the list of miners according to term number. |
||
GetPreviousMinerList |
Get the list of miner in previous term. |
||
GetMinedBlocksOfPreviousTerm |
Get the amount of mined blocks in previous term. |
||
GetNextMinerPubkey |
Get the miner that produces the next block. |
||
IsCurrentMiner |
Check to see if the account address is on the miner list for the current round. |
||
GetNextElectCountDown |
Query the left time before the next election takes effects (seconds). |
||
GetPreviousTermInformation |
Get term information according term number. |
||
GetRandomHash |
Get random hash (Keep this for compatibility). |
||
GetMaximumBlocksCount |
Get the maximum of tiny blocks produced by a miner each round. |
||
GetMaximumMinersCount |
Get the maximum count of miners. |
||
GetMaximumMinersCountController |
Get the authority information for SetMaximumMinersCount. |
||
GetMainChainCurrentMinerList |
Gets the list of miners in the main chain. |
||
GetPreviousTermMinerPubkeyList |
Get the list of miners in the previous term. |
||
GetCurrentMiningRewardPerBlock |
Query the current mining reward for each block. |
||
SetMinerIncreaseInterval |
Set the current miner growth time interval. |
||
GetMinerIncreaseInterval |
Get the current miner growth time interval. |
AElf.Standards.ACS1
Method Name |
Request Type |
Response Type |
Description |
---|---|---|---|
SetMethodFee |
Set the method fees for the specified method. Note that this will override all fees of the method. |
||
ChangeMethodFeeController |
Change the method fee controller, the default is parliament and default organization. |
||
GetMethodFee |
Query method fee information by method name. |
||
GetMethodFeeController |
Query the method fee controller. |
AElf.Standards.ACS4
Method Name |
Request Type |
Response Type |
Description |
---|---|---|---|
GetConsensusCommand |
Generate a consensus command based on the consensus contract state and the input public key. |
||
GetConsensusExtraData |
Generate consensus extra data when a block is generated. |
||
GenerateConsensusTransactions |
Generate consensus system transactions when a block is generated. Each block will contain only one consensus transaction, which is used to write the latest consensus information to the State database. |
||
ValidateConsensusBeforeExecution |
Before executing the block, verify that the consensus information in the block header is correct. |
||
ValidateConsensusAfterExecution |
After executing the block, verify that the state information written to the consensus is correct. |
AElf.Standards.ACS6
Method Name |
Request Type |
Response Type |
Description |
---|---|---|---|
GetRandomBytes |
Get random number according to block height. |
AElf.Standards.ACS10
Method Name |
Request Type |
Response Type |
Description |
---|---|---|---|
Donate |
Donates tokens from the caller to the treasury. If the tokens are not native tokens in the current chain, they will be first converted to the native token. |
||
Release |
Release dividend pool according the period number. |
||
SetSymbolList |
Set the token symbols dividend pool supports. |
||
GetSymbolList |
Query the token symbols dividend pool supports. |
||
GetUndistributedDividends |
Query the balance of undistributed tokens whose symbols are included in the symbol list. |
||
GetDividends |
Query the dividend information according to the height. |
AElf.Standards.ACS11
Method Name |
Request Type |
Response Type |
Description |
---|---|---|---|
UpdateInformationFromCrossChain |
Update the consensus information of the side chain. |
||
GetChainInitializationInformation |
Get the current miner list and consensus round information. |
||
CheckCrossChainIndexingPermission |
Verify that the input address is the current miner. |
Contract Types
AElf.Contracts.Consensus.AEDPoS
AEDPoS.AElfConsensusHeaderInformation
Field |
Type |
Description |
Label |
---|---|---|---|
sender_pubkey |
The sender public key. |
||
round |
The round information. |
||
behaviour |
The behaviour of consensus. |
AEDPoS.AElfConsensusHint
Field |
Type |
Description |
Label |
---|---|---|---|
behaviour |
The behaviour of consensus. |
||
round_id |
The round id. |
||
previous_round_id |
The previous round id. |
AEDPoS.AElfConsensusTriggerInformation
Field |
Type |
Description |
Label |
---|---|---|---|
pubkey |
The miner public key. |
||
in_value |
The InValue for current round. |
||
previous_in_value |
The InValue for previous round. |
||
behaviour |
The behaviour of consensus. |
||
encrypted_pieces |
The encrypted pieces of InValue. |
repeated |
|
decrypted_pieces |
The decrypted pieces of InValue. |
repeated |
|
revealed_in_values |
The revealed InValues. |
repeated |
AEDPoS.AElfConsensusTriggerInformation.DecryptedPiecesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
AEDPoS.AElfConsensusTriggerInformation.EncryptedPiecesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
AEDPoS.AElfConsensusTriggerInformation.RevealedInValuesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
AEDPoS.Candidates
Field |
Type |
Description |
Label |
---|---|---|---|
pubkeys |
The candidate public keys. |
repeated |
AEDPoS.ConsensusInformation
Field |
Type |
Description |
Label |
---|---|---|---|
value |
AEDPoS.GetMinerListInput
Field |
Type |
Description |
Label |
---|---|---|---|
term_number |
The term number. |
AEDPoS.HashList
Field |
Type |
Description |
Label |
---|---|---|---|
values |
repeated |
AEDPoS.InitialAElfConsensusContractInput
Field |
Type |
Description |
Label |
---|---|---|---|
is_term_stay_one |
Whether not to change the term. |
||
is_side_chain |
Is a side chain. |
||
period_seconds |
The number of seconds per term. |
||
miner_increase_interval |
The interval second that increases the number of miners. |
AEDPoS.IrreversibleBlockFound
Field |
Type |
Description |
Label |
---|---|---|---|
irreversible_block_height |
The irreversible block height found. |
AEDPoS.IrreversibleBlockHeightUnacceptable
Field |
Type |
Description |
Label |
---|---|---|---|
distance_to_irreversible_block_height |
Distance to the height of the last irreversible block. |
AEDPoS.LatestPubkeyToTinyBlocksCount
Field |
Type |
Description |
Label |
---|---|---|---|
pubkey |
The miner public key. |
||
blocks_count |
The count of blocks the miner produced. |
AEDPoS.MinerInRound
Field |
Type |
Description |
Label |
---|---|---|---|
order |
The order of the miner producing block. |
||
is_extra_block_producer |
Is extra block producer in the current round. |
||
in_value |
Generated by secret sharing and used for validation between miner. |
||
out_value |
Calculated from current in value. |
||
signature |
Calculated from current in value and signatures of previous round. |
||
expected_mining_time |
The expected mining time. |
||
produced_blocks |
The amount of produced blocks. |
||
missed_time_slots |
The amount of missed time slots. |
||
pubkey |
The public key of this miner. |
||
previous_in_value |
The InValue of the previous round. |
||
supposed_order_of_next_round |
The supposed order of mining for the next round. |
||
final_order_of_next_round |
The final order of mining for the next round. |
||
actual_mining_times |
The actual mining time, miners must fill actual mining time when they do the mining. |
repeated |
|
encrypted_pieces |
The encrypted pieces of InValue. |
repeated |
|
decrypted_pieces |
The decrypted pieces of InValue. |
repeated |
|
produced_tiny_blocks |
The amount of produced tiny blocks. |
||
implied_irreversible_block_height |
The irreversible block height that current miner recorded. |
AEDPoS.MinerInRound.DecryptedPiecesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
AEDPoS.MinerInRound.EncryptedPiecesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
AEDPoS.MinerList
Field |
Type |
Description |
Label |
---|---|---|---|
pubkeys |
The miners public key list. |
repeated |
AEDPoS.MinerListWithRoundNumber
Field |
Type |
Description |
Label |
---|---|---|---|
miner_list |
The list of miners. |
||
round_number |
The round number. |
AEDPoS.MinerReplaced
Field |
Type |
Description |
Label |
---|---|---|---|
new_miner_pubkey |
The new miner public key. |
AEDPoS.MiningInformationUpdated
Field |
Type |
Description |
Label |
---|---|---|---|
pubkey |
The miner public key. |
||
mining_time |
The current block time. |
||
behaviour |
The behaviour of consensus. |
||
block_height |
The current block height. |
||
previous_block_hash |
The previous block hash. |
AEDPoS.MiningRewardGenerated
Field |
Type |
Description |
Label |
---|---|---|---|
term_number |
The number of term the mining reward is generated. |
||
amount |
The amount of mining reward. |
AEDPoS.PubkeyList
Field |
Type |
Description |
Label |
---|---|---|---|
pubkeys |
The miners public key list. |
repeated |
AEDPoS.RandomNumberRequestInformation
Field |
Type |
Description |
Label |
---|---|---|---|
target_round_number |
The random hash is likely generated during this round. |
||
order |
|||
expected_block_height |
AEDPoS.RecordCandidateReplacementInput
Field |
Type |
Description |
Label |
---|---|---|---|
old_pubkey |
|||
new_pubkey |
AEDPoS.NextRoundInput
Field |
Type |
Description |
Label |
---|---|---|---|
round_number |
The round number. |
||
real_time_miners_information |
Current miner information, miner public key -> miner information. |
repeated |
|
main_chain_miners_round_number |
The round number on the main chain |
||
blockchain_age |
The time from chain start to current round (seconds). |
||
extra_block_producer_of_previous_round |
The miner public key that produced the extra block in the previous round. |
||
term_number |
The current term number. |
||
confirmed_irreversible_block_height |
The height of the confirmed irreversible block. |
||
confirmed_irreversible_block_round_number |
The round number of the confirmed irreversible block. |
||
is_miner_list_just_changed |
Is miner list different from the the miner list in the previous round. |
||
round_id_for_validation |
The round id, calculated by summing block producers’ expecting time (second). |
||
random_number |
The random number. |
AEDPoS.NextTermInput
Field |
Type |
Description |
Label |
---|---|---|---|
round_number |
The round number. |
||
real_time_miners_information |
Current miner information, miner public key -> miner information. |
repeated |
|
main_chain_miners_round_number |
The round number on the main chain |
||
blockchain_age |
The time from chain start to current round (seconds). |
||
extra_block_producer_of_previous_round |
The miner public key that produced the extra block in the previous round. |
||
term_number |
The current term number. |
||
confirmed_irreversible_block_height |
The height of the confirmed irreversible block. |
||
confirmed_irreversible_block_round_number |
The round number of the confirmed irreversible block. |
||
is_miner_list_just_changed |
Is miner list different from the the miner list in the previous round. |
||
round_id_for_validation |
The round id, calculated by summing block producers’ expecting time (second). |
||
random_number |
The random number. |
AEDPoS.Round.RealTimeMinersInformationEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
AEDPoS.SecretSharingInformation
Field |
Type |
Description |
Label |
---|---|---|---|
previous_round |
The previous round information. |
||
current_round_id |
The current round id. |
||
previous_round_id |
The previous round id. |
AEDPoS.TermInfo
Field |
Type |
Description |
Label |
---|---|---|---|
term_number |
|||
round_number |
AEDPoS.TermNumberLookUp
Field |
Type |
Description |
Label |
---|---|---|---|
map |
Term number -> Round number. |
repeated |
AEDPoS.TermNumberLookUp.MapEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
AEDPoS.TinyBlockInput
Field |
Type |
Description |
Label |
---|---|---|---|
round_id |
The round id. |
||
actual_mining_time |
The actual mining time. |
||
produced_blocks |
Count of blocks currently produced |
AEDPoS.UpdateValueInput
Field |
Type |
Description |
Label |
---|---|---|---|
out_value |
Calculated from current in value. |
||
signature |
Calculated from current in value and signatures of previous round. |
||
round_id |
To ensure the values to update will be apply to correct round by comparing round id. |
||
previous_in_value |
Publish previous in value for validation previous signature and previous out value. |
||
actual_mining_time |
The actual mining time, miners must fill actual mining time when they do the mining. |
||
supposed_order_of_next_round |
The supposed order of mining for the next round. |
||
tune_order_information |
The tuning order of mining for the next round, miner public key -> order. |
repeated |
|
encrypted_pieces |
The encrypted pieces of InValue. |
repeated |
|
decrypted_pieces |
The decrypted pieces of InValue. |
repeated |
|
produced_blocks |
The amount of produced blocks. |
||
miners_previous_in_values |
The InValue in the previous round, miner public key -> InValue. |
repeated |
|
implied_irreversible_block_height |
The irreversible block height that miner recorded. |
AEDPoS.UpdateValueInput.DecryptedPiecesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
AEDPoS.UpdateValueInput.EncryptedPiecesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
AEDPoS.UpdateValueInput.MinersPreviousInValuesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
AEDPoS.UpdateValueInput.TuneOrderInformationEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
AEDPoS.VoteMinersCountInput
Field |
Type |
Description |
Label |
---|---|---|---|
miners_count |
|||
amount |
AEDPoS.AElfConsensusBehaviour
Name |
Number |
Description |
---|---|---|
UPDATE_VALUE |
0 |
|
NEXT_ROUND |
1 |
|
NEXT_TERM |
2 |
|
NOTHING |
3 |
|
TINY_BLOCK |
4 |
AElf.Standards.ACS1
acs1.MethodFee
Field |
Type |
Description |
Label |
---|---|---|---|
symbol |
The token symbol of the method fee. |
||
basic_fee |
The amount of fees to be charged. |
acs1.MethodFees
Field |
Type |
Description |
Label |
---|---|---|---|
method_name |
The name of the method to be charged. |
||
fees |
List of fees to be charged. |
repeated |
|
is_size_fee_free |
Optional based on the implementation of SetMethodFee method. |
AElf.Standards.ACS4
acs4.ConsensusCommand
Field |
Type |
Description |
Label |
---|---|---|---|
limit_milliseconds_of_mining_block |
Time limit of mining next block. |
||
hint |
Context of Hint is diverse according to the consensus protocol we choose, so we use bytes. |
||
arranged_mining_time |
The time of arrange mining. |
||
mining_due_time |
The expiration time of mining. |
acs4.TransactionList
Field |
Type |
Description |
Label |
---|---|---|---|
transactions |
Consensus system transactions. |
repeated |
acs4.ValidationResult
Field |
Type |
Description |
Label |
---|---|---|---|
success |
Is successful. |
||
message |
The error message. |
||
is_re_trigger |
Whether to trigger mining again. |
AElf.Standards.ACS6
AElf.Standards.ACS10
acs10.Dividends
Field |
Type |
Description |
Label |
---|---|---|---|
value |
The dividends, symbol -> amount. |
repeated |
acs10.Dividends.ValueEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
acs10.DonateInput
Field |
Type |
Description |
Label |
---|---|---|---|
symbol |
The token symbol to donate. |
||
amount |
The amount to donate. |
acs10.DonationReceived
Field |
Type |
Description |
Label |
---|---|---|---|
from |
The address of donors. |
||
pool_contract |
The address of dividend pool. |
||
symbol |
The token symbol Donated. |
||
amount |
The amount Donated. |
acs10.ReleaseInput
Field |
Type |
Description |
Label |
---|---|---|---|
period_number |
The period number to release. |
acs10.SymbolList
Field |
Type |
Description |
Label |
---|---|---|---|
value |
The token symbol list. |
repeated |
AElf.Standards.ACS11
AElf.Types
aelf.Address
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.BinaryMerkleTree
Field |
Type |
Description |
Label |
---|---|---|---|
nodes |
The leaf nodes. |
repeated |
|
root |
The root node hash. |
||
leaf_count |
The count of leaf node. |
aelf.Hash
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.LogEvent
Field |
Type |
Description |
Label |
---|---|---|---|
address |
The contract address. |
||
name |
The name of the log event. |
||
indexed |
The indexed data, used to calculate bloom. |
repeated |
|
non_indexed |
The non indexed data. |
aelf.MerklePath
Field |
Type |
Description |
Label |
---|---|---|---|
merkle_path_nodes |
The merkle path nodes. |
repeated |
aelf.MerklePathNode
Field |
Type |
Description |
Label |
---|---|---|---|
hash |
The node hash. |
||
is_left_child_node |
Whether it is a left child node. |
aelf.SInt32Value
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.SInt64Value
Field |
Type |
Description |
Label |
---|---|---|---|
value |
aelf.ScopedStatePath
Field |
Type |
Description |
Label |
---|---|---|---|
address |
The scope address, which will be the contract address. |
||
path |
The path of contract state. |
aelf.SmartContractRegistration
Field |
Type |
Description |
Label |
---|---|---|---|
category |
The category of contract code(0: C#). |
||
code |
The byte array of the contract code. |
||
code_hash |
The hash of the contract code. |
||
is_system_contract |
Whether it is a system contract. |
||
version |
The version of the current contract. |
aelf.StatePath
Field |
Type |
Description |
Label |
---|---|---|---|
parts |
The partial path of the state path. |
repeated |
aelf.Transaction
Field |
Type |
Description |
Label |
---|---|---|---|
from |
The address of the sender of the transaction. |
||
to |
The address of the contract when calling a contract. |
||
ref_block_number |
The height of the referenced block hash. |
||
ref_block_prefix |
The first four bytes of the referenced block hash. |
||
method_name |
The name of a method in the smart contract at the To address. |
||
params |
The parameters to pass to the smart contract method. |
||
signature |
When signing a transaction it’s actually a subset of the fields: from/to and the target method as well as the parameter that were given. It also contains the reference block number and prefix. |
aelf.TransactionExecutingStateSet
Field |
Type |
Description |
Label |
---|---|---|---|
writes |
The changed states. |
repeated |
|
reads |
The read states. |
repeated |
|
deletes |
The deleted states. |
repeated |
aelf.TransactionExecutingStateSet.DeletesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
aelf.TransactionExecutingStateSet.ReadsEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
aelf.TransactionExecutingStateSet.WritesEntry
Field |
Type |
Description |
Label |
---|---|---|---|
key |
|||
value |
aelf.TransactionResult
Field |
Type |
Description |
Label |
---|---|---|---|
transaction_id |
The transaction id. |
||
status |
The transaction result status. |
||
logs |
The log events. |
repeated |
|
bloom |
Bloom filter for transaction logs. A transaction log event can be defined in the contract and stored in the bloom filter after the transaction is executed. Through this filter, we can quickly search for and determine whether a log exists in the transaction result. |
||
return_value |
The return value of the transaction execution. |
||
block_number |
The height of the block hat packages the transaction. |
||
block_hash |
The hash of the block hat packages the transaction. |
||
error |
Failed execution error message. |
aelf.TransactionResultStatus
Name |
Number |
Description |
---|---|---|
NOT_EXISTED |
0 |
The execution result of the transaction does not exist. |
PENDING |
1 |
The transaction is in the transaction pool waiting to be packaged. |
FAILED |
2 |
Transaction execution failed. |
MINED |
3 |
The transaction was successfully executed and successfully packaged into a block. |
CONFLICT |
4 |
When executed in parallel, there are conflicts with other transactions. |
PENDING_VALIDATION |
5 |
The transaction is waiting for validation. |
NODE_VALIDATION_FAILED |
6 |
Transaction validation failed. |