Skip to main content

Genesis Contract

Used to manage the deployment and update of contracts. Implement aelf Standards ACS0 and ACS1.

Contract Methods

Method NameRequest TypeResponse TypeDescription
InitializeZero.InitializeInputgoogle.protobuf.EmptyInitializes the genesis contract.
SetInitialControllerAddressaelf.Addressgoogle.protobuf.EmptySets the initial controller address.
ChangeContractDeploymentControllerAuthorityInfogoogle.protobuf.EmptyModifies the contract deployment controller authority.
ChangeCodeCheckControllerAuthorityInfogoogle.protobuf.EmptyModifies the contract code check controller authority.
GetContractDeploymentControllergoogle.protobuf.EmptyAuthorityInfoQueries the ContractDeploymentController authority info.
GetCodeCheckControllergoogle.protobuf.EmptyAuthorityInfoQueries the CodeCheckController authority info.
SetContractProposalExpirationTimePeriodZero.SetContractProposalExpirationTimePeriodInputgoogle.protobuf.EmptySets expiration time for contract proposals.
GetCurrentContractProposalExpirationTimePeriodgoogle.protobuf.Emptyint32Gets the expiration time for the current contract proposal.

AElf.Standards.ACS0

Contract Methods

Method NameRequest TypeResponse TypeDescription
DeploySystemSmartContractacs0.SystemContractDeploymentInputaelf.AddressDeploys a system smart contract and returns the address.
DeploySmartContractacs0.ContractDeploymentInputaelf.AddressDeploys a smart contract and returns the address.
UpdateSmartContractacs0.ContractUpdateInputaelf.AddressUpdates a smart contract on chain.
ProposeNewContractacs0.ContractDeploymentInputaelf.HashCreates a proposal to deploy a new contract.
ProposeContractCodeCheckacs0.ContractCodeCheckInputaelf.HashCreates a proposal to check the code of a contract.
ProposeUpdateContractacs0.ContractUpdateInputaelf.HashCreates a proposal to update a contract.
ReleaseApprovedContractacs0.ReleaseContractInputgoogle.protobuf.EmptyReleases an approved contract proposal.
ReleaseCodeCheckedContractacs0.ReleaseContractInputgoogle.protobuf.EmptyReleases a code-checked contract proposal.
ValidateSystemContractAddressacs0.ValidateSystemContractAddressInputgoogle.protobuf.EmptyValidates the existence of an input system contract.
SetContractProposerRequiredStategoogle.protobuf.BoolValuegoogle.protobuf.EmptySets authority of contract deployment.
CurrentContractSerialNumbergoogle.protobuf.Emptygoogle.protobuf.Int64ValueGets the current serial number of the genesis contract.
GetContractInfoaelf.Addressacs0.ContractInfoGets detailed information about a contract.
GetContractAuthoraelf.Addressaelf.AddressGets the author of a contract.
GetContractHashaelf.Addressaelf.HashGets the code hash of a contract.
GetContractAddressByNameaelf.Hashaelf.AddressGets the address of a system contract by its name.
GetSmartContractRegistrationByAddressaelf.Addressaelf.SmartContractRegistrationGets the registration of a smart contract by its address.
GetSmartContractRegistrationByCodeHashaelf.Hashaelf.SmartContractRegistrationGets the registration of a smart contract by code hash.
DeployUserSmartContractacs0.UserContractDeploymentInputacs0.DeployUserSmartContractOutputDeploys a user smart contract and returns the code hash.
UpdateUserSmartContractacs0.UserContractUpdateInputgoogle.protobuf.EmptyUpdates a user smart contract on chain.
ReleaseApprovedUserSmartContractacs0.ReleaseContractInputgoogle.protobuf.EmptyReleases an approved user smart contract proposal.
PerformDeployUserSmartContractacs0.UserContractDeploymentInputaelf.AddressPerforms user contract deployment.
PerformUpdateUserSmartContractacs0.UserContractUpdateInputgoogle.protobuf.EmptyPerforms user contract update.
SetContractAuthoracs0.SetContractAuthorInputgoogle.protobuf.EmptySets the author of a contract.
SetSigneraelf.Addressgoogle.protobuf.EmptySets proxy signer for contract deployment/update.
RemoveSignergoogle.protobuf.Emptygoogle.protobuf.EmptyRemoves proxy signer for contract deployment/update.
GetSigneraelf.Addressaelf.AddressQueries signer of specified address.

AElf.Standards.ACS1

Method NameRequest TypeResponse TypeDescription
SetMethodFeeacs1.MethodFeesgoogle.protobuf.EmptySets method fees for the specified method.
ChangeMethodFeeControllerAuthorityInfogoogle.protobuf.EmptyChanges the method fee controller.
GetMethodFeegoogle.protobuf.StringValueacs1.MethodFeesQueries method fee information by method name.
GetMethodFeeControllergoogle.protobuf.EmptyAuthorityInfoQueries the method fee controller.

Contract Types

AElf.Contracts.Genesis

Zero.ContractProposingInput

FieldTypeDescriptionLabel
proposeraelf.AddressThe address of proposer for contract deployment/update.
statusContractProposingInputStatusThe status of proposal.
expired_timegoogle.protobuf.TimestampThe expiration time of proposal.

Zero.InitializeInput

FieldTypeDescriptionLabel
contract_deployment_authority_requiredboolWhether contract deployment/update requires authority.

Zero.ContractProposingInputStatus

NameNumberDescription
PROPOSED0Proposal is proposed.
APPROVED1Proposal is approved by parliament.
CODE_CHECK_PROPOSED2Code check is proposed.
CODE_CHECKED3Passed code checks.

Zero.SetContractProposalExpirationTimePeriodInput

FieldTypeDescriptionLabel
expiration_time_periodint32The period of expiration time

AElf.Standards.ACS0

acs0.AuthorUpdated

FieldTypeDescriptionLabel
addressaelf.addressThe byte array of the contract code.
old_authoraelf.addressThe category of contract code (0: C#).
CrossChainCreateTokenaelf.addressIndicates if the contract is the system contract.

acs0.CodeCheckRequired

FieldTypeDescriptionLabel
codebytesThe byte array of the contract code.
proposed_contract_input_hashaelf.HashThe id of the proposed contract.
categorysint32The category of contract code (0: C#).
is_system_contractboolIndicates if the contract is the system contract.
is_user_contractboolIndicates if the contract is the user contract.

acs0.CodeUpdated

FieldTypeDescriptionLabel
addressaelf.AddressThe address of the updated contract.
old_code_hashaelf.HashThe byte array of the old contract code.
new_code_hashaelf.HashThe byte array of the new contract code.
versionint32The version of the current contract.

acs0.ContractCodeCheckInput

FieldTypeDescriptionLabel
contract_inputbytesThe byte array of the contract code to be checked.
is_contract_deploymentboolWhether the input contract is to be deployed or updated.
code_check_release_methodstringMethod to call after code check complete (DeploySmartContract or UpdateSmartContract).
proposed_contract_input_hashaelf.HashThe id of the proposed contract.
categorysint32The category of contract code (0: C#).
is_system_contractboolIndicates if the contract is the system contract.

acs0.ContractDeployed

FieldTypeDescriptionLabel
authoraelf.AddressThe author of the contract.
code_hashaelf.HashThe hash of the contract code.
addressaelf.AddressThe address of the contract.
versionint32The version of the current contract.
nameaelf.HashThe name of the contract.
contract_versionstringThe version of the current contract.
deployeraelf.AddressThe actual address that initiated the contract deployment.

acs0.ContractDeploymentInput

FieldTypeDescriptionLabel
categorysint32The category of contract code (0: C#).
codebytesThe byte array of the contract code.
contract_operationacs0.ContractOperationThe information needed for contract deployment.

acs0.ContractInfo

FieldTypeDescriptionLabel
serial_numberint64The serial number of the contract.
authoraelf.AddressThe author of the contract.
categorysint32The category of contract code (0: C#).
code_hashaelf.HashThe hash of the contract code.
is_system_contractboolWhether it is a system contract.
versionint32The version of the current contract.
contract_versionstringThe version of the current contract.
is_user_contractboolIndicates if the contract is the user contract.
deployeraelf.AddressThe actual address that initiated the contract deployment.

acs0.ContractProposed

FieldTypeDescriptionLabel
proposed_contract_input_hashaelf.HashThe id of the proposed contract.

acs0.ContractUpdateInput

FieldTypeDescriptionLabel
addressaelf.Address The contract address that needs to be updated.
codebytes The byte array of the new contract code.
contract_operationacs0.ContractOperation The information needed for contract update.

acs0.UserContractUpdateInput

FieldTypeDescriptionLabel
addressaelf.Address The user contract address that needs to be updated.
codebytes The byte array of the new user contract code.

acs0.ReleaseContractInput

FieldTypeDescriptionLabel
proposal_idaelf.Hash The hash of the proposal.
proposed_contract_input_hashaelf.Hash The id of the proposed contract.

acs0.SystemContractDeploymentInput

FieldTypeDescriptionLabel
categorysint32 The category of contract code(0: C#).
codebytes The byte array of the contract code.
nameaelf.Hash The name of the contract. It has to be unique.
transaction_method_call_listSystemContractDeploymentInput.SystemTransactionMethodCallList An initial list of transactions for the system contract, which is executed in sequence when the contract is deployed.

acs0.SystemContractDeploymentInput.SystemTransactionMethodCall

FieldTypeDescriptionLabel
method_namestring The method name of system transaction.
paramsbytes The params of system transaction method.

acs0.SystemContractDeploymentInput.SystemTransactionMethodCallList

FieldTypeDescriptionLabel
valueSystemContractDeploymentInput.SystemTransactionMethodCall The list of system transactions.repeated

acs0.ValidateSystemContractAddressInput

FieldTypeDescriptionLabel
system_contract_hash_nameaelf.Hash The name hash of the contract.
addressaelf.Address The address of the contract.

acs0.DeployUserSmartContractOutput

FieldTypeDescriptionLabel
code_hashaelf.Hash The deployed or updated contract code hash.

acs0.SetContractAuthorInput

FieldTypeDescriptionLabel
contract_addressaelf.Address The author's contract address needs to be updated.
new_authoraelf.Address The new contract author.

acs0.ContractOperation

FieldTypeDescriptionLabel
chain_idint32 The ID of the chain where the contract is deployed/updated.
code_hashaelf.Hash The hash of the contract code.
deployeraelf.Address The actual address that initiates the contract deployment.
saltaelf.Hash The hash based on which the user contract address is generated.
versionint32 The version of the deployed/updated contract.
signaturebytes The signature for deployer verification.

acs0.UserContractDeploymentInput

FieldTypeDescriptionLabel
categorysint32 The category of contract code(0: C#).
codebytes The byte array of the contract code.
saltaelf.Hash The hash based on which user contract address is generated.

AElf.Standards.ACS1

acs1.MethodFee

FieldTypeDescriptionLabel
symbolstringThe token symbol of the method fee.
basic_feeint64The amount of fees to be charged.

acs1.MethodFees

FieldTypeDescriptionLabel
method_namestringThe name of the method to be charged.
feesMethodFee (List)List of fees to be charged.repeated
is_size_fee_freeboolOptional based on the implementation of SetMethodFee method.

AElf.Types

aelf.Address

FieldTypeDescriptionLabel
valuebytes

aelf.BinaryMerkleTree

FieldTypeDescriptionLabel
nodesHash (List)The leaf nodes.repeated
rootHashThe root node hash.
leaf_countint32The count of leaf node.

aelf.Hash

FieldTypeDescriptionLabel
valuebytes

aelf.LogEvent

FieldTypeDescriptionLabel
addressAddressThe contract address.
namestringThe name of the log event.
indexedbytes (List)The indexed data.repeated
non_indexedbytesThe non indexed data.

aelf.MerklePath

FieldTypeDescriptionLabel
merkle_path_nodesMerklePathNode (List)The merkle path nodes.repeated

aelf.MerklePathNode

FieldTypeDescriptionLabel
hashHashThe node hash.
is_left_child_nodeboolWhether it is a left child node.

aelf.SInt32Value

FieldTypeDescriptionLabel
valuesint32

aelf.SInt64Value

FieldTypeDescriptionLabel
valuesint64

aelf.ScopedStatePath

FieldTypeDescriptionLabel
addressAddressThe scope address, which will be the contract address.
pathStatePathThe path of contract state.

aelf.SmartContractRegistration

FieldTypeDescriptionLabel
categorysint32The category of contract code(0: C#).
codebytesThe byte array of the contract code.
code_hashHashThe hash of the contract code.
is_system_contractboolWhether it is a system contract.
versionint32The version of the current contract.

aelf.StatePath

FieldTypeDescriptionLabel
partsstring (List)The partial path of the state path.repeated

aelf.Transaction

FieldTypeDescriptionLabel
fromaelf.AddressThe address of the sender of the transaction.
toaelf.AddressThe address of the contract when calling a contract.
ref_block_numberint64The height of the referenced block hash.
ref_block_prefixbytesThe first four bytes of the referenced block hash.
method_namestringThe name of a method in the smart contract at the To address.
paramsbytesThe parameters to pass to the smart contract method.
signaturebytesWhen signing a transaction, it's a subset of the fields: from/to and the target method as well as the parameter that were given.

aelf.TransactionExecutingStateSet

FieldTypeDescriptionLabel
writesTransactionExecutingStateSet.WritesEntry (see details)The changed states.repeated
readsTransactionExecutingStateSet.ReadsEntry (see details)The read states.repeated
deletesTransactionExecutingStateSet.DeletesEntry (see details)The deleted states.repeated

aelf.TransactionExecutingStateSet.DeletesEntry

FieldTypeDescriptionLabel
keystring
valuebool

aelf.TransactionExecutingStateSet.ReadsEntry

FieldTypeDescriptionLabel
keystring
valuebool

aelf.TransactionExecutingStateSet.WritesEntry

FieldTypeDescriptionLabel
keystring
valuebytes

aelf.TransactionResult

FieldTypeDescriptionLabel
transaction_idaelf.HashThe transaction id.
statusTransactionResultStatusThe transaction result status.
logsaelf.LogEvent (List)The log events.repeated
bloombytesBloom 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.
return_valuebytesThe return value of the transaction execution.
block_numberint64The height of the block that packages the transaction.
block_hashaelf.HashThe hash of the block that packages the transaction.
errorstringFailed execution error message.

aelf.TransactionResultStatus

NameNumberDescription
NOT_EXISTED0The execution result of the transaction does not exist.
PENDING1The transaction is in the transaction pool waiting to be packaged.
FAILED2Transaction execution failed.
MINED3The transaction was successfully executed and successfully packaged into a block.
CONFLICT4When executed in parallel, there are conflicts with other transactions.
PENDING_VALIDATION5The transaction is waiting for validation.
NODE_VALIDATION_FAILED6Transaction validation failed.

AuthorityInfo

FieldTypeDescriptionLabel
contract_addressaelf.AddressThe contract address of the controller.
owner_addressaelf.AddressThe address of the owner of the contract.