SlideShare a Scribd company logo
GLOBAL SOFTWARE CONSULTANCY
TESTING ETHEREUM SMART
CONTRACTS
By
Preet G S Anand and Himanshu Pandey
1©ThoughtWorks 2019 Commercial in Confidence
VodQA Pune 2019
2©ThoughtWorks 2019 Commercial in Confidence
AGENDA
BRIEF OVERVIEW OF
ETHEREUM
DAPP ARCHITECTURE AND
TESTING COMPONENTS
TESTING IN BLOCKCHAIN
PARADIGM
BRIEF OVERVIEW OF ETHEREUM
3©ThoughtWorks 2019 Commercial in Confidence
Decentralized platform that runs smart contracts
4©ThoughtWorks 2019 Commercial in Confidence
WHAT IS DLT?
● Distributed Ledger Technology
● Distribute the ledger across all nodes
● Every node has complete copy of the
ledger, and all ledgers are always in sync
5©ThoughtWorks 2019 Commercial in Confidence
WHAT IS ETHEREUM ?
DISTRIBUTED PUBLIC
NETWORK
CONSENSUS ETHEREUM VIRTUAL
MACHINE
6©ThoughtWorks 2019 Commercial in Confidence
DISTRIBUTED PUBLIC NETWORK
● Ethereum is a peer to peer network, somewhat like a mesh topology
● Any new node can be added to this network
● Any machine which is part of ethereum network is a node
● There are three types of ethereum nodes:
○ Full node
○ Lightweight node
○ Miner node
7©ThoughtWorks 2019 Commercial in Confidence
CONSENSUS
● Achieve agreement on a single data value in blockchain
● Involves reward for nodes which participate in consensus resolution
● Types :
○ Proof of Work (POW)
○ Proof of Stake (POS)
○ Proof of Authority (POA)
8©ThoughtWorks 2019 Commercial in Confidence
ETHEREUM VIRTUAL MACHINE
● Ethereum is a programmable blockchain
● EVM is “Turing Complete”
● EVM is something which differentiates Ethereum with Blockchain
● Each and every node of the network runs the EVM and executes the same
instructions
DAPP ARCHITECTURE AND TESTING
COMPONENTS
9©ThoughtWorks 2019 Commercial in Confidence
DAPP ARCHITECTURE
10
HTML / JS / CSS
Block
EVM
BLOCKCHAIN FRONT END
BROWSER
©ThoughtWorks 2019 Commercial in Confidence
API
DB
WEB3 API
RPC
Smart
Contracts
HOW IS IT DIFFERENT FROM A WEB APP
11
PARTY A
PARTY B
PARTY C
©ThoughtWorks 2019 Commercial in Confidence
Different parts of Web3 API
● Node / Java / Python API
○ Uses Web3 library
○ Talks to blockchain via RPC calls
○ Provides wrappers over smart
contracts
● Smart Contracts
● Database
HOW DOES THE API LAYER LOOK LIKE
12©ThoughtWorks 2019 Commercial in Confidence
API
DB
Smart
Contracts
WHAT IS A SMART CONTRACT
● Smart contracts is a misnomer.
● They :
○ Store rules
○ Verifies rules
○ Self execute rules
● Removes need of a middle man as they are self
executing, ex: Vending machines
● Help in exchanging money, property, goods in a
transparent, direct and trusted way.
● They are responsible for creating blocks in
blockchain.
13©ThoughtWorks 2019 Commercial in Confidence
SETTING UP A TEST ENVIRONMENT
14©ThoughtWorks 2019 Commercial in Confidence
● In order to communicate with the blockchain, we must use a blockchain client
● Geth is an ethereum client and is written in Go
● Enable you to connect with blockchain over RPC endpoint
● Provides API for account management,transaction management, peer
management, debugging
15©ThoughtWorks 2019 Commercial in Confidence
GETH
16©ThoughtWorks 2019 Commercial in Confidence
● Development environment
● Testing framework
● Asset pipeline for blockchains using the Ethereum Virtual Machine
TRUFFLE
● Install truffle
npm i -g truffle
● Initialise project
truffle init
TRUFFLE SETUP
17©ThoughtWorks 2019 Commercial in Confidence
TESTING IN BLOCKCHAIN PARADIGM
18©ThoughtWorks 2019 Commercial in Confidence
UNIT TESTS
19©ThoughtWorks 2019 Commercial in Confidence
● Written in solidity (.sol) files
● Direct access to your deployed contracts
● Ability to import any contract dependency
INTEGRATION TESTS
20©ThoughtWorks 2019 Commercial in Confidence
● Written in javascript (.js) files
● Uses the Mocha testing framework and Chai
for assertions
NON FUNCTIONAL TESTING
21©ThoughtWorks 2019 Commercial in Confidence
NODE TESTING
● Network Handshaking
● Consensus Handshaking
● Chain Syncing
● Tools : eth-tester
©ThoughtWorks 2019 Commercial in Confidence
PERFORMANCE TESTING
● Network Latency
● Transaction Per Second (TPS)
● Block/Transaction Size
● Gas used per transaction
©ThoughtWorks 2019 Commercial in Confidence
SECURITY TESTING
24
● Access and Authentication
● Network Permissioning
● Wallet Signature Method
● Private Keys
● Smart Contract Owner
Verification
● Tools :
a. Solium
b. Solhint
c. openzeppelin-solidity
©ThoughtWorks 2019 Commercial in Confidence
THANKYOU
25
Preet G S Anand
APPLICATION DEVELOPER
preetgsa@thoughtworks.com | thoughtworks.com
©ThoughtWorks 2019 Commercial in Confidence
HIMANSHU PANDEY
APPLICATION DEVELOPER
phiman@thoughtworks.com | thoughtworks.com

More Related Content

PPTX
vodQA Pune (2019) - Insights into big data testing
PPTX
Etl engine testing with scala
PPTX
vodQA Pune (2019) - Design patterns in test automation
PPTX
vodQA Pune (2019) - Testing AI,ML applications
PDF
Performance Testing : Cloud Deployments
PPTX
C++ Webinar "Why Should You Learn C++ in 2021-22?"
PDF
Enabling Devops using Jenkins
PDF
Cloud-Native Progressive Delivery
vodQA Pune (2019) - Insights into big data testing
Etl engine testing with scala
vodQA Pune (2019) - Design patterns in test automation
vodQA Pune (2019) - Testing AI,ML applications
Performance Testing : Cloud Deployments
C++ Webinar "Why Should You Learn C++ in 2021-22?"
Enabling Devops using Jenkins
Cloud-Native Progressive Delivery

What's hot (19)

PDF
Free GitOps Workshop + Intro to Kubernetes & GitOps
PDF
Signalilo: Visualizing Prometheus alerts in Icinga2 - Icinga Camp Zurich 2019
PDF
Three Ways InfluxDB Enables You to Use Time Series Data Across Your Entire En...
PDF
The printing press of 2021 - using GitLab to publish the VSHN Handbook
PDF
Cas d'usage ProtoStellar Cloud replatforming de l'application 1Logistic pour...
PDF
[Webinar] Automating Developer Workspace Construction for the Nuxeo Platform ...
PDF
Making your app soar without a container manifest
PDF
Michael Hall [InfluxData] | InfluxDB Community Update | InfluxDays EMEA 2021
PDF
DevOps monitoring: Best Practices using OpenShift combined with Icinga & Big ...
PDF
GitOps (& Flux) for Helm Users with Scott Rigby
PDF
Monitor Kubernetes in Rancher using InfluxData
PPTX
THE STATE OF OPENTELEMETRY, DOTAN HOROVITS, Logz.io
PDF
Kristina Robinson [InfluxData] | Understand and Visualize Your Data with Infl...
PDF
Alex Nauda [Nobl9] | How Not to Build an SLO Platform | InfluxDays NA 2021
PDF
Spryker meetup-who-needs-products-in-spryker-anyway
PDF
DevOps: Coding Defines Monitoring
PDF
Designing a complete ci cd pipeline using argo events, workflow and cd products
PDF
CNCF Singapore - Introduction to Envoy
PDF
Evan Kaplan [InfluxData] | InfluxDays Opening Remarks | InfluxDays EMEA 2021
Free GitOps Workshop + Intro to Kubernetes & GitOps
Signalilo: Visualizing Prometheus alerts in Icinga2 - Icinga Camp Zurich 2019
Three Ways InfluxDB Enables You to Use Time Series Data Across Your Entire En...
The printing press of 2021 - using GitLab to publish the VSHN Handbook
Cas d'usage ProtoStellar Cloud replatforming de l'application 1Logistic pour...
[Webinar] Automating Developer Workspace Construction for the Nuxeo Platform ...
Making your app soar without a container manifest
Michael Hall [InfluxData] | InfluxDB Community Update | InfluxDays EMEA 2021
DevOps monitoring: Best Practices using OpenShift combined with Icinga & Big ...
GitOps (& Flux) for Helm Users with Scott Rigby
Monitor Kubernetes in Rancher using InfluxData
THE STATE OF OPENTELEMETRY, DOTAN HOROVITS, Logz.io
Kristina Robinson [InfluxData] | Understand and Visualize Your Data with Infl...
Alex Nauda [Nobl9] | How Not to Build an SLO Platform | InfluxDays NA 2021
Spryker meetup-who-needs-products-in-spryker-anyway
DevOps: Coding Defines Monitoring
Designing a complete ci cd pipeline using argo events, workflow and cd products
CNCF Singapore - Introduction to Envoy
Evan Kaplan [InfluxData] | InfluxDays Opening Remarks | InfluxDays EMEA 2021
Ad

Similar to vodQA Pune (2019) - Testing ethereum smart contracts (20)

PPTX
TWISummit 2019 - Blockchain in Enterprise
PPTX
Smart Contracts That Learn
PPTX
The Foundation of Smart Contract Development on Ethereum
PDF
Blockchain and IoT / Atlanta BlockChainConf
PPTX
Fullsize Smart Contracts That Learn
PDF
Javascript toolset for Ethereum Smart Contract development
PDF
The JavaScript toolset for development on Ethereum
PPTX
Understanding Ethereum: The Future of Blockchain Technology
ODP
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
PPTX
Ethereum Tutorial - Ethereum Explained | What is Ethereum? | Ethereum Explain...
PPTX
Ethereum in Enterprise.pptx
PDF
Developing Blockchain Applications
PPTX
Ethereum Part II: Smart Contract. DApps,EVM,Gas, ICO.pptx
DOCX
Dr. Michael G. SolomonBLCN 631 – Blockchain Implementati
PPTX
Ethereum
PDF
Building Apps with Ethereum Smart Contract
PDF
DevEx in Ethereum - a look at the developer stack
PDF
Interesting Facts About Ethereum Smart contract Development
PDF
Ethereum-Cryptocurrency (All about Ethereum)
PPTX
Creating Smart Contract
TWISummit 2019 - Blockchain in Enterprise
Smart Contracts That Learn
The Foundation of Smart Contract Development on Ethereum
Blockchain and IoT / Atlanta BlockChainConf
Fullsize Smart Contracts That Learn
Javascript toolset for Ethereum Smart Contract development
The JavaScript toolset for development on Ethereum
Understanding Ethereum: The Future of Blockchain Technology
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
Ethereum Tutorial - Ethereum Explained | What is Ethereum? | Ethereum Explain...
Ethereum in Enterprise.pptx
Developing Blockchain Applications
Ethereum Part II: Smart Contract. DApps,EVM,Gas, ICO.pptx
Dr. Michael G. SolomonBLCN 631 – Blockchain Implementati
Ethereum
Building Apps with Ethereum Smart Contract
DevEx in Ethereum - a look at the developer stack
Interesting Facts About Ethereum Smart contract Development
Ethereum-Cryptocurrency (All about Ethereum)
Creating Smart Contract
Ad

More from vodQA (20)

PPTX
Performance Testing
PPTX
Testing Strategy in Micro Frontend architecture
PPTX
Api testing libraries using java script an overview
PPTX
Testing face authentication on mobile
PPTX
Testing cna
PPTX
EDA for QAs
PDF
vodQA Pune (2019) - Browser automation using dev tools
PPTX
vodQA Pune (2019) - Augmented reality overview and testing challenges
PDF
vodQA Pune (2019) - Performance testing cloud deployments
PDF
vodQA Pune (2019) - Jenkins pipeline As code
PPTX
vodQA(Pune) 2018 - Consumer driven contract testing using pact
PPTX
vodQA(Pune) 2018 - Visual testing of web apps in headless environment manis...
PPTX
vodQA(Pune) 2018 - Enhancing the capabilities of testing team preparing for...
PPTX
vodQA(Pune) 2018 - QAing the security way
PPTX
vodQA(Pune) 2018 - Docker in Testing
PPTX
Mobile automation using appium.pptx
PPTX
An approach to app security - For beginners
PPTX
Retrospective
PPTX
Whys and Hows of Automation
PPTX
Test Automation Pyramid
Performance Testing
Testing Strategy in Micro Frontend architecture
Api testing libraries using java script an overview
Testing face authentication on mobile
Testing cna
EDA for QAs
vodQA Pune (2019) - Browser automation using dev tools
vodQA Pune (2019) - Augmented reality overview and testing challenges
vodQA Pune (2019) - Performance testing cloud deployments
vodQA Pune (2019) - Jenkins pipeline As code
vodQA(Pune) 2018 - Consumer driven contract testing using pact
vodQA(Pune) 2018 - Visual testing of web apps in headless environment manis...
vodQA(Pune) 2018 - Enhancing the capabilities of testing team preparing for...
vodQA(Pune) 2018 - QAing the security way
vodQA(Pune) 2018 - Docker in Testing
Mobile automation using appium.pptx
An approach to app security - For beginners
Retrospective
Whys and Hows of Automation
Test Automation Pyramid

Recently uploaded (20)

PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
A Presentation on Touch Screen Technology
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Mushroom cultivation and it's methods.pdf
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
1. Introduction to Computer Programming.pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
project resource management chapter-09.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Group 1 Presentation -Planning and Decision Making .pptx
TLE Review Electricity (Electricity).pptx
cloud_computing_Infrastucture_as_cloud_p
Accuracy of neural networks in brain wave diagnosis of schizophrenia
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
DP Operators-handbook-extract for the Mautical Institute
Unlocking AI with Model Context Protocol (MCP)
A Presentation on Touch Screen Technology
MIND Revenue Release Quarter 2 2025 Press Release
Zenith AI: Advanced Artificial Intelligence
Mushroom cultivation and it's methods.pdf
Chapter 5: Probability Theory and Statistics
1. Introduction to Computer Programming.pptx
A novel scalable deep ensemble learning framework for big data classification...
project resource management chapter-09.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
A comparative study of natural language inference in Swahili using monolingua...
gpt5_lecture_notes_comprehensive_20250812015547.pdf

vodQA Pune (2019) - Testing ethereum smart contracts

  • 1. GLOBAL SOFTWARE CONSULTANCY TESTING ETHEREUM SMART CONTRACTS By Preet G S Anand and Himanshu Pandey 1©ThoughtWorks 2019 Commercial in Confidence VodQA Pune 2019
  • 2. 2©ThoughtWorks 2019 Commercial in Confidence AGENDA BRIEF OVERVIEW OF ETHEREUM DAPP ARCHITECTURE AND TESTING COMPONENTS TESTING IN BLOCKCHAIN PARADIGM
  • 3. BRIEF OVERVIEW OF ETHEREUM 3©ThoughtWorks 2019 Commercial in Confidence Decentralized platform that runs smart contracts
  • 4. 4©ThoughtWorks 2019 Commercial in Confidence WHAT IS DLT? ● Distributed Ledger Technology ● Distribute the ledger across all nodes ● Every node has complete copy of the ledger, and all ledgers are always in sync
  • 5. 5©ThoughtWorks 2019 Commercial in Confidence WHAT IS ETHEREUM ? DISTRIBUTED PUBLIC NETWORK CONSENSUS ETHEREUM VIRTUAL MACHINE
  • 6. 6©ThoughtWorks 2019 Commercial in Confidence DISTRIBUTED PUBLIC NETWORK ● Ethereum is a peer to peer network, somewhat like a mesh topology ● Any new node can be added to this network ● Any machine which is part of ethereum network is a node ● There are three types of ethereum nodes: ○ Full node ○ Lightweight node ○ Miner node
  • 7. 7©ThoughtWorks 2019 Commercial in Confidence CONSENSUS ● Achieve agreement on a single data value in blockchain ● Involves reward for nodes which participate in consensus resolution ● Types : ○ Proof of Work (POW) ○ Proof of Stake (POS) ○ Proof of Authority (POA)
  • 8. 8©ThoughtWorks 2019 Commercial in Confidence ETHEREUM VIRTUAL MACHINE ● Ethereum is a programmable blockchain ● EVM is “Turing Complete” ● EVM is something which differentiates Ethereum with Blockchain ● Each and every node of the network runs the EVM and executes the same instructions
  • 9. DAPP ARCHITECTURE AND TESTING COMPONENTS 9©ThoughtWorks 2019 Commercial in Confidence
  • 10. DAPP ARCHITECTURE 10 HTML / JS / CSS Block EVM BLOCKCHAIN FRONT END BROWSER ©ThoughtWorks 2019 Commercial in Confidence API DB WEB3 API RPC Smart Contracts
  • 11. HOW IS IT DIFFERENT FROM A WEB APP 11 PARTY A PARTY B PARTY C ©ThoughtWorks 2019 Commercial in Confidence
  • 12. Different parts of Web3 API ● Node / Java / Python API ○ Uses Web3 library ○ Talks to blockchain via RPC calls ○ Provides wrappers over smart contracts ● Smart Contracts ● Database HOW DOES THE API LAYER LOOK LIKE 12©ThoughtWorks 2019 Commercial in Confidence API DB Smart Contracts
  • 13. WHAT IS A SMART CONTRACT ● Smart contracts is a misnomer. ● They : ○ Store rules ○ Verifies rules ○ Self execute rules ● Removes need of a middle man as they are self executing, ex: Vending machines ● Help in exchanging money, property, goods in a transparent, direct and trusted way. ● They are responsible for creating blocks in blockchain. 13©ThoughtWorks 2019 Commercial in Confidence
  • 14. SETTING UP A TEST ENVIRONMENT 14©ThoughtWorks 2019 Commercial in Confidence
  • 15. ● In order to communicate with the blockchain, we must use a blockchain client ● Geth is an ethereum client and is written in Go ● Enable you to connect with blockchain over RPC endpoint ● Provides API for account management,transaction management, peer management, debugging 15©ThoughtWorks 2019 Commercial in Confidence GETH
  • 16. 16©ThoughtWorks 2019 Commercial in Confidence ● Development environment ● Testing framework ● Asset pipeline for blockchains using the Ethereum Virtual Machine TRUFFLE
  • 17. ● Install truffle npm i -g truffle ● Initialise project truffle init TRUFFLE SETUP 17©ThoughtWorks 2019 Commercial in Confidence
  • 18. TESTING IN BLOCKCHAIN PARADIGM 18©ThoughtWorks 2019 Commercial in Confidence
  • 19. UNIT TESTS 19©ThoughtWorks 2019 Commercial in Confidence ● Written in solidity (.sol) files ● Direct access to your deployed contracts ● Ability to import any contract dependency
  • 20. INTEGRATION TESTS 20©ThoughtWorks 2019 Commercial in Confidence ● Written in javascript (.js) files ● Uses the Mocha testing framework and Chai for assertions
  • 21. NON FUNCTIONAL TESTING 21©ThoughtWorks 2019 Commercial in Confidence
  • 22. NODE TESTING ● Network Handshaking ● Consensus Handshaking ● Chain Syncing ● Tools : eth-tester ©ThoughtWorks 2019 Commercial in Confidence
  • 23. PERFORMANCE TESTING ● Network Latency ● Transaction Per Second (TPS) ● Block/Transaction Size ● Gas used per transaction ©ThoughtWorks 2019 Commercial in Confidence
  • 24. SECURITY TESTING 24 ● Access and Authentication ● Network Permissioning ● Wallet Signature Method ● Private Keys ● Smart Contract Owner Verification ● Tools : a. Solium b. Solhint c. openzeppelin-solidity ©ThoughtWorks 2019 Commercial in Confidence
  • 25. THANKYOU 25 Preet G S Anand APPLICATION DEVELOPER preetgsa@thoughtworks.com | thoughtworks.com ©ThoughtWorks 2019 Commercial in Confidence HIMANSHU PANDEY APPLICATION DEVELOPER phiman@thoughtworks.com | thoughtworks.com

Editor's Notes

  • #6: . Most popular implementation of DLT . Unlike bitcoin, which is only used to transfer coins, we can have a complete application deployed in ethereum . Ethereum is on a public network . Biggest differance is that data and code won’t be restricted to one party