The Complete Ethereum and Other Blockchain Tutorials for Newbies
Blockchain is a technology that provides outstanding opportunities for building p2p services with zero tolerance for fraud and faults. The best thing about the majority of blockchain projects is the fact that they usually allow one to perform operations without the interference of authority . Because of the number of new projects developed, we have written this tutorial for developers.
Blockchain in Plain Words for Developers
In general, blockchain is a sequence of blocks containing some sort of data. The word “blockchain” was first used to describe the Bitcoin cryptocurrency. Usually, when we say blockchain, we understand it as an open, distributed ledger.
How Does It Work?
Here is a chart showing how blockchain works:
As you can see, the squares (blocks) contain a set of data (data A, data B, etc.). Data in this picture can be anything – a transaction or a smart contract.
For example, if data is a transaction (Bitcoin example), then it contains a record of the receiver, the sender, and the amount of the transaction.
Afterwards, records are combined in blocks according to the principles common to the specified blockchain. A block cannot be changed after being created; it becomes the last in the chain.
Below, you will find a description of the most common technology used for blockchain: DLT (Distributed Ledger Technology).
Distributed Ledger Technology
Imagine that everybody has a notebook in which anyone can see what is written by others. If you write “Hello, world!” in your notebook, other owners of similar notebooks will see this record.
This is what is provided by distributed ledger technology. Everyone gets information about what is happening within the network.
As you can see from the picture above, all users of the network (like for Bitcoin or Ethereum) will receive updated information on new blocks. This means that all operations within the network can be tracked. And this is where we come to nodes – the storage of the ledger.
A node is a replica containing all the information about the operations performed within the network. For example, if there are 100 blocks in the blockchain and there are 300 nodes, each node will contain records of all 100 blocks.
You may ask, why do we need more than one node? Well, this is why blockchain technology is so popular. As there are many nodes, and each contains information about all transactions within the network, there is no real opportunity for fraud, system failure, or hacks. This is the reason why all operations within blockchain can be performed without the participation of a third party.
For some blockchains (Bitcoin, for instance), there exists a special category of nodes called miners.
The term “miners” appeared when Bitcoin arrived on the scene. Basically, miners are nodes that not only store all information about all transactions within the network, but also record the transactions and form them into blocks by performing calculations.
In blockchain technology, data is collected in blocks, and blocks are connected to each other, forming a chain. This describes why the technology is called blockchain.
The size of a block and the type of data it can contain fully depends upon the type of blockchain. For Bitcoin, it is transactions, and for Ethereum, it is smart contracts.
Usually, any user, even if he or she is not a member of the network, can see the blocks, check their contents, and track orders. Sometimes, however, they cannot. It all depends on the permission type featured for blockchain.
Permission types define whether a blockchain is public or private. In public blockchains, anyone can see all the operations within the network, and in private blockchains, only specified or approved users can get full access to operations within the network.
The consensus type implemented in blockchain defines the principles of its performance. The creation of proof of work consensus (the first realized for blockchain in Bitcoin) has shown that a decentralized network in which operations can be performed without a third-party intermediary can be created.
Here are the main types of consensus algorithms that exist for blockchain for now:
- Proof of work (PoW)
- Proof of stake (PoS)
- Byzantine Fault Tolerance (BFT)
- Federated Byzantine Agreement (FBA)
- Proof of Authority (PoA)
Proof of Work
In this type of consensus, miners solve mathematical tasks to record operations within the network and build blocks. Afterwards, the first solution that has been found and fits the parameters is verified by the other nodes. The miner who finds the solution gets a reward.
This was the first type of consensus algorithm for blockchain, and it was used in Bitcoin and its forks. This type of consensus demands an increase in computational power when the network grows.
Proof of Stake
Proof of Stake is a type of consensus algorithm that considers a choice of node that forms the next block on the basis of a prescribed algorithm.
For example, in Peercoin, there is an algorithm that allows the holders of the “oldest” coins to have more chances to form the next block and therefore receive a reward. However, the age of the coins is then decreased to zero days.
There are also other implementations of proof of stake consensus. Its greatest advantage is the fact that it demands less computational power than PoW.
Byzantine Fault Tolerance
According to the principle of Byzantine Fault Tolerance consensus, there is a list of faults that can be tolerated, and decisions on whether or not to verify transactions are made according to the results of voting.
For example, if there is a transaction that has been made, the first node that votes to verify it or not is called a leader, and other nodes should vote, too. The transaction is considered valid if it is verified by more than ⅔ of the nodes.
Federated Byzantine Agreement
This type of consensus considers that there should be a specified number of nodes that have voted for a decision to make it valid for the whole network. Unlike Byzantine Fault Tolerance, the number of nodes that need to agree can be less than ⅔.
Proof of Authority
No matter what kind of consensus algorithm is used, an authority can change the rules or cancel decisions. The authority in this example is a validator – a node with special rights. This kind of consensus doesn’t seem natural for deanonymized blockchain, but it still can exist as an option.
A smart contract is generally described as a set of algorithms recorded in a file. Actually, any transaction in the Bitcoin blockchain can be called a smart contract – however, a transaction is the only kind of operation available in Bitcoin.
Usually, the term “smart contract” is used only for Turing-complete blockchains like Ethereum. Smart contracts can enforce relationships on the basis of code. For example, you could set up and deploy a smart contract that sends 5 ETH to a specified address in 10 days. This action will be performed automatically after the smart contract is deployed.
However, there are also non-Turing-complete blockchains, like Bitcoin. The only type of data that can contain a block is transaction data, and it is the simplest smart contract. As you cannot add conditions in Bitcoin, you just make the transaction.
Check out our article disclosing all you need to know about smart contracts.
Build Your Own Blockchain
As you can see, there are many types of blockchains. You can combine basic features to build the blockchain you need, depending upon its goal. Do you want to make a cryptocurrency as a tool of exchange to replace fiat currency? Well, you’ll need a public blockchain, and not necessarily Turing-complete. However, you should think over the consensus type, as the proof of work realized for Bitcoin is hardly scalable.
Or maybe you want to make a blockchain for business purposes – to let companies make agreements that cannot be broken. There is Ethereum for these purposes, but maybe you can come up with a better idea. In the majority of cases, to make such agreements work smoothly, you have to wait until development of the IoT (Internet of Things) synchronizes with the blockchain. No matter what kind of a blockchain you want to realize, here at Applicature, we can design any kind of blockchain. However, if you want to try on your own, read below and learn more about programming languages and tools you can use to build your own blockchain, create an application, or construct smart contracts.
Some programming languages are suitable for blockchain development, and there are many tutorials available to learn from. In this section, you can find a basic description of the most common languages that are used when it comes to blockchain-related activities.
Blockchain Development in C++
First of all, it has to be noted that the Bitcoin blockchain is coded in C++. This language has at least proved to be useful when it comes to blockchain creation.
Why to choose C++? There are several reasons to consider it:
Memory control opportunities – scalability is the main problem faced by blockchains today, due to consensus issues that increase the time and computational power needed to perform operations.
- Proper threading – as there are many parallel operations that have to be performed simultaneously, threading features in C++ will be in use.
- Move semantics – this feature improves performance when it comes to the value of the variables retrieved.
- Compile time polymorphism – the ability to use functions in different ways is very valuable, as it decreases code volume and thus boosts performance.
Blockchain Development in Python
Python is one of the most popular programming languages with numerous tutorials, and totally fits blockchain development. Here are some reasons to consider Python:
- Large number of libraries – there are many libraries created for Python developers which allow you to get more tools for blockchain development.
- Simplicity – it is one of the simplest languages when it comes to code structure.
Blockchain Development in C#
C# tutorials claim this programming language as an option, and it can be used to create blockchains because it is object-oriented. Here is a list of the advantages C# possesses:
- Easy portability – it is easy to code cross-platform software for all kinds of devices and operating systems on C#.
- Close relation to Java and C++ – the code will be understood by other language developers.
- Open-source core runtime and compiler.
Smart Contracts on Solidity
Solidity is a language designed to build smart contracts and Dapps on the basis of the Ethereum blockchain. Check out this tutorial point for more information about Solidity blockchain development.
Ethereum Virtual Machine is something that makes Ethereum special – it can execute code, and is therefore the reason smart contracts and Dapps appeared in Ethereum and revolutionized all we knew about blockchain after the appearance of Bitcoin.
Development Environments and Tools
There are many coding tools and environments for blockchain development, and you can get acquainted with some of them in this tutorial.
The thing is, blockchain has been hyped,e and giant software companies have followed the trend. Some of them have already released tools for blockchain-related development. There are a variety of blockchain use cases, and companies are transforming their businesses on blockchain networks. Learn how blockchain is improving business operations by reading an interview with Applicature’s CEO.
You also can find development tools that have appeared only recently on the wave of blockchain rise.
Microsoft Azure Development Tool
Microsoft has designed the Azure Blockchain Workbench tool to provide an efficient environment with built-in tutorials for developers. Reasons to choose the Azure solution include:
- Simple development – the developer gets the opportunity to use Azure computing resources to test and design blockchain scenarios.
- Security – all data and development processes are protected by Azure.
You can learn quickly with the Azure blockchain tutorial for application builders. It has a free trial period.
Oraclize Development Tool
Oracle has released a tool for smart-contract development. Oraclize provides programmers with:
- web IDE codes & samples
- API documentation
- GitHub repositories
- development support
Blockchain Platforms for Development
Many blockchain projects were designed to provide tools for creation of private blockchains, Dapps, or smart contracts. This is like Android and iOS – just as you can design an application for one of these OS, you can create decentralized applications or smart contracts on the blockchain.
Even better, you can create a private blockchain using specified tools. It looks like we are going to witness the appearance of blockchain constructors soon – just like website constructors with drag-n-drop editors.
Development on the Ethereum Blockchain
Ethereum is one of the most popular blockchains due to the fact that it was the first to present smart contracts. The development of various smart contracts, Dapps, and ICO launches on Ethereum is one of the main reasons a developer should pass the tutorials for this blockchain.
First of all, Solidity has to be taken into account as the first language to consider for smart-contract development. You can get a complete coding tutorial for the Ethereum blockchain on GitHub.
Development on Corda Blockchain
Corda is a blockchain service designed to provide a solution for the development of blockchains and apps for business. Using Java, developers can build scalable, secure private or public blockchains for companies that tend to exploit the opportunities blockchain technology offers.
Corda offers learning and support to developers, and provides the necessary tools for development at the startup stage.
Let’s Sum Up
It’s been awhile since the first blockchain appeared. At first, there were not so many people who noticed Bitcoin; then the first forks appeared, and we experienced the first cryptocurrency hype when Bitcoin had reached $2.000.
Going back to those days, many people thought that Bitcoin and blockchain in general were something that wasn’t really worth their attention – just one more piece of engineering stuff.
Then there were the first talks about private money and the way cryptocurrency is going to change the world. And today, we have found many other ways to use blockchain to our advantage.
Different types of blockchain were developed, hundreds of ICOs were launched, and only a minority of these had any relation to cryptocurrency. There is even a blockchain project devoted to providing food security.
It looks like there are going to be a few more iterations for blockchain – maybe even better executions, which, along with transparency, will offer many other benefits, as well.
One thing is inevitable: blockchain is going to be around for a long time, maybe forever, and it would be a bad idea for a developer to ignore this subject.
Please share your thoughts on the future of blockchain and its development. If you need any assistance or have additional questions, feel free to contact the Applicature team of experts.