Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BEP-299: Token Migration after BC Fusion #299

Merged
merged 4 commits into from
Feb 27, 2024

Conversation

j75689
Copy link
Contributor

@j75689 j75689 commented Oct 18, 2023

  BEP: 299
  Title: Token Migration after BC Fusion
  Status: Draft
  Type: Standards
  Created: 2023-10-16

BEP-299: Token Migration after BC Fusion

1. Summary

After the Beacon Chain fusion, certain digital assets remain on the Beacon Chain. This proposal presents a secure and trustless solution for users to recover their assets on the BSC once the BC stops running.

2. Abstract

Before the discontinuation of operations on the Beacon Chain, it is highly recommended that users promptly transfer their assets to other networks through cross-chain transactions. Once BC ceases operations, the community team will capture a snapshot of users' assets on BC, which will be publicly released and acknowledged by the community. Subsequently, a Merkle tree will be generated based on the users' balances in the snapshot. The root of this tree will be stored in the system contract of BNB Smart Chain (BSC).

Any user can prove their ownership of the original tokens on BC by providing a Merkle proof and their BC account's signature. Once the ownership and token information are verified, the system contract on BSC will unlock the corresponding amount of tokens from the token hub and allocate them to the user's account on BSC. Users can initiate token claims through a web app or command line interface (CLI).

3. Status

Draft.

4. Motivation

The Beacon Chain was originally created as a platform for issuing data assets. Currently, there are 7.6 million accounts on BC, along with 557 tokens that comply with the BEP2 or BEP8 standards. The digital assets of these users will not vanish with BC Fusion. BNB Chain is responsible for safeguarding the assets of these users, irrespective of their value. Users do not have a specific ETA to access these assets. However, BC Fusion is expected to happen within a reasonable timeframe. We plan to implement a solution that enables the timely execution of BC Fusion and secure access to users' digital assets afterwards.

5. Specification

5.1 Asset Back to Wallet

Digital assets on the BNB Beacon Chain may not always be stored in a user's wallet in specific situations. For example, when users participate in staking, their BNB is actually transferred to the system account of the staking module until they redeem it. Modules that can cause similar asset transfers include:

  • Staking module.
  • Timelock module.
  • Atomic swap module.
  • Governance module.

The mentioned modules allow users to contribute funds to a shared pool, making it difficult to distinguish an individual user's share. Hence, we need a solution to ensure users can retrieve their funds into their wallets.

Before BC (Blockchain) comes to a halt, the following logic will be executed:

  1. Disable all transactions that would channel user funds into the liquidity pool.
  2. During the endblock phase, the following transactions are automatically triggered to return user funds to their wallets, like unstake, timer unlock, and atomic swap unlock.

Assets in a user's wallet can be in three states: Free, Frozen, and Locked. When calculating the asset balance, we consider the quantities in all three states. So, even if a token is Locked or Frozen when the Beacon Chain halts, it can still be recovered on the BSC chain.

5.2 Asset Recover

5.2.1 Asset Tree

Asset Tree

The user's asset is abstracted as a node, which includes the account address, symbol, and amount. We'll exclude assets from non-EOA accounts, including module system accounts and clearly dead addresses. All these nodes are sorted in lexicographical order based on their keys, and then used to construct a Merkle tree. This Merkle tree will be published in the form of a file on GitHub and Greenfield, allowing anyone to verify the accuracy of their assets based on this file. Community members can challenge the accuracy and integrity of this document, and if any errors are found, the core team will make corrections until there are no objections.

The Merkle tree enables anyone to verify token ownership on the blockchain using a Merkle proof. It ensures that an account possesses a specific number of tokens represented by the symbol "symbol."

Note that only tokens that have been linked to BEP20 tokens on BSC will create a Node. Therefore, assets that have not been mirrored to BSC prior to the BC halting can not be restored.

5.2.2 Asset Recovery App

Asset Recovery App

This system consists of two main components:

  1. Approval server. This is an off-chain API service operated by the BNB Chain Foundation. It enables users to retrieve assets by providing merkle proof and approval signature. Only with the approval signature can users recover assets from the BSC network.
  2. Asset Claim Contract. This contract is responsible for handling users' requests to claim assets. It verifies and records the requests to prevent duplicate claims.

The key process for users to claim assets in the BSC network is as follows:

  1. Users use the private key of the asset owner on BC to sign {account address, symbol, amount, receiver}, and request approval through the approval server.
  2. The approval server will fetch the node from a trust merkle tree, and
    a. verify the account, symbol, amount are correct.
    b. the signature is signed by the token owner.
    c. the token is not claimed yet.
    After that, the approval will generate the merkle proof for this request and sign for the request using its approval key.
  3. The user will send a transaction to the Asset Claim contract with merkle proof, node info, BC signature, signature from the approver, receiver account.
  4. The Asset Claim contract will do following checks
    a. The asset of this node is never claimed.
    b. The approval signature comes from the approver.
    c. The BC signature comes from the owner of the token.
    d. The merkle proof is able to prove the node is a leaf node of the tree.
    After all checks are passed, the Asset Claim contract will invoke the token hub contract to unlock the corresponding token to the receiver.

5.2.3 Security Enhancement

Considering the highly flexible implementation approach of BEP20 tokens on theBSC, there may be unforeseen scenarios that the BEP overlooks. During the initial phase of the BEP, the Approval Server only allows for the tokens in a whitelist that can be claimed.

For tokens that are not in the whitelist, users can submit requests on the forum. After the core developers review the security of the token, it can be added to the whitelist.

6. License

The content is licensed under CC0.

@j75689 j75689 changed the title BEP-298: Token Migration after BC Fusion BEP-299: Token Migration after BC Fusion Oct 31, 2023

Before the discontinuation of operations on the Beacon Chain, it is highly recommended that users promptly transfer their assets to other networks through cross-chain transactions. Once BC ceases operations, the community team will capture a snapshot of users' assets on BC, which will be publicly released and acknowledged by the community. Subsequently, a Merkle tree will be generated based on the users' balances in the snapshot. The root of this tree will be stored in the system contract of BNB Smart Chain (BSC).

Any user can prove their ownership of the original tokens on BC by providing a Merkle proof and their BC account's signature. Once the ownership and token information are verified, the system contract on BSC will unlock the corresponding amount of tokens from the token hub and allocate them to the user's account on BSC. Users can initiate token claims through a web app or command line interface (CLI).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a user-friendly web app or a command-line interface (CLI)
--> Do we have a repository for this tool/app. If we do, could you please share the link.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please help recover my all bnb toucan

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today i learned it was swaped to bsc for a while and now my coins are useless….My coins are still in my trustwallet but with the bep2 chain. please help me.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, my coin are still in bep2 in my trust wallet but I don't have enough bnb(bep2) as gas fee. This is really frustrating. Please help

@Meksenmarley1
Copy link

Send

Copy link

@Daniel618-art Daniel618-art left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job


Before the discontinuation of operations on the Beacon Chain, it is highly recommended that users promptly transfer their assets to other networks through cross-chain transactions. Once BC ceases operations, the community team will capture a snapshot of users' assets on BC, which will be publicly released and acknowledged by the community. Subsequently, a Merkle tree will be generated based on the users' balances in the snapshot. The root of this tree will be stored in the system contract of BNB Smart Chain (BSC).

Any user can prove their ownership of the original tokens on BC by providing a Merkle proof and their BC account's signature. Once the ownership and token information are verified, the system contract on BSC will unlock the corresponding amount of tokens from the token hub and allocate them to the user's account on BSC. Users can initiate token claims through a web app or command line interface (CLI).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

@unclezoro unclezoro merged commit 7ba9265 into bnb-chain:master Feb 27, 2024
@Alexforestaneev
Copy link

0xE3E8f928b5b8a628C6ef02c730CC5fFf547d1dd9

Copy link

@jircs jircs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link

@Vekiepepito Vekiepepito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactement

@immense055
Copy link

89d5329

@Alexforestaneev
Copy link

Г

@Alexforestaneev
Copy link

👍

@Pavel1478
Copy link

Guys is it still possible to swap Bep2 tokens ?

Copy link

@Hadi90Ahmed Hadi90Ahmed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Copy link

@ErnestoLara ErnestoLara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@foxweba3
Copy link

מה בדיוק בסדר

@Bi873
Copy link

Bi873 commented Aug 9, 2024

migration


# 5. Specification

## 5.1 Asset Back to Wallet

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.



## 5.2 Asset Recover
### 5.2.1 Asset Tree
![overview](./assets/bep-299/asset_tree.png)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://bscscan.com/address/0x0000000000000000000000000000000000001000#readContract#F2

{
"description": {
"moniker": "BscScan",
"identity": "",
"website": "https://bscscan.com",
"details": "Your Gateway to the Binance Smart Chain Network. BscScan is the leading BSC Block Chain Explorer and one of the earliest independent project built and developed for the Binance Smart Chain"
},
"validatorAddress": "bva1t42gtf6hawqgpmdpjzmvlzvmlttlqtkvlmgjxt",
"commissionRate": 10000000,
"sideChainId": "bsc",
"sideFeeAddr": "0x5cf5d69852151952b1b1faf04d9b6140dae30afd"
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.



**Note that only tokens that have been linked to BEP20 tokens on BSC will create a Node. Therefore, assets that have not been mirrored to BSC prior to the BC halting can not be restored.**

### 5.2.2 Asset Recovery App

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
"description": {
"moniker": "BscScan",
"identity": "",
"website": "https://bscscan.com",
"details": "Your Gateway to the Binance Smart Chain Network. BscScan is the leading BSC Block Chain Explorer and one of the earliest independent project built and developed for the Binance Smart Chain"
},
"commission": {
"rate": 25000000,
"maxRate": 90000000,
"maxChangeRate": 80000000,
"updateTimeInMs": 0
},
"delegatorAddr": "bnb1weh5t6q0qf0nxpnj6flru9g9gdw9wkzm9hrtqn",
"validatorAddr": "bva1t42gtf6hawqgpmdpjzmvlzvmlttlqtkvlmgjxt",
"delegation": {
"amount": 5000000000000,
"denom": "BNB"
},
"sideChainId": "bsc",
"sideConsAddr": "0x70f657164e5b75689b64b7fd1fa275f334f28e18",
"sideFeeAddr": "0x5cf5d69852151952b1b1faf04d9b6140dae30afd"
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Copy link

@octavio12345300 octavio12345300 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


@octavio12345300
Copy link

octavio12345300 commented Aug 17, 2024 via email

Copy link

@DangVanSo DangVanSo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok__

@ZachPowers
Copy link

I just saw the migration requirement on my BNB BEP20 but it won’t allow me to transfer. Says I don’t have enough BNB for gas fees but I do! Please help!

@RemadanAdusebro
Copy link

I'm glad to get for my GitHub account so much appreciated it's

Copy link

@Saaitlafarga Saaitlafarga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si hubo cambios significativo

@Saaitlafarga
Copy link

https://t.me/ShareGifts_bot/ShareGifts?startapp=r_6447748281&💥¡Ya gané $42! 🎁 Obtenga $120.00 todos los días 💵 Gane $5 por cada recomendación 💰 ¡Haz clic en el enlace Juega gratis y comienza a ganar!

@octavio12345300
Copy link

gracias

@octavio12345300
Copy link

,👌

@Kya123iu
Copy link

Kya123iu commented Sep 4, 2024

BEP: 299
Title: Token Migration after BC Fusion
Status: Draft
Type: Standards
Created: 2023-10-16

BEP-299: Token Migration after BC Fusion

1. Summary

After the Beacon Chain fusion, certain digital assets remain on the Beacon Chain. This proposal presents a secure and trustless solution for users to recover their assets on the BSC once the BC stops running.

2. Abstract

Before the discontinuation of operations on the Beacon Chain, it is highly recommended that users promptly transfer their assets to other networks through cross-chain transactions. Once BC ceases operations, the community team will capture a snapshot of users' assets on BC, which will be publicly released and acknowledged by the community. Subsequently, a Merkle tree will be generated based on the users' balances in the snapshot. The root of this tree will be stored in the system contract of BNB Smart Chain (BSC).

Any user can prove their ownership of the original tokens on BC by providing a Merkle proof and their BC account's signature. Once the ownership and token information are verified, the system contract on BSC will unlock the corresponding amount of tokens from the token hub and allocate them to the user's account on BSC. Users can initiate token claims through a web app or command line interface (CLI).

3. Status

Draft.

4. Motivation

The Beacon Chain was originally created as a platform for issuing data assets. Currently, there are 7.6 million accounts on BC, along with 557 tokens that comply with the BEP2 or BEP8 standards. The digital assets of these users will not vanish with BC Fusion. BNB Chain is responsible for safeguarding the assets of these users, irrespective of their value. Users do not have a specific ETA to access these assets. However, BC Fusion is expected to happen within a reasonable timeframe. We plan to implement a solution that enables the timely execution of BC Fusion and secure access to users' digital assets afterwards.

5. Specification

5.1 Asset Back to Wallet

Digital assets on the BNB Beacon Chain may not always be stored in a user's wallet in specific situations. For example, when users participate in staking, their BNB is actually transferred to the system account of the staking module until they redeem it. Modules that can cause similar asset transfers include:

  • Staking module.
  • Timelock module.
  • Atomic swap module.
  • Governance module.

The mentioned modules allow users to contribute funds to a shared pool, making it difficult to distinguish an individual user's share. Hence, we need a solution to ensure users can retrieve their funds into their wallets.

Before BC (Blockchain) comes to a halt, the following logic will be executed:

  1. Disable all transactions that would channel user funds into the liquidity pool.
  2. During the endblock phase, the following transactions are automatically triggered to return user funds to their wallets, like unstake, timer unlock, and atomic swap unlock.

Assets in a user's wallet can be in three states: Free, Frozen, and Locked. When calculating the asset balance, we consider the quantities in all three states. So, even if a token is Locked or Frozen when the Beacon Chain halts, it can still be recovered on the BSC chain.

5.2 Asset Recover

5.2.1 Asset Tree

Asset Tree The user's asset is abstracted as a node, which includes the _account address, symbol, and amount_. We'll exclude assets from non-EOA accounts, including module system accounts and clearly dead addresses. All these nodes are sorted in lexicographical order based on their keys, and then used to construct a Merkle tree. This Merkle tree will be published in the form of a file on GitHub and Greenfield, allowing anyone to verify the accuracy of their assets based on this file. Community members can challenge the accuracy and integrity of this document, and if any errors are found, the core team will make corrections until there are no objections.

The Merkle tree enables anyone to verify token ownership on the blockchain using a Merkle proof. It ensures that an account possesses a specific number of tokens represented by the symbol "symbol."

Note that only tokens that have been linked to BEP20 tokens on BSC will create a Node. Therefore, assets that have not been mirrored to BSC prior to the BC halting can not be restored.

5.2.2 Asset Recovery App

Asset Recovery App This system consists of two main components:
  1. Approval server. This is an off-chain API service operated by the BNB Chain Foundation. It enables users to retrieve assets by providing merkle proof and approval signature. Only with the approval signature can users recover assets from the BSC network.
  2. Asset Claim Contract. This contract is responsible for handling users' requests to claim assets. It verifies and records the requests to prevent duplicate claims.

The key process for users to claim assets in the BSC network is as follows:

  1. Users use the private key of the asset owner on BC to sign {account address, symbol, amount, receiver}, and request approval through the approval server.
  2. The approval server will fetch the node from a trust merkle tree, and
    a. verify the account, symbol, amount are correct.
    b. the signature is signed by the token owner.
    c. the token is not claimed yet.
    After that, the approval will generate the merkle proof for this request and sign for the request using its approval key.
  3. The user will send a transaction to the Asset Claim contract with merkle proof, node info, BC signature, signature from the approver, receiver account.
  4. The Asset Claim contract will do following checks
    a. The asset of this node is never claimed.
    b. The approval signature comes from the approver.
    c. The BC signature comes from the owner of the token.
    d. The merkle proof is able to prove the node is a leaf node of the tree.
    After all checks are passed, the Asset Claim contract will invoke the token hub contract to unlock the corresponding token to the receiver.

5.2.3 Security Enhancement

Considering the highly flexible implementation approach of BEP20 tokens on theBSC, there may be unforeseen scenarios that the BEP overlooks. During the initial phase of the BEP, the Approval Server only allows for the tokens in a whitelist that can be claimed.

For tokens that are not in the whitelist, users can submit requests on the forum. After the core developers review the security of the token, it can be added to the whitelist.

6. License

The content is licensed under CC0.

Copy link

@Goddessnunu22 Goddessnunu22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BEPs/assets/bep-299/asset_recovery_app.png

@Goddessnunu22
Copy link

#299 (review)

@shin792
Copy link

shin792 commented Sep 13, 2024

I can not swap bnb token from beaconchain to smart chain . Could you tell me the way ?

Copy link

@Nichebiche Nichebiche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.