project screenshot
project screenshot
project screenshot
project screenshot
project screenshot
project screenshot

ChainStatements.com

ChainStatements.com is an API platform to deliver PDF account statements for blockchain addresses.

ChainStatements.com

Created At

ETHSanFrancisco 2022

Winner of

trophy

🥈 Covalent — Best Use

Project Description

ChainStatements is an API platform to automate, generate, schedule and delivery account statements, reports, and other records and receipts of on chain activity for specific user wallets. This is a solo hack!

Although I plan to add a dashboard and user interface in the future, for the SF ETHGlobal hackathon, I decided to focus on a solid off-chain backend and scalable design. In the interest of time, I only did a proof of concept of the JSON template, JS filled, PDF report designs during the hackathon.

My primarily focus was building out support for querying Covalent's REST API and generally show a proof of concept for the PDF generation.

The initial API is a REST API but the scaffolding is already in place for a GraphQL endpoint.

API users can make requests to:

addAddress( ) removeAddress( ) checkAddress( )

It currently support Daily, Monthly and Annual statements. Socketlabs is integrated for email sending.

All requests to send a report or generate a PDF are queued to a SQS queue in the AWS environment. The architecture was designed with a nod to microservices. We are using Queues and the AWS Lambda serverless platform for all computing.

The SQS Queue is service by a Lambda called ChainStatementsSqsHandler which is called whenever a message hits the queue.

Cron scheduling handles the timers with AWS Eventbridge. This framework give us a simple way to add automaton in the future. The serverless approach allows ChainStatements to scale up to meet demand and we don't keep servers idling when they are not processing timers or other scheduled event. CronMonthlyStatementService, CronDailyStatementService and CronAnnualStatementService are functions that are triggerd by Eventbridge.

The entire platform, with the exception of the creation the SQS queues, was setup and deployed with the Serverless Framework, which handles generating the Cloudformation YAML.

Future integrations would be permissionless, no-email, using XMTP or Push Protocol.

The Typescript covalenthq-api module will be in npm in a 0.0.1 release in the next day or so.

How it's Made

This project uses the Covalent REST APIs. I built a Typescript interface that will be separately added to npm in the coming days. Initially I only covered the Class A endpoints.

In my project, ChainStatements, I used the Get Token Balances endpoint and the Historical Portfolio.

I deployed 7 AWS lambda functions to implement my REST API for ChainStatements. The project scales by putting all the processing in a lambda that triggers from an SQS Queue.

I used postman and clouddash for testing my serverless APIs. For generating PDF statements from Ethereum addresses, I used a npm library called Hybiscus. For email sending I integrated with SocketLabs.

background image mobile

Join the mailinglist

Get the latest news and updates