Decentralized Apps Development Club Session 5

Author: Singaram
Sector: News
Industry: Events

On the 30 Apr 2019, I was privileged to attend the 5th session entitled Testing Smart Contracts by the newly started Decentralized Apps Development Club (DADC), from 6.30pm to 9.30pm at BitTemple, 5F Republic Plaza.


All pics in this article are from DApps Dev Club

What is DADC?

DADC is a twice a month technical book club, started by software engineer Brendan Graetz, and CTO of blockchain consultancy Baypay Inc Kenneth Hu. You can check out their website here. These sessions draw their source material from the book: "Mastering Ethereum" by Andreas Antonopoulos and Gavin Wood and Brendan blogs , tweets at @bguiz and works as a Senior Software Engineer at Autopilot. He started DADC to teach the public about the underlying tech behind blockchain and development of decentralized apps. Kenneth brought in his expertise in organizing meetups, being the founder of the Blockchain & DApps meetup group. and medium group. His LinkedIn


Microsoft, Chainstack, Acronis, Lifelong Learning Institute, BitTemple, National Blockchain Challenge (NBC) '19, Spartan Group, StartupToken, CryptoJobs List, Engineers.SG and Blockchain&DApps have worked together to make this happen.

How did I get to know about this?

Brendan and I are in the organizing committee for the 3-day NBC ‘19 from 14 to 16 June, comprising a few blockchain and innovation masterclasses and panel discussions, a 2-day hackathon targeted at tertiary students and a career fair hosting various blockchain and tech organizations (one can sign up as a participant or email your interest to be a panelist/judge at

How was the event?

Brendan is an impressive teacher – clear and brisk. The audience, from various tech/blockchain companies and educational institutions, loved this initiative and his clear teaching! What’s more, he had volunteers from the SingaporeJS community to guide beginners like me and a chat group within the DADC attendees to clarify their doubts.


The topic and scope of the session

I was filled with awe as I sat in for the Testing Smart Contracts session which, though may seem advanced to many newbies, is actually Blockchain 101. In fact, the entire series covers the basics and that is the intent - they do not go into anything advanced, except perhaps as the stretch goals. The primary discussion of the session revolved around smart contracts. Smart contracts execute themselves as per terms between all those who interact with it, directly written into code and are incorruptible as they are based on a blockchain - an immutable distributed ledger. Smart contracts enable tracing, transparent and irreversible transactions. They are particularly useful in applications such as voting, where incorruptibility is essential. Previous sessions had included writing smart contracts in Solidity, a programming language for the Ethereum Virtual Machine, and used truffle (a framework) to deploy them onto a local blockchain. This session would continue to use truffle, but this time using its test runner capabilities. It would also need some prior JavaScript expertise, as it would involve writing tests in Mocha ( which truffle’s test runner is 99% based on) for testing data storage, state machines and events besides mocking smart contracts.

The session gets underway

Brendan began by explaining the features of the git repository and suggesting the downloads of NodeJs, Github, solc, truffle, and ganache. Ganache is a simulated blockchain network - if one were to connect to a physical blockchain network, he/she will be slower and will need to pay, as opposed to the free Ganache and Truffle test. He/she can also connect to a real Ethereum network, though many people prefer not to spend money at the testing phase.


Brendan showed how to test code for a smart contract within a sandbox. Comprising six hands-on exercises, Brendan went through the various concepts thoroughly, and at a good pace. The first lesson learned, was that false positives may occur, where both the testing and implementation carry the same error – this leads to the error being undetected. One solution is to conduct more tests. Brendan also taught how to come up with test cases. Ideally, they should cover as many paths through the code as possible. For many scenarios, however, it is impossible to write an implementation – for instance, you can’t connect to the real database, and hence, you must mock the database. Furthermore, Brendan explained how to write tests in ways that would resist external changes - for example, when running them on a different computer, or after connecting to a different Ethereum network. The event ended with a session where people could come and pitch themselves/their events!


Quick recap

Brendan covered Mocha in isolation with vanilla Javascript. This included: writing test cases for very simple functions Implementations and specifications If either is wrong, the assert code will highlight it. If they are congruently both wrong, creating a false positive, the only way to detect this would be to conduct more tests. He then covered the Truffle test, which is 99% mocha and 1% of new things specific to smart contracts, such as artifacts, along with Ganache: A storyline to illustrate truffle test runner including creating and operating car objects. BN.js Injecting the accounts into a contract block Clean room environment that the contract block provides.

What’s on for session 6?

The next session 6 on 14th May at 6.30pm at Chainstack@Acronis will be about how to test smart contracts and how to build the frontend part of a decentralized application. An example of a DApp was covered in session 2 - an Ethereum-based simple app that sends messages to the network. Attendees are requested to brush up on Javascript again! This can be done through Scrimba, or freeCodeCamp in order of increasing time commitment required!

For the more advanced attendees...

Additional challenges on property-based testing and mocking Solidity were given!

Overall experience

I was astounded by how much of expertise in blockchain both the speakers and members of the audience had, judging by the depth of questions asked. They were really helpful, hanging around for more than an hour after the event ended to shed more light on blockchain for me. In this fast-changing world where blockchain is silently becoming more pervasive, it is great for all to have a deeper understanding of it and let our creative sparks fly on what we can do with it! Hence, I would DEFINITELY RECOMMEND all to attend this technical book club DADC every second and fourth Tuesday evening of the month! If you are worried about catching up on what you’ve missed in the past, the videos are uploaded on and are in fact, streamed on Engineers.SG!


Related upcoming events

  • 9 May, Thursday evening, from 7 pm to 9 pm at Sakae Fintech: Pre-hackathon meetup and briefing for tertiary students interested in the 3 day National Blockchain Challenge 2019 masterclasses, hackathon, panel discussions, and career fair, to learn from the best of the best! Registration is free, so do share with your friends and don’t miss out on a golden opportunity.
  • 9 May, Thursday evening, from 6 pm to 9 pm: Hyperledger Singapore Meetup at Ayer Raja Crescent Blk 73B, The meeting point, S139952 14 May, Tues evening, at 6.30pm at Chainstack@Acronis: Session #06 of DADC

  • News by sectors

    Card image cap
    Electronics business news

    Financial news about publicly listed comapnies in electronics sector.

    Card image cap
    Basic Materials business news

    Financial news about publicly listed comapnies in Basic Materials sector.

    Card image cap
    Industrials business news

    Financial news about publicly listed comapnies in Industrials sector.


    Card image cap
    Technology business news

    Financial news about publicly listed comapnies in Technology sector.