Next, the relayer sends these parameters, transaction data, the transaction validation sign (prove), and block height to a special RPC request that calls the handlePackage function of the CrossChain contract: RPC request to handlePackage function Merkle proof The relayer extracts the following parameters from the packet: Parameter name The fourth attribute is the sequence in this example it is “19”.Īfter processing this event, the relayer processes the data packet with the transaction sended from blockchain A to blockchain B.The third attribute is the channel id in this example it is “8”.The second attribute is the CrossChainID of destination chain in this example it is “2”.The first attribute is the destination chain name in this example it is “bsc”.The value parameter has four attributes separated by “::”: Structure of the transaction validation request After registration, the relayer starts parsing the data in the endBlock event table of each network block and selecting from it all the IBCPackage events. To register as a relayer, it is necessary to deposit 100 BNB tokens and configure the device connected to the blockchain in accordance with the configuration file. Relayers in bridges process specially formatted data packets coming from blockchain A, extract the necessary parameters from them, and translate them to the network for transmission to blockchain B. This function also contains the onlyRelayer modifier, which means that only a relayer can call this function. handlePackage function declaration in BSC main smart contract The verification algorithm is called in the handlePackage function of the main CrossChain smart contract, which processes token transfers between blockchains. For each node of this tree, the height of its two branches differs by no more than 1. The BSC bridge uses a balanced AVL tree, a kind of a binary search tree, to validate transactions. Binary tree of hashes How BSC transaction validation works Any discrepancy will indicate that the data in the node has been tampered with. Knowing the hash of the data being checked and the values of intermediate nodes used when calculating the root hash, you can perform the Merkle proof: starting at the bottom of the node, check that each successive hash is correct, up to the root. This tree-like structure of data representation is called a binary search tree and allows you to easily check the legitimacy (authorship) and integrity of data recorded in any of the tree nodes. The end nodes of the tree corresponding to the transactions added to the blockchain are called leaves, and the top root nodes are called roots. Depending on the bridge logic, there are several ways to verify transactions, but they all depend on how data is recorded and stored in the blockchain, that is, the tree-like structure of data representation.Įach node of the binary tree is a concatenation of hashes from its two child nodes. To trust a transaction provided by blockchain A, the bridge needs to validate it. They act as intermediaries to send transactions, so whether you trust a transaction sent from blockchain A to blockchain B depends on the bridge between A and B. The technical aspectsīlockchain bridges are used to transfer data and assets between heterogeneous blockchains. Hackers withdrew 2 million BNB (Binance’s cryptocurrency) from the bridge protocol, with 1 BNB worth $293 at the time. BSC ensures the interaction between the Binance Beacon Chain blockchain used by Binance for decentralized management (stacking, voting) and Binance Smart Chain, an EVM-compatible blockchain used to create various decentralized applications. This was one of the largest cryptocurrency hacks ever. On October 6 th 2022, the BSC Token Hub bridge (hereinafter BSC), belonging to the largest cryptocurrency exchange, Binance, was hacked.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |