Author: Sam French

Ethereum Lottery Example Part 3: Collecting an Entrance Fee

See Part 2 Here Code Change: https://github.com/samuelfrench/solidity-lottery/commit/96c1763400c3b0f8603695ee4d4e4ef537f98df8 Changelog: Add balances mapping to have a constant-time way to look up entrants Make enter a payable function to accept an entrance fee Check entrance fee Check balance to see if they’ve entered before Add getLotteryBalance for debugging Update solidity version (not shown in commit) Add override modifier […]

Ethereum Lottery Example Part 2: Participant Aggregation and Winner Selection

Part 1 of this series: Ethereum Lottery Example Part 1: Setting Up Environment Develop Functionality to Randomly Select a Winner Before we jump into handling the monetary or scheduling part of things, let’s break this project down by first implementing and manually testing a contract that is able to aggregate a list of lottery entrants, […]

Ethereum Lottery Example Part 1: Setting Up Environment

Recommended Prerequisites To get the most out of this example series, it’s best to have a general understanding of: Blockchain Basics The Ethereum Virtual Machine Step 1: Open Remix https://remix.ethereum.org/ Remix is a web based IDE allow us to develop and execute the Ethereum contract we are developing using the Solidity language. I recommend using […]

Getting Real-World Test Data from Production

Why? To responsibly test changes before deploying them to production, we need a test environment that behaves, in as many aspects as possible, the same way as our production environment does. Integration tests should be running in an environment that is as close to production as possible. We want the ability to reproduce production issues […]

Extract Method and Inline Variable in IntelliJ

Introduction This blog post will show, using videos, how to perform basic refactorings in IntelliJ. I’m using the IntelliJ 2020 community edition and OBS Studio to create these videos. The philosophy contained in these articles will largely be drawing from my favorite book on refactoring: Refactoring: Improving the Design of Existing Code by Martin Fowler. […]

Suppressing Static Initializers with Mockito + Powermock

Often as developers, we need to add unit testing to legacy code while being unable to make non-trivial changes to the code under test. In legacy code, logging and other resources are often set up in a static initializer. That code won’t execute nicely in a unit testing environment (could be using JNDI or something […]

Testing vs. Alerting Part I

If you want to evaluate a testing plan, you must also consider your alerting plan. Alerting and testing are complimentary, both serve to identify defects. Testing typically serves to identify defects before code is deployed to production, while alerting typically notifies developers of an issue with a running system. You need to consider both testing […]