Skip to main content

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

FieldTypeDescriptionLabel
chain_idint32The disposed side chain id.

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_PROPOSED0
PENDING1The proposal is pending.
ACCEPTED2The proposal has been released.

CrossChain.SideChainStatus

NameNumberDescription
FATAL0Currently no meaning.
ACTIVE1The side chain is being indexed.
INDEXING_FEE_DEBT2The side chain is in debt for indexing fee.
TERMINATED3The side chain is disposed.

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

FieldTypeDescriptionLabel
id_height_dictChainIdAndHeightDict.IdHeightDictEntryA collection of chain ids and heights, where the key is the chain id and the value is the height.repeated

acs7.ChainIdAndHeightDict.IdHeightDictEntry

FieldTypeDescriptionLabel
keyint32
valueint64

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

FieldTypeDescriptionLabel
chain_primary_token_databytesThe side chain primary token data.
side_chain_token_initial_issue_listSideChainTokenInitialIssueThe side chain primary token initial issue list.repeated

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

FieldTypeDescriptionLabel
transaction_status_merkle_tree_rootaelf.HashMerkle tree root of side chain block transaction status root.

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

FieldTypeDescriptionLabel
side_chain_block_data_listSideChainBlockDataSide chain block data.repeated

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

FieldTypeDescriptionLabel
keyint64
valueaelf.MerklePath

acs7.RechargeInput

FieldTypeDescriptionLabel
chain_idint32 The chain id to recharge.
amountint64 The amount to recharge.

acs7.ReleaseCrossChainIndexingProposalInput

FieldTypeDescriptionLabel
chain_id_listint32 List of chain ids to release.repeated

acs7.ReleaseSideChainCreationInput

FieldTypeDescriptionLabel
proposal_idaelf.Hash The proposal id of side chain creation.

acs7.ResourceTokenInfo

FieldTypeDescriptionLabel
resource_token_list_databytes The resource token information.
initial_resource_amountInitialResourceAmountEntry The initial resource token amount.repeated

acs7.ResourceTokenInfo.InitialResourceAmountEntry

FieldTypeDescriptionLabel
keystring
valueint32

acs7.SideChainBlockData

FieldTypeDescriptionLabel
heightint64 The height of side chain block.
block_header_hashaelf.Hash The hash of side chain block.
transaction_status_merkle_tree_rootaelf.Hash The merkle tree root computing from transactions status in side chain block.
chain_idint32 The id of side chain.

acs7.SideChainCreationRequest

FieldTypeDescriptionLabel
indexing_priceint64 The cross chain indexing price.
locked_token_amountint64 Initial locked balance for a new side chain.
is_privilege_preservedbool Creator privilege boolean flag: True if chain creator privilege preserved, otherwise false.
side_chain_token_creation_requestSideChainTokenCreationRequest Side chain token information.
side_chain_token_initial_issue_listSideChainTokenInitialIssue A list of accounts and amounts that will be issued when the chain starts.repeated
initial_resource_amountInitialResourceAmountEntry The initial rent resources.repeated

acs7.SideChainCreationRequest.InitialResourceAmountEntry

FieldTypeDescriptionLabel
keystring
valueint32

acs7.SideChainIndexingInformation

FieldTypeDescriptionLabel
chain_idint32 The side chain id.
indexed_heightint64 The indexed height.

acs7.SideChainIndexingInformationList

FieldTypeDescriptionLabel
indexing_information_listSideChainIndexingInformation A list contains indexing information of side chains.repeated

acs7.SideChainTokenCreationRequest

FieldTypeDescriptionLabel
side_chain_token_symbolstring Token symbol of the side chain to be created
side_chain_token_namestring Token name of the side chain to be created
side_chain_token_total_supplyint64 Token total supply of the side chain to be created
side_chain_token_decimalsint32 Token decimals of the side chain to be created

acs7.SideChainTokenInitialIssue

FieldTypeDescriptionLabel
addressaelf.Address The account that will be issued.
amountint64 The amount that will be issued.

acs7.VerifyTransactionInput

FieldTypeDescriptionLabel
transaction_idaelf.Hash The cross chain transaction id to verify.
pathaelf.MerklePath The merkle path of the transaction.
parent_chain_heightint64 The height of parent chain that indexing this transaction.
verified_chain_idint32 The chain if to verify.

AElf.Types

aelf.Address

FieldTypeDescriptionLabel
valuebytes

aelf.BinaryMerkleTree

FieldTypeDescriptionLabel
nodesHash The leaf nodes.repeated
rootHash The root node hash.
leaf_countint32 The count of leaf node.

aelf.Hash

FieldTypeDescriptionLabel
valuebytes

aelf.LogEvent

FieldTypeDescriptionLabel
addressAddress The contract address.
namestring The name of the log event.
indexedbytes The indexed data, used to calculate bloom.repeated
non_indexedbytes The non-indexed data.

aelf.MerklePath

FieldTypeDescriptionLabel
merkle_path_nodesMerklePathNode The merkle path nodes.repeated

aelf.MerklePathNode

FieldTypeDescriptionLabel
hashHash The node hash.
is_left_child_nodebool Whether it is a left child node.

aelf.SInt32Value

FieldTypeDescriptionLabel
valuesint32

aelf.SInt64Value

FieldTypeDescriptionLabel
valuesint64

aelf.ScopedStatePath

FieldTypeDescriptionLabel
addressAddress The scope address, which will be the contract address.
pathStatePath The path of contract state.

aelf.SmartContractRegistration

FieldTypeDescriptionLabel
categorysint32 The category of contract code (0: C#).
codebytes The byte array of the contract code.
code_hashHash The hash of the contract code.
is_system_contractbool Whether it is a system contract.
versionint32 The version of the current contract.

aelf.StatePath

FieldTypeDescriptionLabel
partsstring The partial path of the state path.repeated

aelf.Transaction

FieldTypeDescriptionLabel
fromAddress The address of the sender of the transaction.
toAddress The address of the contract when calling a contract.
ref_block_numberint64 The height of the referenced block hash.
ref_block_prefixbytes The first four bytes of the referenced block hash.
method_namestring The name of a method in the smart contract at the To address.
paramsbytes The parameters to pass to the smart contract method.
signaturebytes 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

FieldTypeDescriptionLabel
writesTransactionExecutingStateSet.WritesEntry The changed states.repeated
readsTransactionExecutingStateSet.ReadsEntry The read states.repeated
deletesTransactionExecutingStateSet.DeletesEntry 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_idHash The transaction id.
statusTransactionResultStatus The transaction result status.
logsLogEvent The log events.repeated
bloombytes 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.
return_valuebytes The return value of the transaction execution.
block_numberint64 The height of the block that packages the transaction.
block_hashHash The hash of the block that packages the transaction.
errorstring Failed 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.Address The contract address of the controller.
owner_addressaelf.Address The address of the owner of the contract.