If you’re eager to learn what the blockchain is and find out what its underlying principles are or how the technology can evolve, this guide is just for you! Moreover, you will be able to get a hands-on experience building your own decentralized blockchain-based application (DApp). All you would need to do is follow the step-by-step instructions for beginners that we’ve prepared for you.
What is the Blockchain?
The blockchain is a decentralized and continuously expanding list of records, or blocks, each of which is encrypted. Each block contains information on some or all recent transactions, a transaction counter, and information on the blocksize, blockheader, and the “magic number” – a cryptographic hash of a previous block (an answer to a mathematical puzzle solved by the computer when adding new block. It is unique to every block).
Due to the fact that each block has a cryptographic hash of the previous block, a timestamp and transaction data, the information on the blockchain is easily verifiable and impossible to delete. When data is recorded on a block, it cannot be edited retroactively without modifying the data in all subsequent blocks, which is nearly impossible as the blockchain is decentralized and typically managed by a peer-to-peer network that adheres to a protocol for validating new blocks.
[bctt tweet=”The information on the blockchain is easily verifiable and impossible to delete”]
To put it simply, the blockchain is very similar to Google Docs. Every person who has access to a shared document can modify it, and everyone sees the changes immediately. However, there are two main features of the blockchain that make it a little different from Google Docs:
- On the blockchain, one can not delete or edit information retroactively – so, you can add new information, but you cannot delete or change anything that’s already been added to the system.
- The blockchain is decentralized and there is no single authority in control of it – it is owned by everyone in the system, while Google Docs is stored on Google’s servers and, in principle, Google is the central authority that manages all of those documents.
To give you a better understanding of the blockchain, we will explain what the main components of the blockchain are, what types of blockchains exist, and how this system came about in the first place.
Key Components of the Blockchain
All blockchain systems are comprised of the following components:
Every blockchain ecosystem has its own node application, the installation of which is required for a user to get access to the blockchain. An example of a node application is Bitcoin Wallet.
Keep in mind that there are two different types of node applications – light nodes and full nodes. Light nodes are necessary for those who want to simply access the blockchain and make transactions within the system, while full nodes are required for mining. The main difference between the two is that full nodes download the full blockchain, while lightweight nodes download only the block headers needed to validate the authenticity of transactions. The majority of the nodes on a blockchain are light nodes. Full nodes take up more storage space and consume a lot more Internet traffic. However, at the same time they guarantee more privacy and security for a user as opposed to light nodes.
It is a data structure that is managed inside a node application. When a user has a node application installed, they can view the ledger’s contents; all the blocks and transactions on that blockchain.
There exists only one shared ledger for each blockchain ecosystem, irrespective of the exact node application that you are using to access that ledger. For instance, there are various clients (node applications) that allow access to Ethereum, and you can run different ones at the same time, but the Ethereum ledger that you access will be the same for each application.
This component provides the general “rules” for a blockchain ecosystem and is implemented as a part of a node application. A consensus algorithm determines the ways for a blockchain system to get the single view of a shared ledger for all nodes. Blockchain ecosystems use different methods for a consensus algorithm depending on their needs and goals. While for Bitcoin it takes a few minutes to arrive at a consensus of the ledger (while the full nodes validate the ledger), Ripple guarantees consensus in just a few seconds.
The major ways of validating the ledger are proof-of-elapsed time, proof-of-work and proof-of-stake. Each of these schemes uses a different method to verify nodes before allowing them to participate in the consensus-building process. Depending on consensus-building algorithms, the time for consensus building and transactions fees may vary.
Types of Blockchain Systems
There are two major types of blockchain ecosystems – public ones and private ones.
In public blockchains, anyone who installs a relevant blockchain node application can access the system and make transactions in it. Well-known examples of public blockchains are Bitcoin and Ethereum.
In private blockchains, a user’s participation on the network should be validated either by the network starter or by the set of rules they put in place. For instance, a network starter might allow all participants on the network to validate new users. So, only “verified” or “invited” users can access the system. Private blockchains are usually run by businesses for their own commercial operations. Arguably the most popular platform for building private blockchains is Hyperledger Fabric. Examples of private blockchain solutions based on Hyperledger Fabric are demonstrated on IBM’s website.
[bctt tweet=”Public blockchains are more suitable if you want to create a cryptocurrency or a blockchain-based application”]
Public blockchains are more suitable for use by general audiences – for example, if you want to create a cryptocurrency or a blockchain-based application for public use, – while private blockchains are implemented for the internal use within a company.
Evolution of the Blockchain
Satoshi Nakamoto first introduced Bitcoin in 2008. Of course, Nakamoto was not the first person (or group of people) to think of digital cash or a decentralized system that would allow direct transactions between people. Bitcoin is pretty much built on top of the previous achievements in the sphere of cryptography. A cryptographically secured chain of blocks that bears similarity to some underlying aspects of the blockchain was described in 1991 by Stuart Haber and W. Scott Stornetta. In 1997 the Hashcash proof-of-work function that currently serves as a core in the Bitcoin mining system was introduced. Wei Dai, back in 1998, created a proposal for an “anonymous, distributed electronic cash system” called B-Money, which was based on the proof-of-work function for the “creation” of money. B-Money was cited in Satoshi Nakamoto’s essays about Bitcoin. However, Nakamoto was the first one to put these previous achievements together and bring about the distributed peer-to-peer system (now known as the blockchain) to life, thereby enabling digital currency transactions.
Since 2008, blockchain ecosystems have undergone a number of significant changes. These systems can be divided into several “generations” of blockchain technology. Each new generation tried to address different problems and added new functionality to blockchain technology, and according to these issues, projects were divided into fours generations. We will cover each of them in greater detail to give you a sense of how these generations are different from each other and what kinds of new functions every “generation” brought to the table.
These systems were the first to implement peer-to-peer distributed networks that would allow transactions with “electronic cash” directly between two parties without going through third-party financial institutions, as Satoshi Nakamoto put it in Bitcoin’s whitepaper. The first-generation of blockchains serve as perfect open-source payment systems that do not require a centralized third party to be involved.
These systems added the implementation of smart contracts for customizable transactions on the blockchain. They also expanded the idea of recording transactions on the blockchain in order to incorporate programming languages. Ethereum has provided users with an opportunity to create “smart contracts” that set the regulatory rules about customizable transactions within the blockchain ecosystem using just a few lines of code in Solidity, a programming language designed specifically for Ethereum’s smart contracts.
The major issue addressed by the third generation of blockchains is scalability. As Bitcoin and other systems have expanded and experienced a huge influx of transactions, they were faced with the problem of efficiency when reaching a consensus on the system.
To solve the issue with scaling, the third-generation blockchains introduced the delegated proof-of-stake method for the consensus-building process, which is more efficient and lightweight than the traditional proof-of-stake or proof-of-value methods. Simply put, it works like this: all nodes on the system are given equal voting rights, which they then exercise to “elect” a small number of “witnesses.” These witnesses are those who mine blocks and monitor the network. Mining opportunities are the incentive for them to participate in monitoring and consensus-building. Consensus-building processes among a small number of witnesses is faster and more efficient than going between all the nodes on the network, thus solving the problem of scalability.
These projects also address the issue with scalability, but in a different way than those of the prior generation.
EOS tries to solve the problem of scalability by building an “operating system-like” network that would allow horizontal and vertical scalability with a delegated proof-of-stake. IOTA addresses the issue by introducing a blockchain system completely different from those that already exist – it is built on a Tangle, a blockless, scalable, and lightweight distributed ledger which makes the network self-regulated as consensus on the system is not decoupled, but is an intrinsic part of the Tangle itself.
Take note that there still is no consensus about the 4th generation of the blockchain – some people claim it’s already come about, while others say that projects like EOS and IOTA are not the new generation of blockchain technology as they basically address the same problems as the 3rd generation – scalability.
Another project you should keep in mind is Lightning Network. It was launched in beta on March 19, 2018. Lightning Network is introducing off-chain transactions. Basically, all current blockchain-based projects use on-chain transactions: any transaction between the users are written to the “chain” – the public ledger of the blockchain network. Writing transactions to the ledger takes time and requires the owners of full nodes to validate every transaction; this is why transactions are processed for a relatively long time (up to 10 minutes on Bitcoin’s network) and why transaction fees are high.
The Lightning Network is a “second layer” that is going to operate on top of the blockchain (most commonly Bitcoin) based on off-chain transactions. It is going to work like this: two users who are willing to make transactions between themselves will interact with each other directly through special protected payment channels (these were envisioned by Satoshi Nakamoto in the early days of Bitcoin’s development). The two users will put some cryptocurrency to a multisignature address and then alter the amount each party is able to redeem from this address. Each party can close this payment channel any time they want, and the last-signed transaction with the most up-to-date balances for both users will be written to the public ledger. This technology will allow users to make payments almost instantly, reduce transaction fees, and increase user privacy as not all of the minor transactions will be written to the public ledger, only the last one with the final balance. Although the Lightning Network is still in beta, this project is very promising with a potential to “kill” the altcoin’s main advantage of offering cheaper and faster transactions than that of Bitcoin, and you should definitely keep an eye on it.
Introduction to Blockchain Development
Now that we have an overview of what the blockchain is, let’s get a closer look at development on the blockchain. One of the most popular applications of blockchain technology is Dapps (decentralized applications). Basically, those are applications that work on the blockchain. Sounds cool, right?
Then maybe you have been wondering why there are still so few DApps available given the massive interest in this technology. Well, the answer is simple: not all components necessary for the successful development of sophisticated DApps are ready yet.
Major problems for DApp development
DApp development requires instruments similar to those necessary for web application development: computation, file storage, external data, monetization, and payments. At the end of 2017, around 70% of the stack was ready – monetization and payment tools were fully developed and operational, but computation, file storage, and external data components are still in development.
However, the problems related to stack development are significant only in terms of DApps that are used by many people, and thus require good scalability. So these problems do not stop one from creating a DApp, it’s just that it is very difficult to scale it. Moreover, since the industry is developing very fast, the stack might be fully completed as early as this year, and then we are likely to see an explosion in the number of DApps. If you want to join the future DApp boom, you might want to start developing simple DApps now. And we’ll be happy to help you with it.
[bctt tweet=”If you want to join the future DApp boom, you might want to start developing simple DApps now”]
As you will see below, the creation of a simple DApp is possible and not at all that difficult. We will guide you through this process so that you can get a hands-on experience with the blockchain. The guide is a step-by-step instruction, and you will be able to understand each step even if you don’t have any prior experience with programming. However, if you have experience with Solidity already, or tried programming some smart contracts, that would certainly be tremendously helpful.
Instruments for DApp development on the blockchain
First of all, let’s look at the main instruments you will need for DApp development:
- Geth. It’s a command line interface for running a full Ethereum node. Simply put, it’s an application that is necessary to connect to the Ethereum blockchain. Ethereum provides instructions on its installation for all operating systems here. You will need it as the Ethereum blockchain is the major platform for developing DApps.
- Solidity. It’s a programming language used for writing smart contracts in Ethereum. You can find the installation instructions on its website. You will also need to install a Solidity compiler to run code in this language.
- Truffle. It’s a development environment for DApps. You will need to create, run, and test all decentralized applications. See how to install it here.
- Ganache. This is an in-memory blockchain, or a blockchain simulator. You can use this to test your DApps without connecting to the actual Ethereum blockchain. Ganache can be downloaded here.
How to develop a DApp
Now let’s get through the major steps you will have to take in order to develop a DApp. We will not be getting into too many details about coding, our aim here is to give you an overview of what DApp development will look like. But if you want to actually follow all the steps with coding, you can do it by using the examples in the links for each step.
- Install Geth. As noted above, you will need it to connect to Ethereum’s blockchain.
- Start the Ethereum node, connect to other peer nodes, and start downloading the blockchain. This can be done via command line when you have Geth installed. Then you will have to wait for about 10-15 minutes while the blockchain is downloading, the exact time depends on your Internet connection. In the output in the console, you will see the block numbers. When the download is finished, the block number in the output should be close to the one on this page.
- Now install the Truffle framework if you have not done that yet.
- Then create a Truffle project. Truffle will create the files and directories necessary to run a full stack DApp. It will also create a sample application with which you can use to play around.
- The next step is creating a smart contract code in Solidity. You can find an example on how to create a simple “voting” smart contract here.
- You will need to add the code in Solidity to the Truffle project. If you are stuck with that, you can find an extensive explanation of the details here.
- Move on to deploying your smart contract. For that you will need a test account and some Ether. You can mine some Ether or get it from this reddit thread. See more details on setting up the account and getting Ether here.
- When you have an account and Ether, you are ready to deploy your contract and run it on the blockchain. A tutorial on the deployment of a contract on a testnet is here. The process will take a couple of minutes, the exact time depends on how sophisticated your contract is and the capacity of your machine.
- Try to interact with your contract via Truffle. If everything is working correctly (meaning the program does not give you any errors), then your contract is fully functional and you can proceed to the next step.
- Start the server. If everything is correct, you will see a webpage reflecting what you have programmed in your contract (if you implemented the code from the example above, you will see a simple “voting” application). That’s it. Now you should have your DApp running and, as it’s deployed on the public blockchain, you could even trace the transactions by entering your account address here.
If you have followed all the steps in the tutorial, by now you should have created a DApp running locally that is tied up to a contract on Ethereum’s testnet.
Hopefully, this tutorial gave you a taste of what application development on the blockchain looks like. You can find other resources where you can get more details about this in the next section.
If you want to dive deeper into blockchain development, we’ve got you covered with this list of useful resources:
- Check out the top 10 courses for blockchain developers that are recommended by the experts.
- Browse through our list of the best 100 blockchain courses.
- Educate yourself through the challenge of asking and answering questions on the blockchain.
- Get practical advice from the experts on how to start a career as a blockchain developer.
- Go through a guide on starting an Ethereum development career.
- Read books about the blockchain recommended by the Humaniq’s CTO.
- Participate in hackathons to kick start your career like this guy.
- Read relevant threads on Reddit.
- Go through Blockgeeks’ guide on getting started with the coding for Ethereum development.
- Browse through relevant information on Medium, such as this guide.
- Follow DApp development tutorials for beginners.
- 2018 blockchain trends here
We hope that our introductory guide was useful to you and will help you to start a career in blockchain development. Visit our website for more guides and advice on building a career in the blockchain industry.