As you might have noticed, we recently dropped a new app: The Watcher.
This macOS app lives in your status bar and monitors gas prices, ETH prices, as well as the ability to monitor wallets for incoming transfers of ERC20 & ERC721 tokens.
How does The Watcher work?
The Watcher lives in your status bar as a menu-based app. While running, the app updates the gas & ETH/USD sections every 5 minutes, and it updates the watched wallets section every hour. The app uses Daniel Gindi’s Charts library to render the gas & ETH/USD trends – we liked this library for its simplicity & how customizable it could be. Outside of a few third party libraries, the app is written in Swift and utilizes SwiftUI for building the user interface.
Occasionally, you might notice a little gap in the gas chart in particular. We will take whatever data we can get from GasPrice.io, but then we will add in the current gas price at the current time, which can cause a little data gap.
Where does The Watcher source data?
Initially, this experiment started off solely with “web2” style APIs. We polled GasPrice.io for current gas & historical gas trends, CoinGecko.com for ETH to USD prices, and a combination of APIs from Etherscan & OpenSea to monitor wallets and for ENS resolution.
We made a move to try to use web3 directly as much as possible, and with that in mind, we transitioned to use the blockchain directly to resolve ENS names, monitor wallets, and see what current gas prices are (using Infura.io as a gateway & the web3.swift library from Argent Labs). We maintained the use of web2 style APIs from GasPrice.io for historical gas, as well as CoinGecko.com for ETH to USD prices.
What data does The Watcher store? You aren’t spying on me, are you?
No, we’re not spying on you while you’re creeping on others! 😹 We don’t send any of the specific information about what wallets you’re watching anywhere. You don’t have to create an account or connect your wallet to use The Watcher.
We do store a bit of data locally via macOS “defaults” in order to personalize the app for you. This ranges from the list of ETH addresses you follow to your notification preferences. If you are comfortable with the Terminal app, you can check what we’re storing at any point via the command `defaults read io.galactic.web3console`. But this data is not saved to Galactic’s servers.
We also use a 3rd party analytics service to help us gauge success of the app, but we don’t share any sensitive data with them. For example, the addresses of your watched wallets are not shared, but we do share the number of wallets being monitored by that instance of The Watcher.
Making The Watcher available via Homebrew
One of the ways to deliver apps to users is Homebrew. Homebrew allows users to install apps via command line. Surely this way of installing apps has a certain crowd, like the programmer or hacker or someone that is allergic to a mouse. We want to make The Watcher available to all kinds of users.
The first thing we did is to create a separate deployment path for the app in Xcode.
Once we built the app, we submitted to Apple to be validated (notarized). Follow this guide on how to do it.
After this process is done, your app is ready for distribution. Export the app from Xcode and compress the file (zip or tar). You’ll need to get the checksum of this zip file to use in the cask file later. Create another file that contains information about the version number. This file can be a .json, .html or a simple .txt file. We choose the latter. Put the zip file and the version file somewhere on your server where they are accessible from the world.
Creating the cask file is trivial. We followed the guide from https://docs.brew.sh/Cask-Cookbook. Also ensure that you are set up to fork the Homebrew/homebrew-cask repo to create a pull request for your new cask. Here’s The Watcher’s cask file (the-watcher.rb):
Don’t forget to run the audit and style tests that are required for your pull request. You can run them by using
brew audit --strict --new-formula --online <cask> and
brew style <cask> commands respectively.
If everything looks good, submit your pull request. Make sure to do the checklist for the pull request.
Wait for it to be merged by the Homebrew crew. And that’s it. Your app is available on Homebrew.
Last thing, tell all your friends to install your new app, or The Watcher app by typing
brew install the-watcher on their terminal. Watch it! It works for real.