What is a blockchain for a software developer — A not so complicated explanation of the technology

Diego Barahona
Jul 30, 2018 · 4 min read
Image for post
Image for post

One of the concepts I love to talk about when referring to blockchain is to explain (or clarify) the blockchain in terms of code and how it is related to your current development knowledge. For some reason, although a lot of people is talking about blockchains these days, few seem to truly understand what is the role of this technology in our existing toolset as developers.

Leaving aside the political point of view, blockchain is no more than a data layer for our applications. It might be the only persistence layer, it doesn't have to and therefore it can be made of multiple data layers of this kind in your application. Actually, I recommend you this lecture about what we should be looking for right now in blockchain development to start creating interconnected blockchains and why it is necessary.

In our existing applications we're used to talk with APIs that under the hood store information in one or multiple databases. The same principle applies when you have a blockchain project. You probably will be talking to an API (either client or server side) to store data in the blockchain.

In the same way, our databases have models to shape the data like tables, document models, you name it, they're all made of a description on how our data looks like. Blockchains in general doesn't have to adhere to this convention, they're more like noSql databases where you can put the data without any format. But software development has taught us that having nonhierarchical data is not always the best idea. That's why we end up with tools like Mongoose for MongoDB, for example, to be able to lazily model the data. So using tools like Convector for a blockchain project makes it really easy and intuitive to work writing models to shape the data.

Another good comparison with databases, and probably the most important one, are stored procedures. Stored procedures are logic (functions) living in the database itself, taking inputs to perform operations with the data. In blockchain development this is often called smart contracts or chaincode. Knowing how to write these functions and the considerations you have to take is what we call blockchain development, not to get confused with blockchain core development, which refers to develop the blockchain technology itself or, to continue with the analogy, the database engine.

Another good analogy for software developers is a control version system, like GIT. Every change you make to the data is versioned and you can always go back in time to check those changes. Attention here: You can even change the historical values of a blockchain! Just like you do a rebase in GIT to combine commits or update the message. But on both worlds, GIT and Blockchain, you'll end up with the hash of the commit changed and all the subsequent commits as well. You'll have totally different historical records and no one will accept any changes coming from you, since you diverge from the master branch (the public available blockchain version). And no, there's no —-force in blockchain to override the history.

Blockchain is decentralized and the execution of the smart contracts has to happen multiple times on different computers, these are part of the distributed computational concepts a blockchain developer must take into account when using blockchain as a data layer.

Think in the smart contract execution as an update hook in GIT, performed by peers that contains a copy of the blockchain before accepting the commit you're trying to perform. This hook contains the logic to decide weather or not the commit author has the permissions to update the repository. You can also rely the commit author's identity is verified and that they will always be the person they say they are.

Since the execution of your hook will be performed in all the peers, your operations have to be deterministic, thus functional programming is a must here. You shouldn't generate random numbers, rely on a global state (the file system is a global state) or depend on external source of information like a connection to an API or any network access.

Blockchain is not a rare technology for software developers, its core functionality is built on top of technology that we have decades ago, like cryptography, GIT itself adhere to the same values that most of the blockchains today are based on.

I hope this article helped you to understand the technology without having to dig into really complicated terms that shouldn't really bother you.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store