0g-chain/x/bep3/spec/01_concepts.md
Denali Marsh a4c5a13822
[R4R] BEP3 module spec and clean up (#450)
* bump SDK version to v0.38.2

* fix module.go and remove codespaces

* fix coins Add()

* fixes to handlers

* migrate errors

* more fixes

* fixes fixes fixes

* build

* check for paramstore keytable

* empty param validation function (TODO)

* param validations

* fix some tests

* fix all tests

* simulation fixes (WIP)

* auction and bep3 sim refactor

* fixes

* bep3 sims fixes

* auction and pricefeed fix

* cdp sims fixes

* fix tests

* Update x/auction/keeper/auctions.go

Co-Authored-By: Denali Marsh <denali@kava.io>

* Update x/bep3/types/params.go

Co-Authored-By: Denali Marsh <denali@kava.io>

* Apply suggestions from code review

Co-Authored-By: Denali Marsh <denali@kava.io>

* Update x/bep3/keeper/swap.go

Co-Authored-By: Denali Marsh <denali@kava.io>

* address comments from review

* address comments from review

* fix: run sims

* fix: implement marshal/unmarshal JSON for validator vesting account

* fix: don't call set on sealed config

* remove swap interface

* add concepts spec

* add state spec

* add messages spec

* update event names

* implement swap expired event

* add events spec

* add params spec

* add begin block spec

* add module readme

* update alias

* revisions

* aggregate expired swap ids for event emisison

* markdown-link-check-disable for circleci

* exclude api-endpoint links in Makefile

Co-authored-by: Federico Kunze <federico.kunze94@gmail.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Kevin Davis <kjydavis3@gmail.com>
2020-04-23 13:57:25 -07:00

2.6 KiB
Raw Blame History

Concepts

The BEP3 module implements the BEP3 protocol for secure cross-chain asset transfers between Kava and other BEP3 compatible chains, such as Binance Chain. Tranactions are witnessed and relayed between the two blockchains by Binance's BEP3 deputy process. The deputy maintains an address on both chains and is responsible for delivering tokens upon the successful completion of an Atomic Swap. Learn more about the BEP3 deputy process here.

Requirements

Kava

Binance Chain

  • The deputys Binance Chain testnet address is tbnb1et8vmd0dgvswjnyaf73ez8ye0jehc8a7t7fljv.
  • We recommend using https://testnet-dex.binance.org/ as Binance Chains API endpoint.

Kava's JavaScript SDK and Binance Chains JavaScript SDK can be used to create, claim, and refund swaps.

Binance Chain to Kava

When a user wants to transfer tokens from Binance Chain to Kava, the following steps are taken:

  1. Users tokens are locked on Binance Chain along with the hash of a secret only known to the user. If the secret is not revealed before the deadline, the tokens are refundable.
  2. The deputy sends a message to Kava saying “a user has locked X tokens, if their secret is revealed before the deadline issue them an equivalent amount of pegged tokens”.
  3. The user reveals the secret on Kava and receives the pegged tokens.
  4. The deputy relays the secret to Binance Chain and the original tokens are locked permanently.

Binance Chain to Kava Diagram

Kava to Binance Chain

  1. When a user wants to transfer tokens from Kava to Binance Chain by redeeming pegged tokens, the following steps are taken: Users pegged tokens are locked on Kava along with the hash of a secret only known to the user. If the secret is not revealed before the deadline, the tokens are refundable.
  2. The deputy sends a message to Binance Chain saying “a user has locked X pegged tokens, if their secret is revealed before the deadline issue them an equivalent amount of tokens”.
  3. The user reveals the secret on Binance Chain and receives the tokens.
  4. The deputy relays the secret to Kava and the pegged tokens are locked permanently.

Kava to Binance Chain Diagram