DriversWork ExperiencePersonal projectsTimelinePublicationsThis site

Personal projects

Splinterlands card game bot

Project started: May 2022

Splinterlands is a blockchain card game. A game consists of a ruleset which restricts what cards can be played as well as adding and altering some of the game's mechanics. Two players then select a team of up to seven cards which then battle it out and the last one standing wins. Because the game is based on a blockchain the development team behind it are relaxed about users using bots to automate play.

Because of the rulesets, there are many different strategies and possible team combinations, it is not always clear which team is optimal. For this reason I thought it would be fun to build a bot to play my matches for me. This would also help gain insights into the relative power levels of different cards and strategies.

Being a web based blockchain game means that interactions with the blockchain are signed by open source libraries which are fairly easy to implement. The game also have a js library avoiding the need to reverse engineer what API calls need to be made. There is also an open source battle simulation library which is reasonably accurate.

The bot I built has a database of possible teams. The backend filters these teams to a valid subset based on the current games ruleset. The frontend then filters these further to a more manageable number of teams. In a webworker, a round robin is played between all the teams and the team with the most wins is then submitted as my entry. The webworker allows for the expensive team comparison computation (~10-20 seconds) without freezing the frontend.

Team selection
Round robin results
Splinterlands bot UI: Left, team selection menu. Right, round robin results with the top team being the best.

Teams can be imported from games or generated manually.

Tech stack summary

  • next.js app
  • functional react frontend
  • web-worker for long team comparison tasks to avoid blocking the frontend experience
  • backend interacts with a mongodb database

Plotting Library

Project started: September 2021

source code and examples

I started designing and building a generalised plotting library for use in the cryptocurrency portfolio tracker and other projects. This library is influenced by react-vis which is no longer maintained. The code is functional react and relies on some d3 utility functions for things like scales.

Cryptocurrency Portfolio Tracker

Project started: Sept 2021

I built an asset portfolio tracker to track assets across centralised exchanges and different blockchain accounts. It also calculates arbitrage profits and asset appreciation separately.

Tech stack summary

  • functional react frontend
  • express.js backend
  • local mongodb server to store portfolio and price history

Cross exchange arbitrage

Project started: July 2021

I built a simple arbitrage bot for profiting in differences in prices between centralised cryptocurrency exchanges. This is a frontend bot for ease of development and reviewing trades. It works by opening buy and sell orders a fixed percentage away from the buy/sell price of other exchanges. When a bid is filled the bot figures out which exchange is the most cost effective to do the inverse trade and then makes a market buy/sell to reverse the trade and keep the ratio between the asset pair fixed.

The backend accesses each exchanges trading API using personal access tokens imported from environment variables. It then exposes a standardised API to the frontend for each exchange.

Tech stack summary

  • functional react frontend
  • express.js backend, which transforms exchanges API's to a common format
  • exchange API websocket to common formatted websockets for real time updating

On-chain arbitrage on a public blockchain

Project started April 2021

I discovered a profitable on-chain arbitrage trade between a contract running an order book and another running a liquidity pool. Arbitrage trades are essentially profitable wash trades where you exchange one asset for another at one exchange and then do the reverse trade at another, with the result being you end up with the asset you started with plus a small profit.

I was curious if I could automate this, and set about creating a simple react app to exploit this trade. My simple bot ran successfully for around three months before being consistently beaten by more sophisticated solutions.

Tech stack summary

  • functional react frontend
  • blockchain APIs, and wallet interface APIs