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

Blockchain basics using FOIL as an example: Part 1. Consensus

January 28, 2021

Hi friends!!!

Due to the fact that we were often asked how blockchain works in general, what the beasts of "forging" and "stacking" are, I decided to explain it all as clearly as possible. Examples will be as simple and straightforward as possible. Let's go!
First of all, let's define blockchain itself.
Blockchain is a distributed, decentralized database. To simplify understanding, let's represent this database in the form of an Excel table.
Excel-like image of a blockchain
The main difference from an Excel table is precisely in the distribution and decentralization. In fact, you can think of a blockchain as a kind of table, the same on all devices where it exists. This table records how much money is in each user's account, how much was sent, and where.

In very simplistic terms, you can think of it as a list that records how much money you received, how much you spent on groceries, and so on.

"So what's stopping me from drawing 100500 million for myself on this table?" - you ask.

That's the thing about blockchain. The network is distributed, so the record of "100500 million" must appear at once on all nodes. The network is decentralized, so there is no central manager who will confirm this record.

How then does it work?
Very simple. The network follows the rules set at its creation. That is, the correct record in the table cannot contain a transaction that exceeds the balance of the account, or change the balance of the account without a valid transaction. This would be contrary to the conditions of functioning and the network simply "will not accept" such a change.
Who checks if these conditions are met?
Users. More precisely, their wallets, working as full nodes (nodes) of the blockchain.

Depending on the block time (block build time), all transactions during that time and any additional information that can be added are put into the block, and then the block has to verify (validate) one of the wallets. The way in which this wallet is selected is called the consensus mechanism.

In the Bitcoin network, the validator wallet is selected through the POW (Proof Of Work) mechanism. This means that the wallet must first show proof of work done (in this case, calculations) to confirm the block.
More details are written on wiki and Habr, I will quote a bit.
In the case of proof-of-work, the hash of a message combined with a special field (nonce) must be less than a certain value (or start with a certain number of zero bits). The nonce makes no sense for the message itself - this field is brushed over by the author of the proof until a suitable value is found. The name "proof work" reflects the fact that in order to find the nonce one has to do computational work, the expected amount of which is measurable. For example, if you want the first 16 bits of a hash to be zero, you have to go through an average of 65536 nonce values.

Nothing is clear, but very interesting. To put it in a nutshell, the wallet needs to provide a calculation solution that meets the given conditions. In BTC network alone such calculations can't be done anymore because of prohibitive complexity, but there are always more than enough people willing.

That's because each blockchain rewards validators depending on its own conditions. In the BTC network, for example, a validator receives a fixed reward in BTC for a created block.

This is the simplest way, but also the most vulnerable. Suppose you have 51% or more of the processing power of the entire network. That means you can validate entire chains of blocks, including those with data you've changed. Enter a transaction that the user has never done? You're welcome. Well, the very idea that thousands of devices wasting megawatts of energy are working just to be able to select a validator wallet...
Doesn't sound too eco-friendly.
Therefore, FOIL does not use this mechanism.
The first consensus mechanism used in FOIL is POS (Proof of Stake). In contrast to the mechanism of POW, users in this case do not need to perform complex calculations. It is enough to have on balance a certain amount of internal currency. Wallet-validator selection in this case occurs in several stages.

First, selected wallets that meet the minimum requirements (in the FOIL network it is the availability of 50,000 FOIL tokens on the account). Then we sort wallets by the amount of internal currency in accounts. Then, according to a certain algorithm, we choose the winning wallet, with wallets with more internal currency have a higher chance of becoming it.

The wallet validates the block, it is added to the blockchain, everyone is happy. Actually, the use of funds in an account to validate blocks is called stacking. Also, this word is often used in isolation from the process of creating new blocks, for example in gaming applications. The user in this case is not blocking his means to create blocks, but simply to get any rewards.

"But after all, 50,000 FOIL for staking is quite a lot!" — you'll say.

Yes. And to increase decentralization of the network, and to give everyone the opportunity to participate in the process, the LPOS (Leased Proof of Stake) mechanism was invented.

It works quite simply. The FOIL network has transactions of the Lease type. The recipient can't spend the funds transferred, in fact he can only keep them on his balance and the sender can return them at any time.

But... These funds are taken into account by the algorithm when calculating the wallet-validator.
That is, a user can have about 1,000 FOIL tokens of his own and 49,000 loaned to him and still be able to validate the blocks. This process is called forging. The difference from forging is that it is a team process, not a single one, and has several peculiarities.

First, the reward for validation in this case will be shared between all participants in the process.

Second, the owner of the foraging wallet (hereinafter referred to as the forging pool) can assign an additional fee.

Why this is needed? Very simply. Forging pools, where their owners have a sufficiently large proportion of their own funds will bring depositors much less income, and vice versa, pools in which all funds - from investors, the most profitable. But the owner of the pool is forced to keep the full node on 24/7. Hence, it is possible to set a small commission, thereby offsetting your own costs of operating a full node.
Ugh. For today, we have discussed the basic consensus mechanisms in the FOIL Network and, perhaps, started to understand a little better how it all works.
#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