This website uses cookies to ensure you get the best experience
OK
#Bridge
#FoilNetwork

FOIL BRIDGE

January 25, 2022

Hello Friends!

Today I would like to talk about how bridges between blockchains work, how swaps happen and why absolutely all available solutions are not decentralized.


Let's go!
The idea of bridges between blockchains is not new. Back at the beginning of the golden age of cryptocurrencies, numerous fast currency exchange services grew like mushrooms after the rain. This process was called swap, and it was quite convenient for both users and creators. The idea was very simple - to take popular cryptocurrency pair, add price tracking via API, set your commission, and automatically exchange coins from one chain to coins from another one. Since the transfers were automated, the owner only had to track the availability of funds in their wallets, and to advertise their service. The user was also deprived of the headache of creating accounts at centralized crypto exchanges, with the subsequent exchange of some coins for others, with the mandatory withdrawal fee. Convenient!

With the advent of smart contracts, the situation didn't change much. Exchanges were still separate servers, with cryptocurrency wallets and scripts installed on them, tracking transfers and forming transactions.

The introduction of smart contracts simply simplified the automation scheme. Now, incoming and outgoing transactions were tracked by special contracts. This was loudly called "bridging" and was presented as a real, honest and decentralized system of transferring tokens from one blockchain to another.


But is it true?
Let's understand it in more detail. The most important thing to know is that smart contracts only work in the blockchain where they were created. They don't have the ability to influence another network, and that's perfectly understandable and logical. If it were possible to write a contract in the Ether network that would directly affect accounts in the BSC network, you could forget about any security of funds.

Everything is organized in a much simpler way. To make it clearer, let's try to create our own TEST token in the Ether network and set up a simple bridge to the BSC network.

For example, there are a total of 10,000 TEST tokens originally created in the ETH network. To make the bridge work fully, we create the same number of tokens in the BSC network. Their internal names will be eTEST (ETH) and bTEST (BSC).


Then we create smart bridge pins in each circuit. It is important for us that when eTEST tokens arrive at the contract address, they are blocked (cannot be output in the usual way) and unblocked. That's why we write SWAP IN (blocking funds on arrival) and SWAP OUT (unblocking and sending to the specified address) modules.

For example, initially we have all funds on hand in the ETH network. In that case, in the BSC network, we transfer all tokens to the bridge smart contract account.

As a result, we have 10000 eTEST tokens in hand in the ETH network and 10000 bTEST in the BSC network in the bridge account.



So what happens when a user wants to transfer his funds from one network to another?
First, he forms a transaction to the bridge account with the receiving address. This is very rarely done manually, usually a web service is used that generates the transaction for the user (to eliminate the possibility of error). For example, the user wants to exchange 1000 eTEST, then the transaction will contain these 1000 eTEST and message like "Destination - <BSC_address>".

The funds get to the bridge address, the SWAP IN module is triggered, which blocks them and generates a command...
You probably thought that for the BSC wallet, but no. Not quite so. As we recall, contracts in different blockchains can't communicate with each other, so the command is generated for an external program, which already translates it to the BSC wallet.

On the BSC wallet, the SWAP OUT module is triggered and the 1000 bTEST are unlocked and sent to the address the user specified. Or rather the script. Which received this data from the user's transaction on the ETH network. In effect, we are getting a Black Box. An independent auditor knows what's going on in each blockchain's contracts, but has no idea what's going on with the data between them.

Not that this is a huge problem, attentive users can always estimate the volume of funds sent and received on each network, but the very possibility... Something had to be done about it. And the system began to become more complicated for the sake of obfuscating users' brains to improve security.

Special nodes were added, with established wallets of both networks, the so-called Oracles. Now the transfer was performed only if all these nodes reached a consensus.

Also, it was a good tone to open the communication module code between the blockchains.

But did something really change, or is it all just a smokescreen?

Alas, nothing has changed. Oracles are fully controlled by the creators of the "bridge", the program code of the layer can be changed at any time and the only positive side of all the complication - now it has become harder for malicious outsiders to get access to the funds.
This is not an obstacle for scam-exit anyway.
As you have already guessed, the next step is a solution from FOIL NETWORK. Fasten your seat belts, we're taking off!


One of the main features of FOIL NETWORK is the presence of "protocol smart contracts".
In fact, they are the global rules by which the network operates and, most importantly, require a consensus of users to implement them into the code. At least 51% of FOIL tokens and their holders, must vote to implement such a contract and only then will it be accepted.

That said, the capabilities of protocol contracts are far greater than conventional ones. In fact, they allow you to embed the cross-network code directly into your wallet. You don't need additional scripts, they are already built and tested. No need for Oracles, all FOIL nodes advocate for them...

The only limitation when building seamless bridges (Pure Bridge) now is that the bridge must be built between chains that support protocol smart contracts.

That is, at the moment, between Foil Network and sidechains. Or, to go even deeper - between all blockchains using Erachain technology.

Direct interaction between chains and on-the-fly token swaps sounds very cool. In fact, the user will just have to enter the desired address directly in the wallet and (optionally) select the network. The protocol smart contract will work from there.

Yes, in order to implement seamless bridges you need a huge level of user involvement, because for bridges to work both ways, the contracts of different networks need to be programmed to "trust" each other. And that, as we recall, can only be achieved by consensus of FOIL holders.
But it seems to me that this is for the best. After all, in this case, only projects that are trusted will stay afloat. And this is as close as possible to the most cherished decentralized economy and "blockchain for everyone".
#dex
#defi
#nft
#nftstorage
#nftmarketplace
#foil
#foilnetwork
#crypto
#cryptocurrency
#doge
#dogecoin
Foil Network
Relevant news
Subscribe!
And follow the news

FOIL

Resources
Connect with us
Download App
Privacy policy
© 2021 FOILnetwork™. All rights reserved.
Сontact us to become a partner
By clicking on the button you accept the privacy policy
Join the FOIL Network community

FOIL is building an inclusive ecosystem that empowers and rewards the community for their contributions. Join us!
HDE