DAppChain comprises three fundamental elements for cross-chain interplay: MainChain gateway contract, Oracle service, and Facet-chain gateway contract.
Oracle listens to the messages from the main-chain gateway contract and the side-chain gateway contract, and realizes the interactive communication between the main-chains and side-chains. When greater than 2/three of the oracle nodes confirmed an cross-chain transaction, the transaction could be thought-about to be legitimate.
Cross-chain interplay could be categorized as three fundamental sort: TRC20/TRC721 contract mapping, asset deposit, and asset withdraw.
Asset proprietor have to set off TRC20/TRC721 mapping perform to approve entry for the asset emigrate to side-chain. The asset could be mapping to side-chain routinely, and nobody have to deploy by themselves.
- Deployer ought to personal(deployed) an TRC20/TRC721 contract on main-chain.
- Asset Deployer ought to set off mapping perform in gateway contract for owned TRC20/TRC721 contract. Gateway contract will verified the possession. If verified, an deploy occasion shall be occasion.
- Oracle catches the deploy occasion.
- Oracle set off side-chain gateway contract to create TRON normal side-chain TRC20/TRC721 contract, and do a cross-chain mapping.
Consumer makes use of deposit perform in gateway contract for asset migration to side-chain goal.
- When migrate TRC20/TRC721 token, consumer have to set off an approve perform in TRC20/TRC721 contract on main-chain.
- Consumer triggers deposit perform in MainChain gateway contract.
- Oracle catches deposit occasion.
- Oracle name perform in SideChain gateway for asset migration.
- For TRC20/TRC7212 token, side-chain will mint certain amount of token within the mapped contract, whereas TRX/TRC10 token shall be added instantly on consumer account.
Consumer makes use of withdraw perform in gateway contract for asset migration to main-chain goal.
- When migrate TRC20/TRC721 token, consumer have to set off an approve perform in TRC20/TRC721 contract on side-chain. Gateway contract would name TRC20/TRC721 contract instantly on account of our customization.
- Oracle catches the withdraw occasion.
- Consumer calls the withdraw perform on main-chain.
- MainChain gateway contract calls TRC20/TRC721 contract for withdraw operation, whereas TRX/TRC10 would have the ability to ship on to consumer account.