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

Diego Barahona
4 min readJul 30, 2018

--

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.

--

--