FaaS + Blockchain: go serverless with an Ethereum NodeJS oracle

Why go serverless with FaaS + Blockchain?

Back in August 2018 Forrest Brazeal did an interview with former AWS Lambda GM Tim Wagner entitled “From Serverless to Blockchain”. They discussed the benefit of merging serverless computing and blockchain technology. These are the two main statements:

I really think that there are two disruptive technologies that are changing how we build and operate businesses. One of them, of course, is serverless.
The second technology that I think is really disruptive and has an amazing potential for impact is blockchain. Now, that one’s still very nascent.

According to Tim merging the capabilities of both blockchain and serverless computing will enable organizations to create “mutually trustworthy and enforceable contracts for a whole variety of goods and services”.

While Blockchain offers a transparent distributed data store with a really unique trust model a serverless computing offers a scalable and reliable execution of third-party code without a mechanism to create contractual agreements.

What known ways exist to go serverless?

The most obvious way of doing FaaS with Blockchain is to reuse existing contract methods. To simplify things you’ll now see the options available on the Ethereum platform:

Contractual Libraries

Sarvesh Jain perfectly enlisted all options you have when re-using code with Solidity’s Library contracts: instead of linking code libraries into your own smart contract’s code you can re-use deployed contracts by calling their API. The pattern is similar to a microservices structure in the non-blockchain world.

The flip side of this approach is the limitation of the programming language used to implement smart contracts. And Ethereum’s Solidity is developable. Just try to calculate the current date in years, months and days and you’ll write tons of Solidity code.

Old School: Oraclizing external resources

A more famous way of extending Ethereum’s blockchain borders is the use of an oracle. An oracle allows developers to access real-wold (aka non-blockchain) servers. Oraclize is one of the most-used oracles in the Ethereum world.

Typically Oraclize is used to read public data like exchange rates, weather information etc.

In his post Thomas Vanderstraeten showed that Oraclize can also be used to invoke serverless AWS lambda functions. In this case you develop a Java, .NET, NodeJS ect. function in AWS lambda, publish it and call it’s URL using Oraclize.

The flip side of this approach is that code which belongs to the smart contract is deployed outside of the blockchain.

New School: Do FaaS with a NodeJS Oracle

Lately I came across a new solution how to go serverless within Ethereum’s Solidity language. It’s an Ethereum based oracle called #SkriptIt which allows developers to integrade NodeJS code into Solidity and invoke it in a blockchain-external FaaS service.

It works like Oraclize but allows developers to embed JavaScript code directly into their contracts. The execution of the NodeJS code is pretty fast and the demo created by CaptainJS looks pretty straight forward (taken from here):


In late 2018 Vitalik Buterin said the following sentences in an interview:

The amount of sustainable usage of blockchain is very low. […] The main challenge for the industry as I see it is basically […] get to point where there is $200 billion in some sense of actual final value being generated.

I personally believe that blockchain and especially Ethereum is totally important for various industries. They are as important as databases are important for classic business models. The only issue is that blockchain platforms such as Ethereum are limited regarding its functionalities and especially its programming languagues. But in the same way stored procedures enriched databases in the last decades I believe that FaaS extensions will enrich public blockchain platforms.

So, when Tim Wagner says, that merging the capabilities of both blockchain and serverless computing will enable organizations to create “mutually trustworthy and enforceable contracts for a whole variety of goods and services” then an Ethereum based FaaS oracle will be the way to go.

And looking back at two years of dealing with Solidity, the NodeJS oracle created by CaptainJS seems to be the most promising one.

Next post: “How to make an Ethereum based contract smarter” by Torsten Langner https://link.medium.com/3Jhl3lC1QT