mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-14 03:55:19 +00:00
3784b4971b
* update bep3 docs for mainnet * update make link-check
2.6 KiB
2.6 KiB
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. Transactions 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
- The deputy’s Kava address on mainnet is kava1r4v2zdhdalfj2ydazallqvrus9fkphmglhn6u6.
- Kava's official API endpoint is https://kava3.data.kava.io.
Binance Chain
- The deputy’s Binance Chain address on mainnet is bnb1jh7uv2rm6339yue8k4mj9406k3509kr4wt5nxn.
- We recommend using https://testnet-dex.binance.org/ as Binance Chain’s API endpoint.
Kava's JavaScript SDK and Binance Chain’s 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:
- User’s 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.
- 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”.
- The user reveals the secret on Kava and receives the pegged tokens.
- The deputy relays the secret to Binance Chain and the original tokens are locked permanently.
Kava to Binance Chain
- When a user wants to transfer tokens from Kava to Binance Chain by redeeming pegged tokens, the following steps are taken: User’s 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.
- 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”.
- The user reveals the secret on Binance Chain and receives the tokens.
- The deputy relays the secret to Kava and the pegged tokens are locked permanently.