Spectra Mind solutions Blockchain

A lot of industries are experimenting with the technology Let’s look at some of the benefits that blockchain can bring to specific types of business:

  • Charities (transparency of program expense percentages, lower financial processing expenses)
  • Defense (authorization, decentralized locations)
  • Energy (tracking microgeneration, where customers self-generated energy back to the power company)
  • Event ticketing sales (proper accounting of all seat reservations)
  • Government (transparency, connecting siloed departments)
  • Healthcare (regulate access, limit fraud)
  • Law (smart contracts eliminates the middleman, simplifying the contract process)
  • Sales (it is easier for musicians or authors to sell digitally with a store as middleman)

What SpectraMind Would do in Blockchain Test?

But how does one go about testing this new technology, and what are the limitations we have to deal with? This is not a comprehensive list from an actual project – this is me thinking out loud about some considerations I would certainly want to include. If you’re a tester, this will seem familiar, otherwise, it is a good introduction to the testing mindset. Keep in mind that blockchain has a much broader scope than Bitcoin, so Bitcoin factoids may be more constrained than blockchain factoids. Let’s take a walk through my thoughts about various concerns:

Block size: Less than 100 bytes of a block is spent non-payload. For Bitcoin, there is currently a fixed maximum limit of 1MB per block. For its first 18 months, the average block size averaged under 30KB. Now, in the beginning of December 2017, the average size hovers around 1MB. What happens if the amount of new data going into a block exceeds the maximum block size – how is it handled? Keep in mind that multiple transactions can be buried inside a single block. In August of 2017, the Bitcoin Blockchain had a ‘hard fork’ to address 2 different approaches to start tackling the scalability problem. One side (mostly miners) wanted bigger blocks and now has an 8MB max instead of 1MB, while the other (mostly users and developers) wanted a better compression algorithm (Segwit) while keeping the 1MB max. However, the cash on each side of the fork is different — Bitcoin (BTC) vs. Bitcoin Cash (BCH) – and attempts to transfer between different sides of the fork will destroy the funds, but pre-fork history belongs to both sides. But there still seems to be a trade-off in these two – Bitcoin is more secure, but Bitcoin Cash transactions take less time. It has yet to be determined how having block sizes beyond 1MB and/or using better compression algorithms will pan out, but it demonstrates that the original Bitcoin constraints on blockchain blocks do not limit blockchain in general.

Chain size: There should not be a limit here, so it may be fun to test block creation functionally and performance-wise as the chain lengthens. https://blockexplorer.com/api/status?q=getBlockCount can tell you the current count (almost 500,000 as I write this). It is possible for the chain to get temporarily broken, if 2 miners unknowingly simultaneously arrive at two different valid solutions for the same block. After a short period of time, the peer-to-peer network will resolve these splits so that just one branch of the chain will survive.

Load: Bitcoin’s blockchain currently has a maximum throughput of 3-4 transactions per second (with a theoretical max of 7 under perfect conditions), with new blocks to hold transactions create about every 10 minutes. Compare this to the transaction/second loads needed to handle Ethereum (20), PayPal (193), Visa (2,000 average but has gone as high as around 50,000), McDonald’s POS via AWS (8,600), and Alibaba on Singles Day, 2017 (256,000 average). The problem with blockchain is that speed drops when load increases, making scalability problematic. There is a DLT alternative to blockchain called Tangle, which is blockless, scalable and lightweight, helped by using trees instead of chains. It also requires no data miners to pay for processing. However, Tangle technology is pretty new, and the cryptography hashing was altered as recently as July of 2017 to fix a vulnerability that had allowed unauthorized forking.

Performance: How long does a query take if it must look at every block in the chain to research something like every time a specific account was touched? Is it like SQL queries, where phrasing things differently affects duration? This may involve integration testing which emphasizes the outer querying app more than the blockchain itself.

Consistency/Availability: According to the CAP theorem, there are only 2 possibly responses that a partitioned system can give: the most recent accessible piece of a chain, or the choice between the most recent piece of the chain or an error. Or in other words, if the most recent end of the chain is unaccessible (which is always a possibility in a partitioned system), do you throw and error or provide details from an earlier chunk? Let’s assume that waiting for the end of the chain to become accessible fails, and the system must choose between these two options: fail or reveal an earlier block. By the way, in a non-partitioned system, either the system is up or it isn’t – nothing piecemeal.

Collisions: We covered this up in Chain Size, where it should be possible to duplicate through automation to get the timing right, so you can ensure that the proper behavior occurs for 2 blocks that want to simultaneously get added. Consistency/Availabilityalso presents another way to attack this “well, I seem to have this information for a block that I’m not sure where to put”, when the chain’s end is not available, again so you can ensure that the proper behavior occurs. Some limbo location until it can be processed? A split in the chain? A juggling act where the new one gets added to the last accessible block and the orphaned inaccessible block gets added back in later?

Security: Blockchain seems to appear in the news to either publicize the increased value of bitcoin, or the theft of bitcoin, raising the obvious question: is bitcoin safe? Multiple layers of security are built into determining identity. Unfortunately, once the identity layers have been hacked, the instantaneous transactions cannot be stopped. The multiplicity of keys may complicate theft, but ultimately, anything that can be entered can also be stolen, by weaknesses such as lackluster caching or tools such as sniffers. In terms of Bitcoin/Bitcoin Cash, there’s been a trade-off of security vs. transaction time. The tamper-resistant quality of security is built-in to blockchain (except for one company’s blockchain editing tool). I’ve also mentioned above about Tangle’s recent update to fix a security issued that allowed blocks to be altered without breaking the chain. Why hack a block? It could be a steal data (theft, which may include authorizing an unauthorized transaction), or it could be to edit data (fraud).

Data corruption: We talked about collisions that can interfere with testing earlier, so here is a specific cause of a Consistency/Availability root cause. What happens to the data in a block if a block gets corrupted? Is there a way to repair the block? Can the chain past the damaged block be reached?

How do SpectraMind fix transaction typos: Correcting a block should not (but is) possible, with the existences of tools contradicting the immuteable qualities that make blockchain valuable. Otherwise, a newer blockchain entry must be added that voids or corrects the earlier mistake in the chain. Alternatively, a new transaction to adjust it back could be added.

CRUD testing query logic: In the case of supply chain or product recall or user activity, many records need to be properly parsed spanning multiple chains or multiple records inside a block or both. In the case of smart contracts, you may want to track all drafts of the contract, or pull the versions that were in force over a specific period of time. Testing should include both functional and performance.

Database handling: How is your tracking set to deal with unusual cases in supply chain management? What if something is damaged or goes missing? What if an item becomes 2 items (like a diamond that gets split)? What about 2 items becoming one (two 2-packs get damaged and the undamaged halves get combined into a new 2-pack)?

This is just the beginning of a list of potential testing for blockchain systems. Testing should go beyond just the blockchain portion and include integration testing that maps to the whole business process. I hope this exercise gives you helpful ideas on testing this new technology.

What Types of Tests and Techniques Can SpectraMind Perform on Applications Built on Blockchain?

There are many different types of tests that can be performed at the various stages of developing software projects. Below are a few types of tests that can be utilized to ensure a high level of test coverage and quality for blockchain applications.

Unit Tests

Unit tests help developers ensure their code is performing correctly at the lowest levels and smallest parts of functionality. This should always be the first line of defense to ensure an application catches the majority of bugs early during development.

Integration Tests

Integration tests help developers and test engineers ensure the communication of their code between different components, and possibly between internal and external systems like databases.

User Interface

User interface (UI) testing uncovers how the application works from the end user’s perspective. It’s important to ensure that you carry out UI testing to make sure their experience is positive or that they at least get the correct feedback from the application when it doesn’t perform well.

Application Programming Interface

Application programming interface (API) testing gives you confidence that you’ve validated the responses that your application receives from external APIs and makes sure the formats of your API requests are correct and being handled correctly.

With blockchain applications, there is also a similar type of technology to APIs that allows you to adopt the same testing practices for APIs. These are called smart contracts.

Blockchain Testing Tools we Work with @ SpectraMind

There are some pretty good tools and frameworks being developed that can help with both development and testing.

  1. Ethereum Ethereum is the best-known blockchain (other than Bitcoin), and it has some great frameworks for developing applications, many of which have libraries baked in to make testing fairly easy.

  2. Ethereum Tester Simply put, Ethereum Tester provides tools for testing Ethereum-based applications.

  3. Truffle Truffle bills itself as the most popular Ethereum development framework, and based on its 4,288 stars on GitHub it, clearly is popular It’s a development framework that has testing functionality, like the ability to write automated tests for your contracts in both JavaScript and Solidity and get your contracts developed quickly. It also works with popular test runners like Mocha and Chai.

  4. Ganache (formally Testrpc) Before you release your blockchain application to production, it’s important that you test it locally. Ganache is the most-used library for testing Ethereum contracts locally. It works by spinning up a kind of mock blockchain that gives you access to accounts you can use for testing.This tool doesn’t feel that it conveys the same latency you get on a live system, doesn’t really replicate real-world scenarios for the time things take and so on. But it’s enough to let you compile a contract, deploy it, determine its cost, and debug it locally.

  5. Populus For testers who prefer Python, the Populus framework provides some powerful utilities for testing blockchain contracts. Testing in Populus is powered by the Python testing framework py.test.

  6. Manticore Manticore is a symbolic execution tool for analysis of binaries and smart contracts. Manticore enables human-assisted analysis and the automatic detection of vulnerabilities.

  7. Hyperledger Composer Hyperledger Composer is an open-source development tool that contains many functions to help build blockchain applications. Some of those features also help with testing. More specifically, it supports three types of testing: interactive testing, automated unit testing and automated system testing. It has a command-line interface that provides commands allowing you to easily run interactive “smoke tests” to ensure the deployment was successful. This also makes it easy to execute tests in a CI/D system.System tests can also be created using Docker Compose and Mocha/Chai. You can start a runtime and deploy your business network definition, then programmatically create assets, submit transactions and inspect the state of asset registries.

  8. Exonum Testkit Testkit for Exonum Blockchain is a framework that allows you to test the operation of the whole service. Specifically, it allows you to test transaction execution and APIs in the synchronous environment (without consensus algorithm) and in the same system process.

  9. Embark Framework Embark is another popular framework for building, testing and deploying your app. It’s a framework that allows you to easily develop and deploy decentralized applications (DApps).

  10. Corda Testing Tools Corda is a blockchain-inspired, open-source distributed ledger platform. It has a built-in testing feature to help with.

We also Offer

  1. Development of Blockchain Use Case: By taking a very business and product-centric view, SpectraMind are able to develop use cases which incorporate the customer, regulation, technology, data and process triggers.
  2. Proof of Concept (POC): Identification of data sources, appropriate metrics and advanced technology components required to deliver a POC that validates the solutions required. Delivery of POC thereon (on SpectraMind or Client infrastructure).
  3. Blockchain Proposal: By utilising the knowledge and experience that SpectraMind has of operating models and business integration we then provide a proposal on how blockchain can be best used strategically within the Client’s organization.
  4. Programme Delivery: End to end programme delivery of business, data and technical architecture that underpins the blockchain capability.

For more information on our Blockchain test solutions : pls email : info@spectramindsolutions.com