diff --git a/OEPS/OEP-35.mediawiki b/OEPS/OEP-35.mediawiki new file mode 100644 index 0000000..82edd97 --- /dev/null +++ b/OEPS/OEP-35.mediawiki @@ -0,0 +1,150 @@ +
+  OEP: 35
+  Title: Ontology Cross-Chain Standard
+  Author: zhangmh
+  Type: Standard
+  Status: Accepted
+  Created: 2019-6-12
+
+ +=Abstract= +The OEP-35 Proposal is a standard interface for Ontology Cross-Chain, this standard allows you to transfer asset or any type of informations in smartcontract among different homogeneous sidechains and heterogeneous side-chains. + +=Motivation= +Now blockchains are isolated and unable to communicate with each other. But with the development of blockchain ecosystem and smart contract DApp, the requirement of breaking through barriers between different block chains is more and more intense. + +Ontology provides multichain network and allows ontology mainnet and these side-chains communicate to each other. Developers can use cross-chain API in their ontology smartcontract. + +The OEP-35 proposal is the standard specify how the this technology works. + +=Specification= +==Contract== +===Chain Manager Contract=== +====initConfig==== + +func InitConfig(native *native.NativeService) ([]byte, error) {} + +This method init chain manager contract, will be invoked automatically when block chain starts. + +====registerMainChain==== + +func RegisterMainChain(native *native.NativeService) ([]byte, error) {} + +This method is available in side chain, register main chain's key header to side chain. + +====registerSideChain==== + +func RegisterSideChain(native *native.NativeService) ([]byte, error) {} + +This method is available in main chain, register side chain's information and genesis header to main chain. + +====setGovernanceEpoch==== + +func SetGovernanceEpoch(native *native.NativeService) ([]byte, error) {} + +This method set governance epoch of a certain chain. + +====approveSideChain==== + +func ApproveSideChain(native *native.NativeService) ([]byte, error) {} + +This method is available in main chain, approve the registration of side chain. + +====rejectSideChain==== + +func RejectSideChain(native *native.NativeService) ([]byte, error) {} + +This method is available in main chain, reject the registration of side chain. + +====quitSideChain==== + +func QuitSideChain(native *native.NativeService) ([]byte, error) {} + +This method is available in main chain, quit side chain. + +====approveQuitSideChain==== + +func ApproveQuitSideChain(native *native.NativeService) ([]byte, error) {} + +This method is available in main chain, approve the quit request of side chain. + +====blackSideChain==== + +func BlackSideChain(native *native.NativeService) ([]byte, error) {} + +This method is available in main chain, put side chain into black list. + +====stakeSideChain==== + +func StakeSideChain(native *native.NativeService) ([]byte, error) {} + +This method is available in main chain, add stake of side chain. + +====unStakeSideChain==== + +func UnStakeSideChain(native *native.NativeService) ([]byte, error) {} + +This method is available in main chain, reduce stake of side chain. + +====inflation==== + +func Inflation(native *native.NativeService) ([]byte, error) {} + +This method is available in main chain, inflation ong of side chain. + +====approveInflation==== + +func ApproveInflation(native *native.NativeService) ([]byte, error) {} + +This method is available in main chain, approve the Inflation of side chain. + +====rejectInflation==== + +func RejectInflation(native *native.NativeService) ([]byte, error) {} + +This method is available in main chain, reject the Inflation of side chain. + +===Header Sync Contract=== +====syncBlockHeader==== + +func SyncBlockHeader(native *native.NativeService) ([]byte, error) {} + +This method sync other chain's block header. + +====syncConsensusPeers==== + +func SyncConsensusPeers(native *native.NativeService) ([]byte, error) {} + +This method is available in side chain, sync other side chain's consensus peers from main chain. + +===Cross Chain Contract=== +====createCrossChainTx==== + +func CreateCrossChainTx(native *native.NativeService) ([]byte, error) {} + +This method create cross chain transaction, put into merkle tree, notify cross chain transaction. + +====processCrossChainTx==== + +func ProcessCrossChainTx(native *native.NativeService) ([]byte, error) {} + +This method process cross chain transaction, verify merkle tree, and call destination contract. + +==Notify== +===Cross Chain Contract=== +====createCrossChainTx==== + +notifyCreateCrossChainTx(native, params.ToChainID, newID, native.Height, ongFee) + +MUST be invoked in createCrossChainTx function. + +====processCrossChainTx==== + +notifyProcessCrossChainTx(native, params.FromChainID, merkleValue.RequestID, params.Height, ongFee) + +MUST be invoked in processCrossChainTx function. + +==Implementation== +====Example implementations are available at==== +[[https://github.com/siovanus/ontology/tree/main-chain/smartcontract/service/native | Contract Template]] +