A Beginner's Guide to Understanding the aelf WhitePaper

A Beginner's Guide to Understanding the aelf WhitePaper

By aelf_blockchain | aelf Blockchain | 15 Aug 2020


In the last article, we introduced the Bingo game DApp demo, now let's look at the aelf project proper. We've already talked about the aelf real random number generator, which can generate unpredictable random numbers between 0 and 255, making it a useful tool. The interaction logic of this DApp's backend is very much the same as that of blockchain smart contract. But this DApp is so simple that it doesn't really show what aelf is capable of. In fact, aelf's got an awful lot more in its arsenal.. When it comes to supporting enterprise-level applications, this is where aelf comes in. For someone who is new to aelf, the best way to aquaint yourself with aelf's technology is to read the aelf technical whitepaper.


If you have read the whitepapers of some blockchain projects, you might find them difficult to understand or even make no sense. As a result, readers (not speculators) are often at a loss as to what these projects are trying to do. Unfortunately, many projects often assume their readers are all experts and can understand the whitepapers with no difficulty. In reality, most blockchain projects are much more complex than Bitcoin. Therefore, if readers only know how Bitcoin works, they still cannot understand these projects' whitepapers. If you want to draw potential developers to your platform, it is necessary to provide a beginner's guide to understanding your whitepaper.


That's why we have prepared this guide. But before reading this guide, you can quickly go through our website, read our slogan, watch the promo video on the homepage, download the whitepaper and before long, you may find something you cannot understand. Don't worry, let's start with aelf's slogan:


Aelf, a Decentralized Cloud Computing Blockchain Network


Cloud computing is the most fundamental feature driving the entire aelf blockchain ecosystem. Running data intensive computation on multiple computers is obviously more cost-effective than on one mainframe computer. Suppose these computers are assembled in a huge building called data center, say thousands of computers, with professional maintenance by a company, say, Amazon, then these data centers are called a cloud, such as Amazon Web Services (AWS).


Having said that, it is still hard for a beginner to understand why cloud computing gives aelf an indispensable edge. This is because most people, including some in the blockchain sector, don't have a sound knowledge of some of blockchain's key concepts. As a result, it is difficult for them to move on to the more complex technology, let alone analyze the pros and cons of a blockchain project and its potentials. As far as I know, I think it is necessary to set the record straight on two important blockchain concepts.


1.     What is a blockchain:

This is nonsense! We all know blockchain is a tamper-proof distributed ledger or database technology, as any professional would explain to you. You most probably have memorized this definition by heart and would rattle it off whenever someone asks you what blockchain is. The truth is, this definition is very misleading. Blockchain is not a new invention, nor does it have any magical features (for example: the magical tamper-proof feature). In this sense, it is different from the magical stuff in an alchemist’s furnace. Instead of viewing blockchain as a ledger or database, it is better to see it as a distributed system. So what is a distributed system?

A distributed system is a large number of interconnected computers, which makes it a peer-to-peer system. It was invented around 1960, long before the advent of Internet. There are already a lot of well-known distributed-system-based softwares, such as Bit-torrent and Netflix. In these softwares, people can upload the files on their computers to the P2P network and anyone can download them. But a distributed system can do much more. In the distributed system discipline, people have to solve a big problem, that is, everyone (every node) in the P2P network need to make an unanimous decision no matter what information they receive, and this unanimous decision is what we call a consensus, and this problem is called the Byzantine General Problem.


Say there are three Byzantine generals wanting to attack the same fortress, and they are at three different locations, they could only rely on couriers to send messages. In this situation, any general can only make a decision based on the other two generals’ messages. If one general wants to attack, he let couriers send the “attack” message to the other two generals, so do the other two generals. If the generals are all loyal, each of them should receive “attack, attack” coming from other two generals, and all three generals would attack the fortress. But if one of them is a traitor, he could send one general “attack” and send the other “retreat”, this other general will receive “attack, retreat”, if he follows majority rule, he will not make a decision because the votes on attack and retreat are the same. At the same time, the other general will attack, and the result is that these three generals will not reach a consensus on attack.


The generals are just like the nodes of a distributed system (i.e. blockchain). There are at least two points worth noting: first, all massages (transactions), have to be sent to the other generals (nodes) to keep them informed; second, all the nodes have to reach a consensus.


The first point means that it takes time for sending a message to all the nodes in a huge network, the second means that after a new block has been broadcast to the entire network, there should be a mechanism for all the nodes to agree on this block (a package of messages or logs), and it also takes time.


2.     What is a smart contract?

The definition of smart contract in many books, articles and videos is very misleading from a developer’s point of view. They often explain that smart contract is a new generation of legal contract, deed, or proof of ownership, etc., and since they is code-based, smart contracts are highly intelligent. But this definition is only for those working in finance or other sectors who do not know computer science and coding. They need only to know that smart contract is very powerful, and that’s enough (in some sense, this is all very well). But what is smart contract exactly? 


In fact, smart contract is neither smart nor is it a contract, it is just a string of code. So why do people call it smart contract rather than a more intuitive name? That’s because it has been called smart contract all along, and programmers are too lazy to change the name. Smart contracts, like Python or Java codes, are written in a high-level language, and compiled into bytecode to be run as opcode on a virtual machine. You might already know things like JVM and Python-VM, or EVM on the Ethereum blockchain. For the aelf project, smart contracts are written in C#, and they are run on the .NET framework after being compiled.


Calling the execution of a smart contract is in some sense similar to making an http request: In a traditional requesting process, you type in a URL to tell the remote server to send you back some data (html, css, javascripts, etc.), or tell the server to execute some server-side programs which could be written in Java to change some states of the server. The same is true for smart contracts. Just like a request, we send a transaction to the target contract address, whether it costs cryptocurrency or not. When the contract receives the calling request from the transaction, it will execute some specific functions in the smart contract code, depending on the parameters in your transaction. If there is enough gas, the executing result will change this smart contract’s state, send you the data of the result, or send you cryptocurrency.




However, in comparison to the instant response from a remote server after an http request, the execution of a smart contract will take some time after you send a transaction. As I have mentioned in the Bingo game article, when you send a transaction, the transaction will be broadcast to as many nodes as possible, and every mining node will include it into its candidate block. After a while, when one mining node produces a new block, it will broadcast this block to other nodes, of course, this block is confirmed. This process will take some time, and for most real applications only producing one new block cannot guarantee the safety and validity of the transaction, so more blocks should be concatenated consecutively after this block. On the aelf blockchain, at least 8 new blocks should be generated after the production of the block containing the transaction. Of course, if one block containing this transaction is finally packaged by a mining node, when satisfying a certain consensus condition, the target smart contract is then executed on a full node (full node can be a mining node, or vice versa). But with more and more blocks being generated after this block, it will be virtually impossible to tamper with the execution result of this smart contract by forking to another chain.


In the Bingo game example, the “bet” button is such a method in our smart contract. When we place a bet, a transaction is sent to the contract. After one block is packaged, the method is executed and thus the contract will know how much you want to bet. In order to let the contract know your bet amount and to avoid anyone tampering with your bet amount, you have to wait until 8 subsequent new blocks are produced. So how long does it take? As is shown in the last article or in the demo video, it takes about 30 seconds. In fact, no one knows exactly how long does it take to generate 8 blocks, but we know that after 30s more than 8 blocks must have been already produced.


Having explained these two basic concepts, it is much easier to understand any blockchain projects, including aelf. No matter how sophisticated the technologies a blockchain project applies, they will all be based on these two concepts.


In the next article, we will dive into the aelf blockchain whitepaper to demystify all the important features of this enterprise-level project! To be continued.


Decentralized Cloud Computing Blockchain Network

aelf Blockchain
aelf Blockchain

aelf's official blog on Publish0x - Follow for announcements, partnerships, project updates and more!

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.