Testing With Blockchain – Blockchain Applications and How to Test Them

Ethereum is one of the world’s best known public blockchains and smart contract platforms, yet the DAO hack mentioned above was just one occasion on which millions of dollars of value was either misappropriated or accidentally frozen. Here is Testing With BlockchainBlockchain Applications and How to Test Them

  1. Rise of Blockchain
  2. Testing With Blockchain

 

Imagine being part of a software development team working on an exciting new project that has been widely written about and which thousands of people are eagerly awaiting. You deploy the code, sit back to enjoy the results… but there is a bug in the software you and your team have developed. A bad bug. A bug so critical that you can literally see all your users’ funds being drained away by a mystery attacker.

OK, so you can hit the kill switch, roll back the code to stop any more funds being drained and deploy a patch, right? Wrong. The code is already running on thousands of machines all over the world. Like Pandora’s Box, it cannot be reversed. And the code that has caused the problem is visible to the whole world, for everyone to pore over and criticise.

All over the world, outraged users whose funds have been diverted to the attacker’s wallet are writing blogs or tweets pointing out the offending line of code. Hindsight is a wonderful thing. But all you can do is agonise over how you didn’t spot such an obvious vulnerability.

This sounds like a tester’s worst nightmare. But it actually did happen, in 2016.

Ethereum is one of the world’s best known public blockchains and smart contract platforms, yet the DAO hack mentioned above was just one occasion on which millions of dollars of value was either misappropriated or accidentally frozen.

It can be very exciting working with bleeding-edge technology, but as these projects progress from being proofs of concept to fully fledged enterprise-level applications, it underlines the need for a heightened awareness around how we test products built on emerging technologies such as blockchain.

Rise of Blockchain

Of course, the term ‘blockchain’ encompasses a wide range of alternatives, from private distributed ledgers to the massive public networks such as those that power Ethereum and Bitcoin.

So let’s rewind for a moment and ask what exactly is this protocol that has everyone so excited?

In the past, if we have relied on a record that is kept by a person or an organisation, we had to trust the person or the organisation not to tamper with that information. For example, if someone kept the financial records of the village social society on their laptop, everyone had to be sure that this was a person who was unlikely to tamper with the figures or game the system.

In contrast, data held in a blockchain exists and can be verified in many different places simultaneously. This means that people, companies or even countries who would not necessarily trust each other can all have access to the same information. And, to ensure that the data has not been tampered with or changed, another feature of blockchains is that each block of transactions is cryptographically linked to the last, right back to the beginning of time. This makes it very complicated to edit or change anything.

The first Blockchain was the one that powers Bitcoin. A few years ago, hardly anyone had heard about Bitcoin, but today it is on every newspaper front page. Read more about Bitcoin here.

Today, Blockchains can be used for far more than making payments. There are networks which can be used as platforms for executing smart contracts, such as Ethereum, and other private or consortium distributed ledgers which share some of the attributes of a public Blockchain but which are private by design.

Testing  With Blockchain

It is the public blockchains which offer us the real power to change the way our technology drives our future. But testing blockchain applications is quite different from testing traditional applications. As well as all the normal heuristics, we have to take into account things like how our app will behave when events outside our control affect the network, whether people are able to front-run our transactions, and even whether our transactions are going to become too expensive to justify the existence of our application.

If you want to hear more about how testers should be approaching this fascinating emerging technology, and delve into testing with blockchain more, do come to my talk at UKSTAR 2018.

About the Author

Rhian

Software developer in test, Rubyist, Agilist, blockchain adventurer, vegetarian, runner. Co-developer of altcoin portfolio tracker CountMyCrypto. Co-host London Bitcoin Women. Former digital journalist at @thetimes.co.uk. Speaker, educator and writer on blockchain technology, cryptocurrency and cryptoassets
Find out more about @rhian