The logging mechanism in Ethereum provides a great way to provide finer grained interactions for dApps. Up until now I've only really seen it exploited in Web apps. I wanted to create a server side dApp.
What it does
This is a proof-of-concept of how to do it. In this case I send the events for ERC-20 transfers and Mint and Burn operations from the DAI contract and post it to a slack channel when a message is posted noting that tokens moved or were minted/burned.
How I built it
First I used ethercast.io as the source of the Ethereum events, limited in scope to mainnet DAI contract log events. From there the webhook dispatches to a serverless application on Google Cloud. That serverless invocation then decodes the binary of the event and dispatches a message to the slack server I have set up.
Challenges I ran into
I wanted to do it on azure, but deploying to azure with node.js on windows burned an hour of my time with all the installs and I gave up and switched to GCP. The irony is if I were developing on Linux or Mac I wouldn't need all that setup for authentication.
I needed a webhook source and not a websockets source. None of the typical ethereum data sources (Infura, my own geth node, a parity node. etc) directly support webhooks. None of the serverless providers support websockets (state based connections are counter to the serverless philosophy). Ethercast.io was the only ready made solution I found.
Then ethercast.io had stalled on a difficult block days ago. I emailed the team and Moody Salem firstname.lastname@example.org unwedged the server and got me back up and running.
Then the current beta of web3 has some node.js deploy issues, I locked into a previous version.
Then there wasn't an emoji for a paper check. And yet half the telephone emojis have a rotary dial. I made due with a credit card.
Accomplishments that I'm proud of
Before this weekend I had not deployed a node.js app, and I haven't deployed on the public Google Cloud before, and I haven't deployed a serverless app. Surprisingly it all went basically to my vision.
What I learned
DAI moves a whole lot of ether and tokens. Way more DAI is minted than burnt at the moment.
What's next for Topicless
The future lies in the hands of the service providers.
ethercast.io said they will be releasing their code at the end of the month, the vibe I get is that they may not be a commercial venture.
Infura could add a webhook API. This would be a step beyond simply hosting geth nodes and would provide a value add.
The big vision is that the cloud serverless providers (Amazon Web Services, Microsoft Azure, Google Cloud) will provide blockchain events (transaction, chain, and smart contract events from top blockchains) as triggers for their serverless offerings. They have integrated platform specific sources and web hooks, shared protocol sources are a logical next step.