Blockchain is the Ultimate Serverless Platform


Serverless computing is the hottest topic in cloud computing today. The original Amazon Web Service (AWS), S3, is serverless. It acts like an elastic and limitless storage space for digital data. You can use it anytime you want, and only pay for what you use. There is no need to worry about servers, disks, backup devices, or software to drive all of these. This leads to the term utility computing, where computing resources are available like electricity. You can turn it on at any time, consume any amount you like, and pay for what you consume.

However, somewhere along the way, the Internet has changed for the worse. The peer-to-peer infrastructure (think email and ftp) is replaced by centralized organizations (think Facebook and Dropbox). The reality of cloud computing also becomes “virtual machines on demand.” Even in the cloud, we still need to manage our servers and all the software complexities that come with those servers.

Serverless & FaaS on the Rise

Changes are coming. Function-as-a-Service (FaaS), such as AWS Lambda and Azure Functions, are making it easy for developers to deploy code (i.e. functions) without worrying about the operating system, virtual machine, or hardware. The code just runs. It scales according to the demand. And you pay based on the actual usage. In fact, according to a large survey, over 50% AWS users are already using Lambda FaaS. Serverless FaaS is extremely popular.

Yet, is AWS Lambda the right technical approach for cloud native serverless computing? One might argue it is far from it. Today’s cloud FaaS depends on software containers like Docker to spin up servers and to deploy software before it can run the service function code. It starts slow (the infamous cold start problem), has a lot of overhead (an entire OS and stack just to run a single function), and often requires explicit management of server resources (so much for serverless).

Server Lessons from Blockchain

Outside of the world of big tech, we have an alternative universe of decentralized web. Blockchain and cryptocurrency platforms are often constructed as true serverless FaaS platforms from the get-go. After all, no one is responsible for “servers” in a decentralized blockchain network. It is designed to be trustless. Blockchains provide valuable lessons on how to do serverless the right way.

To understand these points better, we need to know a little background of blockchain as a platform:

  • The first generation of blockchains are decentralized ledgers that allow untrusted parties to reach consensus on cryptocurrencies. The most famous is Bitcoin. The cryptocurrency is the application.
  • The second generation of blockchains aim to become general computing platforms. They allow untrusted parties to run the same code and reach consensus on the execution results. The most famous is Ethereum.

In Ethereum, and similar blockchains, we can submit functions (known as smart contracts) to be executed by the network as a whole. There is no concept of individual servers. The blockchain network charges a “gas fee” in cryptocurrency for executing the functions in smart contracts, and distributes the gas fee to individual nodes that participate in the computation. The gas fee is measured by ops code in the compiled bytecode and the storage space the function consumes. It is far more precise than any cloud provider today.

Smart Blockchain contracts meet most of serverless features defined by Mike Roberts, co-founder of Symphonia, a serverless and cloud architecture consultancy.

  • Requires no management of Server hosts or Server processes. Just submit the code to any node on the blockchain. All nodes will run this code and put the results in the next block.
  • Self auto-scales and auto-provisions, based on load. This is difficult on a blockchain network as scaling is not a focus of blockchains. Correctness and consensus are required on the blockchain.
  • Offers costs based on precise usage. The gas fee is the ultimate measure of precise usage.
  • Has performance capabilities defined in terms other than host size / count. The performance capabilities of the blockchain depends on how fast the node can reach agreements in the consensus protocol.
  • Has implicit High Availability. Blockchains are decentralized and distributed. This means they cannot go down for regional and vendor-specific outages.

However, blockchains are not known for their high performance. Smart contracts on today’s public blockchain networks have difficulty scaling to even 1,000 transactions per second. Scalability and performance are where traditional cloud computing excels. We can have much better serverless experiences when we use blockchain technologies—such as WebAssembly-based runtimes, stateful execution, and gas computation—in traditional cloud architecture. For example, we can run Rust functions as services in a Node.js host environment.

Besides serverless, there are many ways technologies developed in the blockchain community can benefit the broader tech community in general. It pays to learn blockchain development!

Leave a reply

Please enter your comment!
Please enter your name here