logo

Contract Deployment

ACS0 - Contract Deployment Standard#

ACS0 manages contract deployment and updates.

Interface#

Contracts using ACS0 need to implement these methods:

Methods#

Method NameRequestResponseDescription
DeploySystemSmartContractacs0.SystemContractDeploymentInputaelf.AddressDeploys a system smart contract and returns its address.
DeploySmartContractacs0.ContractDeploymentInputaelf.AddressDeploys a smart contract and returns its address.
UpdateSmartContractacs0.ContractUpdateInputaelf.AddressUpdates a smart contract.
ProposeNewContractacs0.ContractDeploymentInputaelf.HashCreates a proposal to deploy a new contract and returns its ID.
ProposeContractCodeCheckacs0.ContractCodeCheckInputaelf.HashCreates a proposal to check contract code and returns its ID.
ProposeUpdateContractacs0.ContractUpdateInputaelf.HashCreates a proposal to update a contract and returns its ID.
ReleaseApprovedContractacs0.ReleaseContractInputgoogle.protobuf.EmptyReleases an approved contract proposal.
ReleaseCodeCheckedContractacs0.ReleaseContractInputgoogle.protobuf.EmptyReleases a proposal that passed the code check.
ValidateSystemContractAddressacs0.ValidateSystemContractAddressInputgoogle.protobuf.EmptyValidates if the input system contract exists.
SetContractProposerRequiredStategoogle.protobuf.BoolValuegoogle.protobuf.EmptySets contract deployment authority.
CurrentContractSerialNumbergoogle.protobuf.Emptygoogle.protobuf.Int64ValueGets the current serial number of the genesis contract.
GetContractInfoaelf.Addressacs0.ContractInfoGets information about a contract.
GetContractAuthoraelf.Addressaelf.AddressGets the author of a contract.
GetContractHashaelf.Addressaelf.HashGets the code hash of a contract by address.
GetContractAddressByNameaelf.Hashaelf.AddressGets the address of a system contract by name.
GetSmartContractRegistrationByAddressaelf.Addressaelf.SmartContractRegistrationGets the registration of a smart contract by address.
GetSmartContractRegistrationByCodeHashaelf.Hashaelf.SmartContractRegistrationGets the registration of a smart contract by code hash.
DeployUserSmartContractacs0.ContractDeploymentInputacs0.DeployUserSmartContractOutputDeploys a user smart contract and returns the contract code hash.
UpdateUserSmartContractacs0.ContractUpdateInputgoogle.protobuf.EmptyUpdates a user smart contract.
ReleaseApprovedUserSmartContractacs0.ReleaseContractInputgoogle.protobuf.EmptyReleases a proposal that passed the code check.
PerformDeployUserSmartContractacs0.ContractDeploymentInputaelf.AddressDeploys a user contract.
PerformUpdateUserSmartContractacs0.ContractUpdateInputgoogle.protobuf.EmptyUpdates a user contract.
SetContractAuthoracs0.SetContractAuthorInputgoogle.protobuf.EmptySets the author of a contract.

Types#

acs0.AuthorUpdated

FieldTypeDescription
addressaelf.addressContract code byte array.
old_authoraelf.addressContract code category (0: C#).

acs0.CodeCheckRequired

FieldTypeDescription
codebytesContract code byte array.
proposed_contract_input_hashaelf.HashProposed contract ID.
categorysint32Contract code category (0: C#).
is_system_contractboolIs it a system contract?
is_user_contractboolIs it a user contract?

acs0.CodeUpdated

FieldTypeDescription
addressaelf.AddressContract address.
old_code_hashaelf.HashOld contract code byte array.
new_code_hashaelf.HashNew contract code byte array.
versionint32Contract version.

acs0.ContractCodeCheckInput##

FieldTypeDescription
contract_inputbytesContract code byte array.
is_contract_deploymentboolIs the contract being deployed or updated?
code_check_release_methodstringMethod to call after code check (DeploySmartContract or UpdateSmartContract).
proposed_contract_input_hashaelf.HashProposed contract ID.
categorysint32Contract code category (0: C#).
is_system_contractboolIs it a system contract?

acs0.ContractDeployed

FieldTypeDescription
authoraelf.AddressContract author.
code_hashaelf.HashContract code hash.
addressaelf.AddressContract address.
versionint32Contract version.
nameaelf.HashContract name (must be unique).
contract_versionstringContract version.

acs0.ContractDeploymentInput

FieldTypeDescription
categorysint32Contract code category (0: C#).
codebytesContract code byte array.

acs0.DeployUserSmartContractOutput

FieldTypeDescription
code_hashaelf.HashDeployed/updated contract code hash.

acs0.ContractInfo

FieldTypeDescription
serial_numberint64Contract serial number.
authoraelf.AddressContract author.
categorysint32Contract code category (0: C#).
code_hashaelf.HashContract code hash.
is_system_contractboolIs it a system contract?
versionint32Contract version.
contract_versionstringContract version.
contract_typestringContract type.
deployed_byaelf.AddressDeployer address.
deployed_ongoogle.protobuf.TimestampDeployment time.

acs0.ContractUpdateInput

FieldTypeDescription
addressaelf.AddressContract address.
codebytesContract code byte array.
categorysint32Contract code category (0: C#).
is_system_contractboolIs it a system contract?
is_user_contractboolIs it a user contract?

acs0.ReleaseContractInput

FieldTypeDescription
proposal_idaelf.HashProposal ID to be released.

acs0.SetContractAuthorInput

FieldTypeDescription
addressaelf.AddressContract address.
authoraelf.AddressNew author address.

acs0.SystemContractDeploymentInput

FieldTypeDescription
categorysint32Contract code category (0: C#).
codebytesContract code byte array.
nameaelf.HashContract name (must be unique).

acs0.ValidateSystemContractAddressInput

FieldTypeDescription
system_contract_hash_nameaelf.HashContract name hash.
addressaelf.AddressContract address.

aelf.Address

FieldTypeDescription
valuebytesAddress value in bytes.

aelf.BinaryMerkleTree

FieldTypeDescription
nodesHashLeaf nodes.
rootHashRoot node hash.
leaf_countint32Number of leaf nodes.

aelf.Hash

FieldTypeDescription
valuebytesHash value in bytes.

aelf.LogEvent

FieldTypeDescription
addressAddressContract address.
namestringLog event name.
indexedbytesIndexed data for bloom filter.
non_indexedbytesNon-indexed data.

aelf.MerklePath

FieldTypeDescription
merkle_path_nodesMerklePathNodeMerkle path nodes.

aelf.MerklePathNode

FieldTypeDescription
hashHashNode hash.
is_left_child_nodeboolIs it a left child node?

aelf.SInt32Value

FieldTypeDescription
valuesint32Signed 32-bit integer value.

aelf.SInt64Value

FieldTypeDescription
valuesint64Signed 64-bit integer value.

aelf.ScopedStatePath

FieldTypeDescription
addressAddressScope address (contract address).
pathStatePathContract state path.

aelf.SmartContractRegistration

FieldTypeDescription
categorysint32Contract code category (0: C#).
codebytesContract code byte array.
code_hashHashContract code hash.
is_system_contractboolIs it a system contract?
versionint32Contract version.

aelf.StatePath

FieldTypeDescription
partsstringState path parts.

aelf.Transaction

FieldTypeDescription
fromAddressSender address.
toAddressContract address.
ref_block_numberint64Referenced block height.
ref_block_prefixbytesReferenced block hash prefix.
method_namestringSmart contract method name.
paramsbytesSmart contract method parameters.
signaturebytesTransaction signature.

aelf.TransactionExecutingStateSet

FieldTypeDescription
writesTransactionExecutingStateSet.WritesEntryChanged states.
readsTransactionExecutingStateSet.ReadsEntryRead states.
deletesTransactionExecutingStateSet.DeletesEntryDeleted states.

aelf.TransactionExecutingStateSet.DeletesEntry

FieldTypeDescription
keystringState key.
valueboolDeletion state (true/false).

aelf.TransactionExecutingStateSet.ReadsEntry

FieldTypeDescription
keystringState key.
valueboolRead state (true/false).

aelf.TransactionExecutingStateSet.WritesEntry

FieldTypeDescription
keystringState key.
valuebytesWritten state value.

aelf.TransactionResult

FieldTypeDescription
transaction_idHashTransaction ID.
statusTransactionResultStatusTransaction result status.
logsLogEventLog events.
bloombytesBloom filter for logs.
return_valuebytesTransaction execution return value.
block_numberint64Block height.
block_hashHashBlock hash.
errorstringError message.

aelf.TransactionResultStatus

NameValueDescription
NOT_EXISTEDTransaction result does not exist.
PENDING1Transaction in pool waiting to be packaged.
FAILED2Transaction execution failed.
MINED3Transaction successfully executed and packaged.
CONFLICT4Conflicts with other transactions during parallel execution.
PENDING_VALIDATION5Waiting for validation.
NODE_VALIDATION_FAILED6Validation failed.

Example#

ACS0 defines methods for contract deployment and updates. aelf provides the Genesis Contract as an implementation of ACS0.

Edited on: 15 July 2024 04:18:53 GMT+0