Blockchain Testing Strategy - Testing is crucial in Blockchain as the technology ledger is immutable. The cost of a defect is very high in production. This paper explained what all changes faced in blockchain testing, and how can we resolve those challenges. What needs to be tested and testing approach. How performance testing can be done and what KPI's to be monitored.
2. Topics to be covered
• Current Situation-Real world problem
• What is Blockchain and its Structure
• Blockchain Technology – Key Component
• How Blockchain Work
• Test challenges in blockchain
• Opportunity for Testers in Blockchain World
• Blockchain Testing Scope & Approach
• Blockchain Testing Tools
• Performance Testing Approach
• KPI’s for Monitoring
3. Remember that the blockchain does not forgive you any errors because of its immutability!
1. The DAO attack
Date: June 17, 2016
Price then: 3.6 million ether, US $79.6 million
2. Parity - The beginning (Someone “accidentally” deleted some
critical code used by the popular Parity multisig wallet.)
Date: July 19, 2017
Price then: 150,000 ETH, US $300 million
3. Out of the 19,366 Ethereum smart contracts
analyzed, 8,833 of them had bugs
Current Situation-Real world problem
Size of the blockchain technology market worldwide from 2016 to 2021 (in million U.S. dollars)
Source Statista 2019
4. What is blockchain?
• Block chain is chain of block which contains
information in form of cryptography and shared
through distributed ledger
Source :Testing Blockchain Application by Thoughtworks
5. Business logic
embedded in
ledger that
can be
triggered
when certain
conditions are
met
Cryptography
is a central
feature,
transactions
are secure,
authenticated
& verifiable
A chronological
record of
transactions in
a distributed
ledger shared
across a
business network
All participants
agree to a
network verified
transaction by
consensus
Transactions are
broadcasted
through the network
and travel from one
node to another
Transaction stored
in the Distributed
Ledger
Security
Smart
Contracts
Distributed
Storage
Ledger
Network
Consensus
Lower Cost
Increased
Transparency
Greater
Security
Faster
Settlement
Blockchain Technology – Key Component
6. Transaction Requested
Requested Transaction is
broadcasted to peer to
peer network
Validation: Network of nodes
validate the transactions using
known algorithms
Validated using
different
parameters like
nonce, timestamp,
signature SHA,
hash in an
algorithm
Verified
transaction
create new
bock data for
ledger
New block is added to the existing blockchain, which
is immutable
Transaction completed
How Blockchain Works?
Image Source
7. What could go wrong in Blockchain testing ?
Test challenges in blockchain testing
7
Transactions are Irreversible
Standardization in Blockchain Testing
Fast Pace of Blockchain Tech
Innovations
Lack of Blockchain knowledge base
within Testing universe
Lack of Best Practices, Models, Tools
etc. within Blockchain Testing area
1
2
3
4
5
Scalability due to low capacity of reading and
writing data compared to current relational
databases
8. Opportunity for Testers in Blockchain World
Upskill knowledge with new way of testing
Increase in Breadth & depth of testing profiles
Deliver best in class & Growth opportunity
Focused on innovative solution with higher quality
Flexibility
Best way to predict the future is to create it. – Peter Drucker
9. INITIATION
Requirement
Understanding
Architecture and Solution
understanding
Design full Testing strategy
01
DESIGN
Test Creation
Test Data Creation
Environment and Node set-
up
Performance Metrics
Security Assessment Strategy
02
TEST
API
Smart Contract
Peer/Node
Functional
Non-functional
Integration
Execute node Test cases
03
REPORT
Project Summary Report
Performance Testing
Report
Smart Contract Testing
Report
Security Testing Report
04
Our unique blockchain testing approach ensures every aspect of blockchain is tested
Blockchain Test Approach
10. End-to-end solution to remove duplication or manipulation of product
How it work in Retail
Image Source
11. FUNCTIONAL
This is a holistic process that
evaluates the work of various
functional parts of the blockchain
API
Application Programming Interface tests
address the interaction between
applications in the blockchain ecosystem
PEER/NODE
Blockchain functions in a peer-to-
peer distributed network through
network nodes using a specific
protocol for authentication
PERFORMANCE
Details like network latency based on
block size, network size, expected
transaction size, and how long a query
takes to return the output with
specialized authentication protocol
SECURITY
The aim is to identify if the application is
vulnerable to attacks, assess if the
authorization systems are robust, identify
if the system protects the data and has
the capability to ward off malicious
attacks etc.
SMART CONTRACT
Smart Contract testing is largely about
performing detailed functional testing of
business logic and process.
INTEGRATION
Integration testing is important for
Blockchain since deployment could be
across several systems and
environments
High level view of test areas for a typical blockchain at nagarro
Blockchain needs to be tested
12. Blockchain Testing Scope
Specialized Functional Performance Security & Data
› Smart ContractTesting
› Peer/nodeTesting
› Network Connectivity
› Third party software
› Block size
› Chain Size
› Addition of block
› Consistency/Availability
› Gas Consumption
› Services
› Algorithms
› Load
› Synchronization
› System performance
› Consistency validation
› Capacity of processing
transactions
› Cryptographical data
› Verify data losses or
corrupt
› Transmission of data
› Data corruption
Blockchain Testing Scope
14. Blockchain -Performance Testing
Detailed layer wise performance testing
Data LayerConsensus Layer
Smart Contract
Layer
Application Layer
Data LayerConsensus Layer
Smart Contract
Layer
Application Layer
A transaction requested
Store new data
Execute some task
Response of the request
Response of the request
Record the new transaction
Record the new transaction
Source : ResearchGate white paper by Si Chen
15. Average Block Size - The 24 hour average block size in MB
Transactions per Day - The aggregate number of confirmed transactions in the past 24 hours.
Mempool Size - The aggregate size of transactions waiting to be confirmed.
Transaction per block - Average Number Of Transactions Per Block
Hash Rate - The estimated number of tera hashes per second (trillions of hashes per second) the
blockchain network is performing.
Hash rate distribution - An estimation of hash rate distribution amongst the largest mining pools
Cost per transactions - Miners revenue divided by the number of transactions
Difficulty - A relative measure of how difficult it is to find a new block
Gas Consumptions - Gas is what is used to calculate the amount of fees that need to be paid to the
network in order to execute an operation
KPI’s for Blockchain Monitoring
Blockchain Popular Stats
16. Key Points Considered for Testing
To test a Smart contract, Algorithm, node etc.
• Check overflows and underflows - Always test the limits of the functions
• Check that the return values of your functions are always within the range of
the expected values
• Make sure that the return values are properly formatted
• Gas consumption
• Security
• Performance
17. Known attack
1. Re-entrancy
2. Front-Running (AKA Transaction-Ordering Dependence)
3. Timestamp Dependence
4. Integer Overflow and Underflow
5. DoS with (Unexpected) revert
6. DoS with Block Gas Limit
7. Gas Limit DoS on the Network via Block Stuffing
8. Forcibly Sending Ether to a Contract
9. Deprecated/historical attacks
List of known attacks