Skip to content

Commit

Permalink
docs: add docs for BC fusion (bnb-chain#255)
Browse files Browse the repository at this point in the history
* docs: add docs for BC fusion preparation
  • Loading branch information
forcodedancing authored Jan 15, 2024
1 parent a302f1a commit 37f1430
Show file tree
Hide file tree
Showing 18 changed files with 325 additions and 2 deletions.
Binary file added docs/assets/bcfusion/phases.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/bcfusion/tw1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/bcfusion/tw2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/bcfusion/user-asset-management1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/bcfusion/user-asset-management2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/bcfusion/user-asset-management3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/bcfusion/user-asset-management4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/bcfusion/user-atomic-swap1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/bcfusion/user-timelock1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions docs/bcfusion/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Overview

BNB Beacon Chain is a blockchain developed by the BNB Chain community that implements a vision of a decentralized
exchange (DEX) for digital assets. Besides this, Beacon Chain and BSC is a dual-chain structure: Beacon Chain helps to
enhance the security of BSC as a staking and governance layer. With the rise of various other forms of Dex, order-book
based decentralized exchange was decommissioned
in [BEP151](https://github.com/bnb-chain/BEPs/blob/master/BEPs/BEP151.md). With the quick evolution of BSC, the Beacon
Chain has become a burden. The cross-chain bridge that connects the two chains slows down the development iteration and
always exposes BNB to a certain level of security vulnerabilities. It's time to take a step further and migrate the
functionality of Beacon Chain to BSC, **allowing Beacon Chain to retire**.

![img](../assets/bcfusion/phases.png)

There will be several pahses to retrie Beacon Chain:

- **First Sunset Fork** - Some types of Beacon chain transactions will be disabled, for example, TimeLockMsg,
TimeRelockMsg,
FreezeMsg, IssueMsg, MintMsg, IssueMiniMsg, HTLTMsg, DepositHTLTMsg, MsgCreateValidatorOpen,
MsgCreateSideChainValidator, MsgCreateSideChainValidatorWithVoteAddr, MsgEditSideChainValidatorWithVoteAddr,
MsgSideChainDelegate, MsgSideChainReDelegate. (Estimated time on mainnet: 2024 Feb)
- **BSC Feynman Hardfork** - Native validators and staking, native goverenance will be enabled on BNB Smart Chain.
The BSC validators/delegators can start migrations after the Feynman upgrade. (Estimated time on mainnet: 2024 Apr)
- **Second Sunset Fork** - More Beacon chain transactions will be disabled, for example,MsgSideChainSubmitProposal. All
TimeLock and AtomicSwap will automatically be refunded to the user's
wallet. All the BSC delegation will be undelegated automatically. (Estimated time on mainnet: 2024 Jun)
- **Final Sunset Fork** - Cross-chain communication between the Beacon Chain and BSC will be completely stopped. (
Estimated time on mainnet: 2024 Jun)
- **Post BC Fusion** - Beacon Chain will be dumped and and a merkle tree will be generated for recover the assets, which
are binded to BSC however not transffered to BSC yet.

All stakholders (e.g., token holders/owners, validators, project owners) should pay attention BNB Chain blog for
releated annonuncements and take actions proactively.

For more information about BNB Chain fusion, please refer
to [BEP-333](https://github.com/bnb-chain/BEPs/pull/333?ref=bnbchain.ghost.io).

For the roadmap and milestons of BNB Chain fusion, please refer
to [the blog](https://www.bnbchain.org/en/blog/bnb-chain-fusion-roadmap).

27 changes: 27 additions & 0 deletions docs/bcfusion/owners/bind.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Token Bind

Token binding was introduced to faciliate that one token can circulate in both BC and BSC with confirmed total supply.
- If a token is binded, then it can be transferred bewteen BC and BSC for different use cases.
After [the final sunset
hardfork](https://github.com/bnb-chain/bEPs/pull/333), the cross chain between BC and BSC will be shutdown.
However, users still can use token recover tool to recover the binded assets on BSC (but it is much more complex compared to crosschain transfer).
- If a token is not binded, after the final sunset hardfork, the assets cannot be recovered anymore.
Token owners or issuers should take actions to bind their valueable tokens.

***NOTE: The BC Fusion program is scheduled for implementation in April 2024. Please ensure careful planning for the
asset migration and keep the fund safe.***

Please check the tutorial [**Confirm if the Assets Support Cross-chain Transfers**](../users/assets.md) to verify if the
token allows cross-chain
transfers. If the answer is positive, congratulations! You don't need
to do anything. Otherwise, it is highly recommended to follow the
[Token Bind Tool](https://github.com/bnb-chain/token-bind-tool) to
deploy a BEP20 token on BSC and enable cross-chain functionality.

Due to the time limitation, the Token Issuer should take actions as soon as possbile. It is
recommended that the Token Issuer use multiple channels to promptly
notify asset holders to migrate as soon as possible.

***Note: BEP2/BEP8 assets that do not support cross-chain functionality
will be permanently lost after BC Fusion. Users will be unable to
recover these assets forever.***
115 changes: 115 additions & 0 deletions docs/bcfusion/users/assets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import Wallet1 from '../../assets/bcfusion/user-asset-management3.png';
import Wallet2 from '../../assets/bcfusion/user-asset-management4.png';
import Tw1 from '../../assets/bcfusion/tw1.PNG';
import Tw2 from '../../assets/bcfusion/tw2.PNG';

# Asset Management

The BNB Chain community recently introduced [BEP333: BNB Chain
Fusion](https://github.com/bnb-chain/BEPs/pull/333). This
BEP aims to retire the BNB Beacon Chain from the BNB Chain ecosystem.
The goal is to enhance the development efficiency, security, and asset
utilization efficiency of BSC. It also aims to reduce the maintenance
costs of legacy services. This tutorial aims to help digital asset
issuers and holders on the BNB Beacon Chain transfer the value of their
assets,
including [BEP2](https://github.com/bnb-chain/BEPs/blob/master/BEPs/BEP2.md)/[BEP8](https://github.com/bnb-chain/BEPs/blob/master/BEPs/BEP8.md)
tokens, before and after BC Fusion. By following this guide, users can
avoid any potential losses of their valuable digital assets.

***NOTE: The BC Fusion program is scheduled for implementation in April 2024. Please ensure careful planning for the
asset migration and keep the fund safe.***

## Before BC Fusion

Most valuable BEP2/BEP8 tokens such as BNB, BTC, and BUSD can freely
move between the Beacon Chain and BSC networks. Users are strongly
advised to transfer their assets to the BSC network to ensure a seamless
and lossless transition, maintaining a 1:1 ratio. Of course, there are
alternative channels available for asset transfers, such as utilizing
centralized exchanges or decentralized cross-chain exchanges like
Binance.com and [Thorswap](https://thorswap.finance/).
However, these options are beyond the scope of this tutorial.

**Step1: Confirm if the Assets Support Cross-chain Transfers**

Open the Beacon Chain blockchain explorer, go to the [BEP2
Asset](https://explorer.bnbchain.org/assets/bep2) page or
[BEP8 Asset](https://explorer.bnbchain.org/assets/bep8)
page, and search for the token name to query it. Using BTC as an
example, it is linked to a BSC Contract address, allowing for
cross-chain transfers.

![img](../../assets/bcfusion/user-asset-management1.png)

In contrast to GTEX-71B, which lacks a BSC Contract address and thus
does not support cross-chain transfers.

![img](../../assets/bcfusion/user-asset-management2.png)

If a user needs to transfer assets that don't support cross-chain
transfers, it's strongly recommended to contact the token owner/issuer
as soon as possible. **Ask the token issuer to refer to [the token bind tutorial](../owners/bind.md) for issuing BEP20
tokens on BSC and
enabling cross-chain transfers. If the token issuer does not enable
cross-chain transfer for the token before the sunset of BNB Beacon
Chain, the funds will be lost forever and can not be recovered.**

**Step2: Simply Transfer the Assets to the BSC Network**

[BNB Chain Wallet](https://chromewebstore.google.com/detail/bnb-chain-wallet/fhbohimaelbohpjbbldcngcnapndodjp)
and [Trust Wallet](https://trustwallet.com/) mobile are suggested for this case. Taking BNB Chain Wallet as an example,
once users import the accounts that have the tokens, they need to switch the
network to "BNB Beacon Chain Network":

<img src={Wallet1} width="400"/>


Then, select the asset to transfer, enter the BSC account and the token
amount.

<img src={Wallet2} width="400"/>

The BSC wallet will receive the token after approximately one minute.

For Trust Wallet mobile multi-chain wallet users, they can transfer their assets in the following way.

<img src={Tw1} width="400"/>

Firstly, you need to open the `Swap` tab, choose From network as `BNB Beacon Chain` and To network as `BNB Smart Chain`,
then find the asset you want to transfer and input the transfer amount.
After you click the `Continue` button, it will redirect you to the approval page as below.

<img src={Tw2} width="400"/>

Finally, the related asset will be transferred to BSC after you confirm the transaction.

## After BC Fusion

Following the retirement of Beacon Chain, it is believed that some users
have not yet transferred their assets to the BSC network. BNB Chain is
still providing relief measures for these users: [BEP299-Token
Migration after BC
Fusion](https://github.com/bnb-chain/BEPs/pull/299).

Although this solution has its limitations, it is important to note the
following key points:

1. It is only applicable to assets that have enabled cross-chain features. **The BEP2/BEP8 assets will be permanently
lost** **if not the case.**

2. Users are still responsible for securely storing their private keys on the Beacon Chain and using them for signing as
proof.

3. The process of recovering assets will take up to 7 days to complete.

4. This solution is operated through the command line and does not provide any UI.

Considering these limitations, it is highly recommended that users
complete the token transfer before BC fusion as much as possible.

The detailed guide for this solution will be published after the BC
Fusion.
Stay tuned for the update.


2 changes: 2 additions & 0 deletions docs/bcfusion/users/delegations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This page will guide users to manage their delegations.
Please be patient for updates.
68 changes: 68 additions & 0 deletions docs/bcfusion/users/swaps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Atomic Swap Management

HTLC based atomic swaps are introduced in
[BEP3](https://github.com/bnb-chain/BEPs/blob/master/BEPs/BEP3.md),
to facilitate payment and asset exchanges between different blockchains.
For BC fusion, in [the first sunset
hardfork](https://github.com/bnb-chain/bEPs/pull/333), the
creation and deposit of atomic swaps will be disabled, project owners
(e.g., cross-chain exchanges, bridges) and users should be aware of this
and take proactive steps.

## Query Atomic Swaps

The [atomic swap api](https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1atomic-swaps)
is provided to query existing atomic swaps. Usually, user can provide a
from address to query the related atomic swaps, for example:

[https://dex.bnbchain.org/api/v1/atomic-swaps?fromAddress=bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr](https://dex.bnbchain.org/api/v1/atomic-swaps?fromAddress=bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr)

![img](../../assets/bcfusion/user-atomic-swap1.png)

The response will contain a lot of useful information, such as id of the
swap, the asset of the swap, and other information.

## Handle Atomic Swaps

### Before BC Fusion

A user can proactively refund his/her atomic swaps by sending **HTLC Refund** transactions to Beacon Chain. The command
to send such
transaction is looks like this:

```shell
./bnbcli token refund --swap-id <swapID> --from <from-key> --chain-id Binance-Chain-Tigris --trust-node --node http://dataseed1.bnbchain.org:80
```

For more information about the command, please refer to
the [Refund HTLC section](https://docs.bnbchain.org/docs/beaconchain/atomic-swap#refund-htlt).

If no proactive refunds are submitted, in [the second sunset hardfork](https://github.com/bnb-chain/bEPs/pull/333), all
existing atomic swaps will be automatically refunded to the creators'
accounts on Beacon Chain. The refund will proceed in many Beacon Chain
blocks, depending on how many atomic swaps still exist on the
blockchain. After refund, users should be able to find the assets in
their accounts. Then users can handle the assets as other BEP2/BEP8
tokens. For how to cross transfer them to BNB Smart Chain, please
refer to [this tutorial](./assets.md).

### After BC Fusion

If the refunded assets are not transferred to BSC
before [the final sunset fork](https://github.com/bnb-chain/bEPs/pull/333),
users need to use the token-recover tool to get their binded BEP2/BEP8
assets. For more information, please refer to [this
tutorial](https://docs.google.com/document/d/1rMWwYGt-s6FXcRiUrBSN8dtOU96HDz0T3GaZyzbo7VQ/edit?pli=1#heading=h.df0svx3bznak).

## For Atomic Swap Project Owers

Because in [the first sunset hardfork](https://github.com/bnb-chain/bEPs/pull/333), the
creation and deposit of atomic swaps will be disabled, so project owners
need to disable related functions in their projects IN ADVANCE and
notify their uses to take proactive actions to refund their tokens.

## Other Useful References

- [Refund Atomic Swap](https://docs.bnbchain.org/docs/beaconchain/atomic-swap#refund-htlt)

- [Query Atomic Swap](https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1atomic-swaps)
33 changes: 33 additions & 0 deletions docs/bcfusion/users/timelocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# TimeLock Management

A timelock is a feature that allows users to lock their assets for a certain period of time, which is introduced
in (https://github.com/bnb-chain/BEPs/blob/master/BEPs/BEP9.md).
For BC fusion, in [the second sunset
hardfork](https://github.com/bnb-chain/bEPs/pull/333), all timelocks will be refunded to users' accounts.
Users should proactively actionsj to transfer these assets to BSC after receiving the refunds.

## Query TimeLocks

The [time lock api](https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1timelocksaddress)
is provided to query existing timelocks. Usually, user can provide a
from address to query the related timelocks, for example:

[https://dex.bnbchain.org/api/v1/timelocks/bnb1rmet5j5pwc3xvhd82rwdjkvewzgmreh6we72sf](https://dex.bnbchain.org/api/v1/timelocks/bnb1rmet5j5pwc3xvhd82rwdjkvewzgmreh6we72sf)

![img](../../assets/bcfusion/user-timelock1.png)

The response will contain a lot of useful information, such as id of the
timelock, the asset of the timelock, and the unlock time.

## Handle TimeLocks

Once the timelock is created, the owners cannot access their assets until the unlock time has passed.
During [the second sunset hardfork](https://github.com/bnb-chain/bEPs/pull/333), all
existing timelocks will be automatically refunded to the creators'
accounts on Beacon Chain. The refund will proceed in many Beacon Chain
blocks, depending on how many timelocks still exist on the
blockchain. After refund, users should be able to find the assets in
their accounts. Then users can handle the assets as other BEP2/BEP8
tokens. For how to cross transfer them to BNB Smart Chain, please
refer to [this tutorial](./assets.md).

2 changes: 2 additions & 0 deletions docs/bcfusion/validators/creation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This page will guide validators to create new native BSC validators.
Please be patient for updates.
2 changes: 2 additions & 0 deletions docs/bcfusion/validators/migrations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This page will guide validators to migrate their BSC validators.
Please be patient for updates.
39 changes: 37 additions & 2 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,43 @@ const sidebars = {
label: 'opBNB',
href:'https://docs.bnbchain.org/opbnb-docs/',
},

],

{
type: 'category',
label: '🌅BNB Beacon Chain Sunset',
collapsible: true,
collapsed: true,
items: [
{type: 'doc', label: 'Overview', id:'bcfusion/overview'},
{
type: 'category',
label:'For Users',
items:[
{type:'doc', id:'bcfusion/users/assets', label:'Manange Your Assets'},
{type:'doc', id:'bcfusion/users/swaps', label:'Manage Your Atomic Swaps'},
{type:'doc', id:'bcfusion/users/timelocks', label:'Manage Your TimeLocks'},
{type:'doc', id:'bcfusion/users/delegations', label:'Manage Your Delegations'},
]
},
{
type: 'category',
label:'For Token Issuers',
items:[
{type:'doc', id:'bcfusion/owners/bind', label:'Bind Your Tokens'},
]
},
{
type: 'category',
label:'For Validators',
items:[
{type:'doc', id:'bcfusion/validators/migrations', label:'Migrate Your Validators'},
{type:'doc', id:'bcfusion/validators/creation', label:'Create New Validators'},
]
},
],
},

],
},
{
type: 'category',
Expand Down

0 comments on commit 37f1430

Please sign in to comment.