Everything You Need to Know About Blockchain Technology Tests
[This post has been updated as of September 1, 2018]
These days, you’d be hard pressed to find a person who hasn’t heard about Bitcoin or cryptocurrencies in general. Even my mother, a 63-year old woman who barely uses a computer, has some general idea what these are. Everybody is talking about crypto cash, but to fully understand it you also need to understand the technology behind it – blockchain.
Today, many industries, both big and small, are implementing blockchain applications. And, like any technology, blockchain requires someone to test it too, to ensure it functions the way it is supposed to.
Otherwise, you might end up in the same situation as Ethereum, probably the second best-known public blockchain after Bitcoin. Back in 2016, a $280 million’s worth of this cryptocurrency was locked and unreachable due to a bug. Apparently, the bug was accidentally triggered by a user, and as a result, that user gained access to a number of wallets.
The whole situation could have been avoided if Ethereum had been properly tested before its release to the public. As it was, Parity’s multi-signature Ethereum wallets ended up frozen because of a security flaw.
How to Avoid Ethereum’s Mistake and Test Your Blockchain Application
Blockhain is still a relatively new technology that is unique in many aspects. While many methods applied in regular web application testing, such as security testing, functional testing or integration testing, are still relevant, testing blockchain applications is a bit different and should include the following testing types:
- Smart contract testing
A smart contract is a software module in the blockchain that automatically completes a transaction using previously specified conditions. To test smart contracts, one must consider and simulate all possible conditions for each individual contract. Considering the amount of nodes and their combinations, as well as how fast the network grows and changes, this requires testers to adopt automation during blockchain application testing.
- Non-functional testing
Other aspects of a blockchain application to test are its performance, integrity and latency. This can depend on several factors, including the network size, transaction size and more.
- Peer and node testing
Blockchain’s most important element is its ledger. This is where all the cryptocurrency sequences and transactions are recorded and shared across all the nodes so that everyone can see they are identical. For this, however, blockchain participants need a consensus about the date and time each transaction joined the network.
The consensus protocol needs to be tested to validate if this is actually the case under normal circumstances, when all the nodes fail, and when there is not enough nodes in the network for a certain amount of time.
This can be tested using Byzantine nodes. Basically, a Byzantine node is a member of the blockchain which attempts to intentionally disrupt its operations, for instance by not forwarding messages further on to other members.
What Can and Should Be Tested?
What exactly can you test blockchain applications for? There are obviously some limitations, so here is the list of a few things that you can test:
- The block size
In 2010, Satoshi Nakamoto introduced a block size limit of 1MB. This limit remains the same to date, although it has been a subject of much debate in the Bitcoin community. What happens when the maximum block size is exceeded?
As a part of the solution, Bitcoin introduced a “hard fork” (a drastic change to the protocol that invalidates/validates previously valid/invalid blocks and transactions). This solution consisted of two ways to deal with the block size scalability issue. On the one side, developers and users wanted to keep the 1 MB maximum block size but get a better compression algorithm, while the other side, miners, advocated the increase of the maximum block size to 8 MB.
Both sides of the fork, Bitcoin (BTC) and Bitcoin Cash (BTH) have their advantages as one is more secure and the other is faster. The problem that needs testing here is how the blockchain will behave when increasing the maximum block size or using different compression algorithms..
In theory (under perfect conditions, that is), the maximum throughput of a Bitcoin blockchain per second is 7 transactions, while in practice it varies between 3 and 4. That’s quite low. On the other hand, Visa’s maximum load is 50,000 and the average one is 2,000, and even Ethereum can achieve 20 transactions per second. Why can’t Bitcoin?
One of the first questions someone new to Bitcoin usually asks is how secure it really is. It’s a very valid question. Much of the focus here seems to have been on establishing a participant’s identity, but what happens when this gets compromised? Again, returning to Bitcoin vs. Bitcoin Cash, one is oriented more toward security, while the other toward the time needed to complete a transaction.
- The Chain size
At the time of writing this article, the block count was nearly 520,000. There is no limit to the chain size, so it’s possible to test both performance and functionality, as well as what happens if the chain gets temporarily broken (for instance, when two miners get to two different but both valid solutions for the same block at the same time).
A partitioned system can give only two responses: to go back to the most recent accessible link in the chain or to provide an error. The question is, what do you do if the end of the chain is no longer accessible?
Obviously, there are many more things that testers can get their hands on when it comes to blockchain application testing, but these five give a good overview of what can and should be tested.
Testing Is a Must
Although blockchain has caught like wildfire, it’s still far from being perfect. To get closer to perfection, blockchain creators and participants need to get a deep holistic understanding of blockchain-based applications. The best way to do that is to test it thoroughly and consistently.
This is a guest post made by By Maria Weinberger, technology journalist writing on subjects such as blockchain, IoT, AI and innovation for a range of publications.