Writing a command line crypto tracker in golang — fochoc

Manuel Villing
Aug 31, 2018 · 2 min read

Why another crypto tracker

You could argue that there are already enough crypto trackers out there in the wild which is true. What distinguishes them from my command line tool fochoc is following:

Manual entry of transaction and balances — Instead fetches balances of addresses and syncs exchange balances. Example: You pull money from you cold wallet on an exchange => balances are in sync without intervention.

Rely on the app providers api / database — Instead of disclosing how much crypto you own, fetch balances from blockchain explorers and exchange apis directly.

Implementation goals

Before i started the implementation of fochoc i had some rough requirements:

  • use golang as language (for why see below)
  • easy extendable (exchanges, coins, tokens…)
  • good design (no one wants to use an ugly app)
  • doing CI with travis and appveyor
  • support for exchanges poloniex, binance, bittrex, kraken
  • support for coins / tokens ERC20 Tokens, BTC, LTC, DASH, STRAT, LUX, DGB, XZC, VIA, VTC, ETH

Flow

Here is a rough flow of how the app works

How the app works under the hood.

Why golang

The main reason for choosing golang was to try a new language, javascript is my daily bread, and i heard a lot good about golang from other javascript devs. Further things which stand out in my opinion are:

Cross compile without the need to compile on the respective platform — This is a huge plus coming from nodejs, where the user needs to have nodejs installed. Go is just spitting out binaries BOOM.

Golang KISS- Keep it simple stupid — Golang is one of those languages which are very easy to learn because of its simple syntax and the simple type-system. What also helped a lot is the tooling like go test + go vet

Download

You can download the source here: https://github.com/theotow/fochoc

Learnings

First of all i learned that parsing of blockchain explorers is not the best idea due to its error proneness but unavoidable due to lack of apis. All the major exchanges have pretty good api clients in all kind of languages which is very helpful. Integration tests where quite easy to setup but are improvable and could be partly mocked. Writing golang was enjoyable especially after the first release, refactoring and enhancing was easy due to strict typings. Performance is improvable, running more requests in parallel should do the trick.

Manuel Villing

Written by

#freelance #webdeveloper #nodejs #onlinemedienmanagment #javascript #design

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade