If you’re a developer, you might think that Blockchain technology is not something that matters much to you. After all, most of the mainstream conversation about Blockchain to-date has centered on cryptocurrencies and how they can revolutionize financial systems and the economy. There has been considerably less focus on writing actual software that interacts with blockchains.
But the fact is, below all of the bombastic headlines about Bitcoin, companies have been quietly working in recent years on real-world applications that take advantage of Blockchain technology. Their goals usually have nothing to do with cryptocurrencies — they instead focus on improving operations in industries such as healthcare and insurance. And with major public cloud providers like AWS and Azure now providing hosted services for building and deploying blockchain applications, it’s easier than ever to start writing code that interacts with the blockchain.
Now is the time to begin educating yourself about the fundamentals of developing a blockchain application. This article provides a basic primer on what you need to know about how Blockchain-based applications work and what makes them different from traditional applications.
What is a blockchain?
For starters, here’s a basic definition of a blockchain, from a developer’s perspective.
Essentially, a blockchain is a database similar to any other database, such as MySQL or Cassandra. However, a blockchain is distinguished by three key features:
- Blockchains are hosted using distributed, decentralized networks of computers. No single computer, person or group controls the database.
- Once data is written to a blockchain, it can never be erased, although you can add new data.
- Some blockchains can be used to provide compute resources, and not just for data storage. For more on this, see below.
There is a lot more to say about how blockchains actually work, but in order to stay out of the weeds, we’ll leave it at this — basically, if you think of a blockchain as a database with a few special features, you’re on the right track for building blockchain apps.
Types of blockchain applications
Broadly speaking, blockchain applications fall into two categories.
The first consists of applications that are written and deployed in a conventional way on a single server (or a cluster of servers inside a single data center), but that read or write data from a blockchain. You might, for example, write an application for managing inventory and use a blockchain to store the data. These types of applications essentially use a blockchain as a database, but otherwise operate as a normal application.
The second category includes applications that are actually executed on a blockchain. As noted above, some blockchains, such as Ethereum, are constructed using decentralized networks of computers that provide not only storage resources, but also compute resources. This means that application code itself can run on a blockchain in a decentralized fashion, with no single computer controlling how the application executes. This type of application, which is called a decentralized application (or DApp), makes it possible to construct entirely new deployment architectures.
Blockchain application performance management
Although blockchains provide a more reliable and fault-resistant way of storing data and (in some cases) executing applications than traditional infrastructure, they’re not magic. Blockchain applications can experience performance problems, just like any type of application. That’s why monitoring blockchain apps is important in order to meet user expectations.
One particular performance challenge that can arise for blockchain applications is slow transaction speeds. Due to the way that some blockchains, such as Bitcoin, confirm the authenticity of data stored on the blockchain, adding new data to the blockchain takes time. Bitcoin can process only about seven transactions per second, for example — which is not that many given how many people use the Bitcoin blockchain.
Other blockchains are faster, but the key point to keep in mind if you’re a developer is that you should design your application in such a way that it can tolerate slow data transaction rates. (You could do this by, for example, queuing data within the app and waiting until you have a fair amount saved up before actually writing it to the blockchain. That way, you reduce the number of transactions that you perform on the blockchain.) You also need to monitor it to make sure that transaction speeds are not undercutting performance.
Your blockchain is only as good as the data you put into it
Like all databases, blockchains can only provide useful data if the data that you put into them is of high quality in the first place. They cannot magically fix data that has problems when it is added to the blockchain. For this reason, controlling data quality is essential from the very start of the data collection process.
For example, if you are building a blockchain application that uses IoT devices to collect data from the environment and store it on a blockchain, you’ll want to ensure that the data your IoT sensors collect is properly vetted before being added to the blockchain and used by your app. You need to control for risks such as malfunctioning sensors that collect bogus data, or sensors that are out of sync and record data at improper intervals.
Blockchain security considerations
Blockchain fanatics sometimes pretend that data stored on a blockchain is somehow fraud-proof and immune to security vulnerabilities. But the reality is, just like any type of software, blockchain applications can be hacked. The protocols that govern how blockchains behave can be hacked as well.
This means that you should take steps to mitigate potential security vulnerabilities. Follow best practices for writing secure code when you develop a blockchain application and scan your code for vulnerabilities before you deploy it. These are things that you are likely accustomed to doing when creating conventional applications, but don’t make the mistake of assuming that a blockchain magically relieves you of these basic application security responsibilities.
Empower your development. Build better applications.