logo

Cross Chain Contract

Implement aelf Standards ACS1 and ACS7.

Contract Methods#

Method NameRequest TypeResponse TypeDescription
InitializeCrossChain.InitializeInputgoogle.protobuf.EmptyPropose once cross chain indexing.
SetInitialSideChainLifetimeControllerAddressaelf.Addressgoogle.protobuf.EmptySet the initial SideChainLifetimeController address which should be parliament organization by default.
SetInitialIndexingControllerAddressaelf.Addressgoogle.protobuf.EmptySet the initial CrossChainIndexingController address which should be parliament organization by default.
ChangeCrossChainIndexingControllerAuthorityInfogoogle.protobuf.EmptyChange the cross chain indexing controller.
ChangeSideChainLifetimeControllerAuthorityInfogoogle.protobuf.EmptyChange the lifetime controller of the side chain.
ChangeSideChainIndexingFeeControllerCrossChain.ChangeSideChainIndexingFeeControllerInputgoogle.protobuf.EmptyChange indexing fee adjustment controller for specific side chain.
AcceptCrossChainIndexingProposalCrossChain.AcceptCrossChainIndexingProposalInputgoogle.protobuf.EmptyWhen the indexing proposal is released, clean up the pending proposal.
GetSideChainCreatorgoogle.protobuf.Int32Valueaelf.AddressGet the side chain creator address according to side chain id.
GetChainStatusgoogle.protobuf.Int32ValueCrossChain.GetChainStatusOutputGet the current status of side chain according to side chain id.
GetSideChainHeightgoogle.protobuf.Int32Valuegoogle.protobuf.Int64ValueGet the side chain height according to side chain id.
GetParentChainHeightgoogle.protobuf.Emptygoogle.protobuf.Int64ValueGet the height of parent chain.
GetParentChainIdgoogle.protobuf.Emptygoogle.protobuf.Int32ValueGet the chain id of parent chain.
GetSideChainBalancegoogle.protobuf.Int32Valuegoogle.protobuf.Int64ValueGet the balance of side chain indexing according to side chain id.
GetSideChainIndexingFeeDebtgoogle.protobuf.Int32Valuegoogle.protobuf.Int64ValueGet the fee debt of side chain indexing according to side chain id.
GetIndexingProposalStatusgoogle.protobuf.EmptyCrossChain.GetIndexingProposalStatusOutputGet the status of the current indexing proposal.
GetSideChainIndexingFeePricegoogle.protobuf.Int32Valuegoogle.protobuf.Int64ValueGet the side chain indexing fee price according to side chain id.
GetSideChainLifetimeControllergoogle.protobuf.EmptyAuthorityInfoGet the lifetime controller of the side chain.
GetCrossChainIndexingControllergoogle.protobuf.EmptyAuthorityInfoGet the cross chain indexing controller.
GetSideChainIndexingFeeControllergoogle.protobuf.Int32ValueAuthorityInfoGet the indexing fee controller of side chain according to side chain id.

AElf.Standards.ACS1#

Method NameRequest TypeResponse TypeDescription
SetMethodFeeacs1.MethodFeesgoogle.protobuf.EmptySet the method fees for the specified method. Note that this will override all fees of the method.
ChangeMethodFeeControllerAuthorityInfogoogle.protobuf.EmptyChange the method fee controller, the default is parliament and default organization.
GetMethodFeegoogle.protobuf.StringValueacs1.MethodFeesQuery method fee information by method name.
GetMethodFeeControllergoogle.protobuf.EmptyAuthorityInfoQuery the method fee controller.

AElf.Standards.ACS7#

Method NameRequest TypeResponse TypeDescription
ProposeCrossChainIndexingacs7.CrossChainBlockDatagoogle.protobuf.EmptyPropose once cross chain indexing.
ReleaseCrossChainIndexingProposalacs7.ReleaseCrossChainIndexingProposalInputgoogle.protobuf.EmptyRelease the proposed indexing if already approved.
RequestSideChainCreationacs7.SideChainCreationRequestgoogle.protobuf.EmptyRequest side chain creation.
ReleaseSideChainCreationacs7.ReleaseSideChainCreationInputgoogle.protobuf.EmptyRelease the side chain creation request if already approved and it will call the method CreateSideChain.
CreateSideChainacs7.CreateSideChainInputgoogle.protobuf.Int32ValueCreate the side chain and returns the newly created side chain ID.
Rechargeacs7.RechargeInputgoogle.protobuf.EmptyRecharge for the specified side chain.
DisposeSideChaingoogle.protobuf.Int32Valuegoogle.protobuf.Int32ValueDispose a side chain according to side chain id.
AdjustIndexingFeePriceacs7.AdjustIndexingFeeInputgoogle.protobuf.EmptyAdjust side chain indexing fee.
VerifyTransactionacs7.VerifyTransactionInputgoogle.protobuf.BoolValueVerify cross chain transaction.
GetSideChainIdAndHeightgoogle.protobuf.Emptyacs7.ChainIdAndHeightDictGets all the side chain id and height of the current chain.
GetSideChainIndexingInformationListgoogle.protobuf.Emptyacs7.SideChainIndexingInformationListGet indexing information of side chains.
GetAllChainsIdAndHeightgoogle.protobuf.Emptyacs7.ChainIdAndHeightDictGet id and recorded height of all chains.
GetIndexedSideChainBlockDataByHeightgoogle.protobuf.Int64Valueacs7.IndexedSideChainBlockDataGet block data of indexed side chain according to height.
GetBoundParentChainHeightAndMerklePathByHeightgoogle.protobuf.Int64Valueacs7.CrossChainMerkleProofContextGet merkle path bound up with side chain according to height.
GetChainInitializationDatagoogle.protobuf.Int32Valueacs7.ChainInitializationDataGet initialization data for specified side chain.

Contract Types

AElf.Contracts.CrossChain#

CrossChain.AcceptCrossChainIndexingProposalInput#

FieldTypeDescriptionLabel
chain_idint32The chain id of accepted indexing.

CrossChain.ChainIndexingProposal#

FieldTypeDescriptionLabel
proposal_idaelf.HashThe id of cross chain indexing proposal.
proposeraelf.AddressThe proposer of cross chain indexing.
proposed_cross_chain_block_dataacs7.CrossChainBlockDataThe cross chain data proposed.
statusCrossChainIndexingProposalStatusThe status of cross chain indexing proposal.
chain_idint32The chain id of the indexing.

CrossChain.ChangeSideChainIndexingFeeControllerInput#

FieldTypeDescriptionLabel
chain_idint32The side chain id.
authority_infoAuthorityInfoThe changed controller of indexing fee.

CrossChain.CrossChainIndexingControllerChanged#

FieldTypeDescriptionLabel
authority_infoAuthorityInfoThe changed controller of indexing.

CrossChain.Disposed#

CrossChain.GetChainStatusOutput#

FieldTypeDescriptionLabel
statusSideChainStatusThe status of side chain.

CrossChain.GetIndexingProposalStatusOutput#

FieldTypeDescriptionLabel
chain_indexing_proposal_statusGetIndexingProposalStatusOutput.ChainIndexingProposalStatusEntryThe collection of pending indexing proposal, the key is chain id.repeated

CrossChain.GetIndexingProposalStatusOutput.ChainIndexingProposalStatusEntry#

FieldTypeDescriptionLabel
keyint32
valuePendingChainIndexingProposalStatus

CrossChain.GetPendingCrossChainIndexingProposalOutput#

FieldTypeDescriptionLabel
proposal_idaelf.HashThe proposal id of cross chain indexing.
proposeraelf.AddressThe proposer of cross chain indexing proposal.
to_be_releasedboolTrue if the proposal can be released, otherwise false.
proposed_cross_chain_block_dataacs7.CrossChainBlockDataThe cross chain data proposed.
expired_timegoogle.protobuf.TimestampThe proposal expiration time.

CrossChain.InitializeInput#

FieldTypeDescriptionLabel
parent_chain_idint32The id of parent chain.
creation_height_on_parent_chainint64The height of side chain created on parent chain.
is_privilege_preservedboolTrue if chain privilege needed, otherwise false.

CrossChain.ParentChainIndexed#

FieldTypeDescriptionLabel
chain_idbytesIndexed parent chain id.
indexed_heightint64Indexed block height.

CrossChain.PendingChainIndexingProposalStatus#

FieldTypeDescriptionLabel
proposal_idaelf.HashThe id of cross chain indexing proposal.
proposeraelf.AddressThe proposer of cross chain indexing.
to_be_releasedboolTrue if the proposal can be released, otherwise false.
proposed_cross_chain_block_dataacs7.CrossChainBlockDataThe cross chain data proposed.
expired_timegoogle.protobuf.TimestampThe proposal expiration time.

CrossChain.ProposedCrossChainIndexing#

FieldTypeDescriptionLabel
chain_indexing_proposal_collectionsProposedCrossChainIndexing.ChainIndexingProposalCollectionsEntryThe collection of chain indexing proposal, the key is chain id.repeated

CrossChain.ProposedCrossChainIndexing.ChainIndexingProposalCollectionsEntry#

FieldTypeDescriptionLabel
keyint32
valueChainIndexingProposal

CrossChain.SideChainCreatedEvent#

FieldTypeDescriptionLabel
creatoraelf.AddressThe proposer who propose to create the side chain.
chainIdint32The created side chain id.

CrossChain.SideChainCreationRequestState#

FieldTypeDescriptionLabel
side_chain_creation_requestacs7.SideChainCreationRequestThe parameters of creating side chain.
expired_timegoogle.protobuf.TimestampThe expiration date of the proposal.
proposeraelf.AddressThe proposer who proposed to create the side chain.

CrossChain.SideChainIndexed#

FieldTypeDescriptionLabel
chain_idbytesIndexed side chain id.
indexed_heightint64Indexed block height.

CrossChain.SideChainIndexingFeeControllerChanged#

FieldTypeDescriptionLabel
chain_idint32The side chain id.
authority_infoAuthorityInfoThe changed controller of side chain indexing fee.

CrossChain.SideChainInfo#

FieldTypeDescriptionLabel
proposeraelf.AddressThe proposer who propose to create the side chain.
side_chain_statusCrossChain.SideChainStatusThe status of side chain.
side_chain_idint32The side chain id.
creation_timestampgoogle.protobuf.TimestampThe time of side chain created.
creation_height_on_parent_chainint64The height of side chain created on parent chain.
indexing_priceint64The price of indexing fee.
is_privilege_preservedboolTrue if chain privilege needed, otherwise false.
arrears_infoCrossChain.SideChainInfo.ArrearsInfoEntryCreditor and amounts for the chain indexing fee debtrepeated
indexing_fee_controllerAuthorityInfoThe controller of indexing fee.

CrossChain.SideChainInfo.ArrearsInfoEntry#

FieldTypeDescriptionLabel
keystring
valueint64

CrossChain.SideChainLifetimeControllerChanged#

FieldTypeDescriptionLabel
authority_infoAuthorityInfoThe changed controller of side chain lifetime.

CrossChain.CrossChainIndexingProposalStatus#

NameNumberDescription
NON_PROPOSED
PENDING1The proposal is pending.
ACCEPTED2The proposal has been released.

CrossChain.SideChainStatus#

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.
feesacs1.MethodFeeList of fees to be charged.repeated
is_size_fee_freeboolOptional based on the implementation of SetMethodFee method.

AElf.Standards.ACS7#

acs7.AdjustIndexingFeeInput#

FieldTypeDescriptionLabel
side_chain_idint32The side chain id to adjust.
indexing_feeint64The new price of indexing fee.

acs7.ChainIdAndHeightDict#

acs7.ChainIdAndHeightDict.IdHeightDictEntry#

acs7.ChainInitializationConsensusInfo#

FieldTypeDescriptionLabel
initial_consensus_databytesInitial consensus data.

acs7.ChainInitializationData#

FieldTypeDescriptionLabel
chain_idint32The id of side chain.
creatoraelf.AddressThe side chain creator.
creation_timestampgoogle.protobuf.TimestampThe timestamp for side chain creation.
creation_height_on_parent_chainint64The height of side chain creation on parent chain.
chain_creator_privilege_preservedboolCreator privilege boolean flag: True if chain creator privilege preserved, otherwise false.
parent_chain_token_contract_addressaelf.AddressParent chain token contract address.
chain_initialization_consensus_infoChainInitializationConsensusInfoInitial consensus information.
native_token_info_databytesThe native token info.
resource_token_infoResourceTokenInfoThe resource token information.
chain_primary_token_infoChainPrimaryTokenInfoThe chain primary token information.

acs7.ChainPrimaryTokenInfo#

acs7.CreateSideChainInput#

FieldTypeDescriptionLabel
side_chain_creation_requestSideChainCreationRequestThe request information of the side chain creation.
proposeraelf.AddressThe proposer of the side chain creation.

acs7.CrossChainBlockData#

FieldTypeDescriptionLabel
side_chain_block_data_listSideChainBlockDataThe side chain block data list to index.repeated
parent_chain_block_data_listParentChainBlockDataThe parent chain block data list to index.repeated

acs7.CrossChainExtraData#

acs7.CrossChainIndexingDataProposedEvent#

FieldTypeDescriptionLabel
proposed_cross_chain_dataCrossChainBlockDataProposed cross chain data to be indexed.
proposal_idaelf.HashThe proposal id.

acs7.CrossChainMerkleProofContext#

FieldTypeDescriptionLabel
bound_parent_chain_heightint64The height of parent chain bound up with side chain.
merkle_path_from_parent_chainaelf.MerklePathThe merkle path generated from parent chain.

acs7.IndexedParentChainBlockData#

FieldTypeDescriptionLabel
local_chain_heightint64The height of the local chain when indexing the parent chain.
parent_chain_block_data_listParentChainBlockDataParent chain block data.repeated

acs7.IndexedSideChainBlockData#

acs7.ParentChainBlockData#

FieldTypeDescriptionLabel
heightint64The height of parent chain.
cross_chain_extra_dataCrossChainExtraDataThe merkle tree root computing from side chain roots.
chain_idint32The parent chain id.
transaction_status_merkle_tree_rootaelf.HashThe merkle tree root computing from transactions status in parent chain block.
indexed_merkle_pathParentChainBlockData.IndexedMerklePathEntryIndexed block height from side chain and merkle path for this side chain block.repeated
extra_dataParentChainBlockData.ExtraDataEntryExtra data map.repeated

acs7.ParentChainBlockData.ExtraDataEntry#

FieldTypeDescriptionLabel
keystring
valuebytes

acs7.ParentChainBlockData.IndexedMerklePathEntry#

acs7.RechargeInput#

FieldTypeDescriptionLabel
chain_idint32The chain id to recharge.
amountint64The amount to recharge.

acs7.ReleaseCrossChainIndexingProposalInput#

acs7.ReleaseSideChainCreationInput#

FieldTypeDescriptionLabel
proposal_idaelf.HashThe proposal id of side chain creation.

acs7.ResourceTokenInfo#

FieldTypeDescriptionLabel
resource_token_list_databytesThe resource token information.
initial_resource_amountInitialResourceAmountEntryThe initial resource token amount.repeated

acs7.ResourceTokenInfo.InitialResourceAmountEntry#

FieldTypeDescriptionLabel
keystring
valueint32

acs7.SideChainBlockData#

acs7.SideChainCreationRequest#

FieldTypeDescriptionLabel
indexing_priceint64The cross chain indexing price.
locked_token_amountint64Initial locked balance for a new side chain.
is_privilege_preservedboolCreator privilege boolean flag: True if chain creator privilege preserved, otherwise false.
side_chain_token_creation_requestSideChainTokenCreationRequestSide chain token information.
side_chain_token_initial_issue_listSideChainTokenInitialIssueA list of accounts and amounts that will be issued when the chain starts.repeated
initial_resource_amountInitialResourceAmountEntryThe initial rent resources.repeated

acs7.SideChainCreationRequest.InitialResourceAmountEntry#

FieldTypeDescriptionLabel
keystring
valueint32

acs7.SideChainIndexingInformation#

FieldTypeDescriptionLabel
chain_idint32The side chain id.
indexed_heightint64The indexed height.

acs7.SideChainIndexingInformationList#

FieldTypeDescriptionLabel
indexing_information_listSideChainIndexingInformationA list contains indexing information of side chains.repeated

acs7.SideChainTokenCreationRequest#

acs7.SideChainTokenInitialIssue#

FieldTypeDescriptionLabel
addressaelf.AddressThe account that will be issued.
amountint64The amount that will be issued.

acs7.VerifyTransactionInput#

FieldTypeDescriptionLabel
transaction_idaelf.HashThe cross chain transaction id to verify.
pathaelf.MerklePathThe merkle path of the transaction.
parent_chain_heightint64The height of parent chain that indexing this transaction.
verified_chain_idint32The chain if to verify.

AElf.Types#

aelf.Address#

FieldTypeDescriptionLabel
valuebytes

aelf.BinaryMerkleTree#

FieldTypeDescriptionLabel
nodesHashThe 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.
indexedbytesThe indexed data, used to calculate bloom.repeated
non_indexedbytesThe non-indexed data.

aelf.MerklePath#

FieldTypeDescriptionLabel
merkle_path_nodesMerklePathNodeThe 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#

aelf.Transaction#

FieldTypeDescriptionLabel
fromAddressThe address of the sender of the transaction.
toAddressThe 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 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#

FieldTypeDescriptionLabel
writesTransactionExecutingStateSet.WritesEntryThe changed states.repeated
readsTransactionExecutingStateSet.ReadsEntryThe read states.repeated
deletesTransactionExecutingStateSet.DeletesEntryThe 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_idHashThe transaction id.
statusTransactionResultStatusThe transaction result status.
logsLogEventThe 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_hashHashThe hash of the block that packages the transaction.
errorstringFailed execution error message.

aelf.TransactionResultStatus#

NameNumberDescription
NOT_EXISTEDThe 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.

Edited on: 17 July 2024 03:34:25 GMT+0