Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

Bi-directional Native to Meta Asset "Trustless" Bridging #96

Open
fuxingloh opened this issue Sep 14, 2022 · 4 comments
Open

Bi-directional Native to Meta Asset "Trustless" Bridging #96

fuxingloh opened this issue Sep 14, 2022 · 4 comments
Labels
area/ain issues/pr that requires changes on the DeFiCh/ain codebase. area/meta kind/feature New feature request meta/consensus needs/triage Waiting for triage to be accepted

Comments

@fuxingloh
Copy link
Contributor

What would you like to be added:

Bi-directional bridging of assets between Native & Meta Chain. Essentially a trustless bridge between the 2 chain within the same ecosystem. This requires understanding of the current trustless bridging design that earmark to be documented in #8.

Introduction of 2 Smart Contract (DfTX & EVM Contract). All supply of DFI comes from the Native Chain. Burning on Native = minting on Meta and vice-versa.

This requires the relevant Transactions to be performed and exchanged between chains. The transaction must be interpolated from 2 chains.

  • Native DfTx.Meta.send(pubKey, AccountDFI.Amount), burn from Account, claim on EVM
  • Meta Contract.send(pubKey, EVMNativeDFI.Amount), burn from Contract, claim on Native Account

Implementation on Native DMCHandler() and Meta Connect/Mint Handler

RPC Methods in #89 and related to #94

  • The proposed use of a global counter on both Native and Meta to track balance movement to set governance limits.

RPC metaConsensusRpc_mintBlock and handled on Native DMCHandler():

Extract "DfTx.Meta.send" on Native and pass it as structured request params when minting block on MetaChain. MetaChain will automatically include "minting" transaction crediting to the respective address.

RPC metaConsensusRpc_connectBlock and handled on Native DMCHandler():

Extract "Meta Contract.send" on Meta and return it as a structured response for DMCHandler() to process "bridging claims" on the Native layer via DMCHandler(). Burn Meta > Mint Native.

@fuxingloh fuxingloh added kind/feature New feature request meta/consensus area/meta area/ain issues/pr that requires changes on the DeFiCh/ain codebase. labels Sep 14, 2022
@fuxingloh fuxingloh added this to the MetaChain MainNet milestone Sep 14, 2022
@defichain-bot defichain-bot added the needs/triage Waiting for triage to be accepted label Sep 14, 2022
@defichain-bot
Copy link
Member

@fuxingloh: Thanks for opening an issue, it is currently awaiting triage.

The triage/accepted label can be added by foundation members by writing /triage accepted in a comment.

Details

I am a bot created to help the DeFiCh developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@wafflespeanut
Copy link

Posting @canonbrother's logic here so that it doesn't get lost:

DFC

DMCtxs = DFCtxs.map(tx.type === DMC)
DFC.call('defi_mint', [sender, DMCTxs])
DFC.lock(txs, vault)

DMC

mint(sender, DFCtxs) {
  validate(sender) // must be validator
  { dest, amt } = DFCTxs
  issue(amt, dest)
  // let **Aura** handle all these txs in pool.. 
}

@canonbrother
Copy link
Contributor

canonbrother commented Nov 3, 2022

graph

mint([DFI are minted])
lock([DFI are locked])
burn([DFI are burned])
unlock([DFI are unlocked])

subgraph DFC
F203 --> F204 --> F205 --> F206 --> F207 --> F208
end

subgraph DMC
M1 --> M2 --> M3
end

F204 -.-> M1
mint --> M1
lock --> F204

M3 -.-> F208
burn --> M3
unlock --> F208

Loading

@canonbrother
Copy link
Contributor

graph

send20P([$20:PENDING])
send20A([$20:ACTIVE])
send46P([$46:PENDING])
send46A([$46:ACTIVE])

subgraph DFC
F203 --> F204 --> F205 --> F206 --> F207 --> F208 --> F209
end

subgraph DMC
M1 --> M2 --> M3 --> M4 --> M5 --> M6
end

F204 --send $20 to DMC--> M1
send20P -.-> M1
M2 --verify block is confirmed--> F205
send20A -.-> M3

M5 --send--> F207
send46P -.-> F207
F208 --verify --> M6
send46A -.-> F209
Loading

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/ain issues/pr that requires changes on the DeFiCh/ain codebase. area/meta kind/feature New feature request meta/consensus needs/triage Waiting for triage to be accepted
Projects
None yet
Development

No branches or pull requests

4 participants