Building Distributed Applications
You’ve probably heard of the recent Bitcoin bubble. The cryptocurrency has exploded in just a few years from a few dollars to almost $20,000 in value. Although Bitcoin is the most commonly known cryptocurrency, there is much more to it than just Bitcoins and their value. One of cryptocurrency’s biggest advantages is that it’s decentralized digital form of money, which has been a foundation for further expanded decentralized blockchain applications.
What is the blockchain?
Before we get into the applications, you should first understand the blockchain. Think of it as a digital ledger that keeps track of transactions. Not unlike a standard ledger in an accounting department, the blockchain is a system of linear blocks that expand each time a new transaction is added. Think of it as a tree of blocks that store transactions and can’t be changed by any single entity, including the creator of the blockchain. It runs on a network of peer-to-peer computers that have a copy of it and any changes require the community.
Each time a new transaction is added, the new block has a pointer to the previous transaction block. It’s what keeps the chain together.
For security, the blockchain uses encryption. The owner of a wallet that contributes transactions to the chain has a public and private key. The private key is his own passcode to open the wallet, and a public key is used to distribute to payers who send bitcoins. A private key should never be shared, but the public key is what the name suggests – it’s shared with other users as a way to send money only to the intended recipient.
The blockchain can be compared to the Internet. The Internet is not one server where everyone browses content. Instead, it’s a massive group of network equipment that work together to connect users to web content. No one person can change the Internet, its infrastructure, or the content it contains. That makes it secure from having anyone entity control its applications.
Distributed Applications and Ethereum
We mentioned that the blockchain is a linear concept, but like other software, it can be “forked.” Forking is the term given when a developer takes an existing code base, copies it entirely, and then makes his own application based on the previous code. Forking is good for applications no longer supported by the previous developer, or it can be used to build off of the original codebase to make it better with additional features and functionality.
Ethereum and other distributed application developers made a hard fork in the blockchain code (which is open-source) and created their own cryptocurrency ecosystem. Instead of trading bitcoins, Ethereum clients use Ether. This is an important part of cryptocurrency differentiation because many people interchange the term “bitcoin” with “cryptocurrency.” Ether and Bitcoin are a form of cryptocurrency, but they are different entities. For instance, Ether is used by some developers to pay for tokens on Ethereum. Bitcoins are used to trading currency and to pay for tangible products.
Ethereum expands the limited capabilities of the blockchain and allows developers to create robust decentralized applications (also called Dapps). When you read “decentralized application,” it means that the application has no one source and doesn’t have a single source of failure. These applications run on a blockchain network, so no one person or one company controls them. The advantage of Dapps is that values in the blockchain cannot be modified by anyone person or entity. Each application is a part of the peer-to-peer network, so any changes committed to the system must be accepted by the client.
Developers can take advantage of Ethereum by using it as a middleman for blockchain applications. Any number of applications can be created in a decentralized version. It’s all in the mind of the developer and owner. Just to name a few Ethereum applications on the market today:
- A decentralized “tweet” micro-blogging system like Twitter
- A Minecraft-like game application
- Crediting and financial loans for people in Africa
- Crowdfunding
- A decentralized place for artists to distribute their work
Getting Started with Distributed Applications
Ethereum is only the middleman for applications to run in a decentralized form, but the rest is up to the developer. Because it’s only the middleman, developers can use any number of languages that they want to build an application. Some languages used include .NET (C# and VB.NET), Go, Java, C++ and any other language that can run in the cloud.
You need a few core technologies to get started. First, the blockchain’s security is cryptography and hash functions. As we mentioned, it uses the old public-private key security.
The next blockchain feature that makes it decentralized is its peer-to-peer functionality. Traditionally, applications are server-client based. The user runs an application on the client that connects to a centralized server. The blockchain is different in that it runs on the client, and each client has a copy of the database. A good example of this was the old Napster network. Users downloaded music from other users hosting it on their computers. There was no centralized server storing music, which was one of Napster’s defenses during the trial. Users were sharing between themselves without the control of a central server.
With Ethereum, you need an Ethereum Virtual Machine (EVM). It’s this EVM that runs in the cloud and contributes to the peer-to-peer network. It communicates with the blockchain using digital signatures.
The frontend of a decentralized application is HTML and similar to any frontend application. For frontend developers, building these applications will feel very similar to building standard web apps. The backend is called a “contract” in Ethereum terms. It’s built-in its own language of choice, but many developers use Solidity. Two other options are LLL and Serpent (similar to Python). Coding is similar to any other application as far as syntax and structure. Ethereum applications have methods, variables, and syntax unlike any other language, so learning code is not unlike learning a new framework.
Many developers use third-party tools to create these Dapps. Alethzero is used for frontend GUI development. Truffle is a development environment that also helps you deploy applications to Ethereum. MataMask is a Chrome extension used to interact with the blockchain. Its benefit is that you don’t need a separate, installed standalone application and it doesn’t require users to fully download the blockchain database. Finally, another good application to have is TestRPC. It allows you to simulate the Ethereum client but locally, which makes it faster and easier to use during development and testing.
One other interesting component of Ethereum is its ability to throttle use on the network to avoid attacks on the network. Ethereum uses “gas.” When a developer wants to commit a transaction or use the Ethereum backend, he offers up the amount of gas he will use. Different functionality requires different amounts of gas. This gas is purchased by Ethereum’s cryptocurrency Ether. Using a “supply and demand” structure, Ethereum reduces the chance of developers performing random malicious attacks. The amount of gas is not determined by Ethereum itself. Instead, the community determines the price of gas for transactions.
Where to Go from Here?
Choose a few tools, set up your EVM, and it’s time to get started. Like any framework, language or platform, developers must start with the basics and start tinkering. You’ll need an idea first, but make it simple enough that you can write a limited amount of functions to get it to work. Even a basic contract will give you a good feel for the way Ethereum and distributed transactions work in general.
The biggest hurdle for developers to overcome is the peer-to-peer nature of distributed applications. Remember that there are no login accounts, no central application database, and no single entity to control database transactions.
If you have an idea and don’t have the coding knowledge, you need someone to develop your idea, hire our software development company.