At Wasmer we recently did an internal hackathon to see how easy or difficult it might be to host an application with WebAssembly components on AWS Lambda. We split in two teams with the goal of making a funny project with actual software behind it.
In this article I’ll analyze what we built and what we learned along the way.
Coming up with novel ideas is notoriously hard, so we set the default challenge to be a "social network for pets", a funny enough premise but with some technical requirements:
The hackathon was time-constrained and we kept stumbling upon more obstacles and errors than we initially anticipated.
The one team successfully got code to run on Lambda, but their application fell short on features. The other team designed some backend features but because of technical issues could not get the lambda function running. Ultimately we were satisfied with the results and decided to merge the two concepts into one and build a more or less presentable version of it afterwards.
We built a social network for pets. The pets (i.e. user accounts) posted story updates (i.e. photos, likes, shares). Every story update is appended in a homemade "blockchain" running in WebAssembly in the Lambda worker. The app’s entire business logic is encoded in the game rules (see: below).
The toy "blockchain". Since it's not really decentralized (we're hosting one worker of it), there's no concept of mining or tokens, it is essentially just a Merkle Tree compiled to WASM. The WASM module receives in the chain state and outputs it without caring about storage.
Petstore Lambda chain: https://github.com/pitpet-xyz/petstore_lambda_chain
The integration for using the
blockochen.wasm inside Amazon Lambda. It's a Lambda function written in Rust with the
aws Rust sdk. It receives JSON requests, launches
blockochen using Wasmer and prints the results as an HTTP response. It stores the chain state on
s3 or on Lambda's
Pitpet web: https://github.com/pitpet-xyz/pitpet-web
Since the project was time-restrained, I chose to base the web app UI on a project of mine that already included the concepts of users signing up, posting stories, etc. It's a AGPLv3.0 Django app that powers the https://sic.pm link aggregator community. The original source repository is here: https://github.com/epilys/sic
Amazon Web Services are labyrinthian in scope. I use Firefox for my browsing needs and using the AWS Web UI seems not to support it. I had to download and install Chrome in order to use it.
The ecosystem of tools to work with AWS is plentiful but, diving in, you don't know what works and what not. Deprecated SDKs are not marked as deprecated and official guides for them still exist online.
cargo-lambdafor building/bundling lambda functions.
boto3, the AWS SDK for python3.
AWS website is information dense that requires familiarity with its Vendor technologies and services in order to successfully make something. I encountered:
Error: fork/exec /var/task/bootstrap: permission denied(solution: reupload the
An unfamiliar workflow.
Ultimately, we completed the app successfully and gained a greater appreciation for what developers and DevOps engineers must go through daily. The most important lesson learned is that deploying serverless applications to the cloud is tough.
A lot more work is needed to simplify building and deploying applications securely and at scale. We learned a lot, and we're excited to take our learnings and turn them into amazing new products and features for the Wasmer and WebAssembly ecosystem.
All user interactions in pitpet.xyz go through a set of rules that make up the pitpet game.
(Note: Everything in italics was not actually implemented.)
The average Tamagotchi lifespan is around 12 days, with the lowest around age 7 and the highest around age 25
Syrus Akbary is an enterpreneur and programmer. Specifically known for his contributions to the field of WebAssembly. He is the Founder and CEO of Wasmer, an innovative company that focuses on creating developer tools and infrastructure for running WebAss
Founder & CEO
Syrus AkbaryAugust 19, 2022