In this post we want to take you on a deep dive into the technology behind the Elrond network.
Background, History and Numbers
The Elrond project is one of the youngsters in the world of blockchain projects, yet it has been growing with a tremendous speed in the last year. Since the mainnet went live on July 30th 2020, Elrond has registered over 1 million addresses and more than 15 million transactions on the blockchain (as of November 2021) . A special boost to the number of addresses was given by the release of the Maiar App which offers a simple and intuitive way to interact with the blockchain.
Now one of the fascinating parts of this project is how much effort has been put into the development of a mobile wallet (aforementioned Maiar App). It does not only allow for an easy wallet setup and is highly secured, but it gives access to EGLD and other assets to not-that-technically-adept users. And if you have been around for some time, you know what we are talking about.
Wallets have become easier to use, but overall the complicated usage, along with the fact that for most assets you need different wallets, makes it hard for beginners to become part of the space.
Blockchain Technology
At the heart of the Elrond project lies a blockchain which tries to solve the classic blockchain trilemma:
The interesting solution the Elrond team came up with includes a Secure Proof of Stake consensus mechanism built on top of a chain which uses sharding with redundant states.
With regards to the blockchain, a chronology has been implemented in which blocks are added in epochs of 24 hours and rounds of ~5s. In each round one new block can be proposed per shard.
First Things First: Sharding
Buzzword alarm: Sharding. The term sharding is generally used to describe a decomposition of a database into multiple smaller units. Those units are then able to handle requests on their own. Sounds like black magic in the case of a blockchain? Here is how it works on Elrond.
The whole address space is divided into multiple parts, the shards. Which shard your address is being assigned to depends solely on the last bit of the address. Say there are 2 shards in the network and your address ends with a 0, you are then part of shard 0.
Assuming your address would end with a 1, you’d be part of shard 1. As the counting starts at 0, there exist only shard 0 and shard 1 in this case.
Since this process is deterministic you can fetch a random address from a block explorer and be able to tell which shard it belongs to, given you know how many shards there are. This gives a tree that looks somewhat like the following:
What Are States?
The state boxes in the illustration explain the redundant states mentioned above. Each shard stores the state of its neighbor shard in order to add more security to the network in case a shard fails. The state generally stores information about the accounts and their balances on the blockchain.
How do you compute the number of shards?
The number of shards is computed using the number of nodes in the next epoch and the number of shards in the current epoch. If there are more nodes per shard than a certain threshold, a new shard will be added.
Cross-Shard Execution
At this point you might ask yourself: if I’m on shard 1 and want to send some EGLD to an address on shard 2, how does that work?
In a nutshell, there exists an extra shard, the metachain, which records transactions between shards. The two shards in question synchronize with the metachain to know transactions that include accounts in their address range. The metachain uses so-called miniblocks to do that. Here is a sketch of what it looks like for the scenario from above.
It works basically the same way for smart contract calls across shards (i.e. the smart contract you want to call is on a different shard).
Secure Proof of Stake
Elrond uses a consensus mechanism called Secure Proof of Stake. This type of mechanism selects the next node that will be able to propose a block using a combination of stake, randomness and age. The secure part in this case comes from the selection process which is random (which makes it impossible to predict the next selection) but also includes a rating. Ratings can be increased for being an honest block proposer or decreased for dishonest acts.
To make it even more secure, the signing of the blocks is based on modified practical Byzantine Fault Tolerance. That's a mouthful but in a nutshell it says that two third of the signers must be honest to prevent an attack.
Fisherman Challenge
One more security feature that is part of Elrond: Fisherman challenges. Nodes can raise challenges if they detect an invalid block. To avoid having challenges against all blocks all the time, raising an invalid challenge costs the entire stake of the node. If you however raise a valid challenge, you will be rewarded with a part of the amount that will be slashed from the validator node that proposed the block.
Smart Contracts
Last but not least: Elrond has Smart Contracts. And they are set up in a clever way. Because the Virtual Machine (VM) infrastructure (which is responsible for the Smart Contract executions) is based on the K Framework, interpreters in any language defined in K are an option.
Long story short, the Elrond VM hides the underlying structure and is happy with any Smart Contract written for the Ethereum Virtual Machine and even Web Assembly (WASM) contracts. That in turn enables Smart Contracts written in programming languages such as C/C++, Rust and C#. In case you are not a programmer: this opens the smart contract development on this blockchain to a large number of developers!
Outlook
The Elrond team made huge progress in the last year and just launched its own Decentralized Exchange, the Maiar DEX.
It remains an exciting project with a lot of possibilities. And as such, it is the perfect Layer 1 Blockchain for us to build upon, with low transaction fees and fast interaction times.
You can check if you are not dealing with a scam
Check now