Web3 is booming, and Arweave is becoming a popular infrastructure choice for developers. PermaDAO is a community where everyone can contribute to the Arweave ecosystem. It's a place to propose and tackle tasks related to Arweave, with the support and feedback of the entire community. Join PermaDAO and help shape Web3!
Author: Kyle @ Contributor of PermaDAO
Translator: Kyle @ Contributor of PermaDAO
Reviewer: Xiaosong HU @ Contributor of PermaDAO
The Evolution of Cloud Computing and the Rise of Serverless
The Past and Present of Cloud Computing
Cloud computing is a computing paradigm based on the internet, where shared software and hardware resources are provided on-demand to computers and other devices as per the requirements, using the computing infrastructure provided by the service providers. — Wikipedia
In the past decade, cloud computing has gained prominence, becoming not only a crucial foundation for mobile and content services but also gradually replacing traditional enterprise computing environments. Servers, as the core of computing hardware, have diversified and evolved to meet various computing needs.
The origin of cloud computing is debatable, but many attribute its creation to Eric Schmidt, the former CEO of Google. He first introduced the concept of cloud computing at a search engine conference in 2006, and it has been around for almost two decades now. To trace the evolution of cloud computing, it has roughly gone through the following stages:
|Physical Servers||In the early days of the internet, web infrastructure relied on large, expensive, and hard-to-maintain physical servers, leading to issues like resource wastage and application conflicts.|
|Virtualization||Virtualization simulated physical server hardware through software, increasing program portability but still requiring consideration of hardware needs and operational costs.|
|Infrastructure as a Service (IaaS)||IaaS provides network, storage, and computing resources that customers use on-demand, reducing hardware management costs but still requiring infrastructure management.|
|Platform as a Service (PaaS)||PaaS is a service on top of IaaS, simplifying application deployment and management but sometimes restricting language, libraries, and functionality choices.|
|Cloud Computing||Cloud computing provides computing, storage, and services over the internet, allowing users easy access to and use of resources without depending on local devices, offering a flexible and convenient way for computing and resource management.|
In the era of rapidly advancing cloud computing technology, a natural outcome has emerged: Cloud Computing 2.0—Serverless.
Cloud Computing 2.0— Serverless
The serverless architecture was first introduced by Iron in 2012, but it gained recognition when Amazon Web Services launched Amazon Lambda in 2014. As a specific computing model within cloud computing, Serverless allows developers to focus solely on writing code without worrying about the management of underlying servers. The Serverless architecture consists of FaaS + BaaS.
- FaaS (Function as a Service): FaaS provides function-level computing services. Developers can write individual functions and trigger them when needed, with the cloud service provider responsible for managing the function's runtime environment and resources.
- BaaS (Backend as a Service): BaaS focuses on providing backend support services, such as databases, authentication, and storage.
Serverless has three core values: elastic scalability, usage-based payment, and operational simplification, making it considered the next-generation computing engine. As Johann, the author of the Serverless Whitepaper, points out—Serverless simplifies cloud computing programming, representing another revolution in programmer productivity, similar to the evolution from assembly language to high-level languages.
However, by reviewing the past of cloud computing and understanding the presence of Serverless, the author aims to facilitate readers' understanding of the next unfamiliar concept—Serverless functions.
Building Blocks of Serverless: Serverless Functions
Serverless functions are small, independent code units within the serverless architecture designed to execute specific tasks, typically triggered by events, without the need for server maintenance. They simplify development, reduce costs, and provide elasticity, and scalability, making them suitable for various applications.
Image Description: Components of Serverless Architecture
Specifically, the Serverless architecture includes FaaS (Function as a Service), allowing developers to decompose applications into independent functions, known as Serverless functions, while each function is hosted and automatically scaled by FaaS based on traffic demand, providing applications with greater elasticity and efficiency.
Serverless Functions and Smart Contracts
Smart contracts are automated contracts running on a blockchain. In contrast, Serverless functions offer flexible computing in a cloud environment, liberating developers from tedious server maintenance. However, despite operating in different domains, they share similarities—both are code snippets capable of automatic execution, driven by events.
Smart contracts and serverless functions are both innovative, but they each have limitations.
Limitations of Smart Contracts
Smart contracts provide a reliable, tamper-resistant execution framework, ensuring decentralized, transparent, and secure transactions through blockchain. However, they also face issues in terms of security, flexibility, and high costs.
- Security Risks: As the code is usually open source and cannot be modified, it may expose vulnerabilities that hackers can exploit.
- Lack of Flexibility: Due to the immutability of blockchain, updating or improving deployed smart contracts can be challenging.
- High Costs: Executing smart contracts may involve high computational resource costs, such as on Ethereum.
Limitations of Serverless Functions
The emergence of serverless functions has fundamentally changed how we build, deploy, and manage software applications. However, it still has some drawbacks, including:
- Cold Start Latency: When serverless functions are not called for an extended period, a cold start may occur. The system needs to reallocate resources and initialize the environment, causing delays in function execution.
- Difficult Debugging: Since serverless functions are event-triggered, the debugging process can be relatively complex. You cannot easily debug the entire application as in traditional local development environments because serverless functions are deployed in a distributed manner in the cloud.
- Vendor Lock-In: Using a specific cloud service provider's serverless platform may result in vendor lock-in. If your application relies on specific features and functions of a particular cloud service provider, migrating to another cloud platform may require significant rewriting and adjustments.
From the perspective of building Web3 applications, serverless functions do indeed offer a better development experience. However, besides the mentioned limitations, it also faces centralization issues. Of course, smart contracts also have many problems, and they often introduce centralized middleware to access external data sources. For developers, is there no better choice for building Web3 applications?
MEM——Web3's Serverless Functions Platform
The Molecular Execution Machine (MEM), introduced by the Decent Land Labs team, is an extensible Serverless Functions platform that supports Web3 based on the SmartWeave standard. It provides a gas-free smart contract execution environment, allowing developers to build and deploy Web3 applications without owning their servers, trustlessly on any blockchain. Additionally, MEM is not limited to serving Web3 applications; it can seamlessly integrate into the Web2 application technology stack.
MEM combines the scalability of serverless functions with the transparency of blockchain, enabling applications to maintain decentralization without sacrificing user experience. All of this is possible due to MEM's core features:
- Multi-Chain Authentication: MEM smart contracts can undergo authentication on multiple blockchain networks, including Arweave, Ethereum, Solana, Polkadot, ICP, and Tezos, achieving seamless interoperability.
- Blockchain-Agnostic Design: MEM is designed to be blockchain-agnostic, allowing developers to build applications without in-depth knowledge of the blockchain. Simply install MEM SDK or MEM CLI to start building applications.
- Secure and Isolated Runtime Environment: MEM provides a secure smart contract evaluation runtime environment, ensuring contracts are protected from potential vulnerabilities and malicious activities.
- Walletless interaction (Optional): MEM supports wallet-free functionality, meaning users can use the application without a cryptocurrency wallet, enhancing application usability.
Why Do We Need MEM?
In the process of building and advancing Web3 applications, we often face a crucial question: How can we ensure that applications maintain scalability and composability as user numbers continually grow? The commonly adopted approach is through "smart contracts + custom middleware." However, these middlewares usually run in the form of serverless functions on centralized Web2 cloud platforms (such as AWS Lambda), deviating from the core principles of Web3.
Image Description: Centralized Middleware
MEM Solution—Balancing Scalability and Transparency
When examining the construction of Web3 projects, we find ourselves in the Web2.5 era, still relying on centralized APIs and middleware. Even powerful traditional serverless functions platforms like AWS Lambda, when used as middleware, act as a closed "black box" for Web3, lacking external verification mechanisms for internal code execution and state.
At the same time, even running smart contracts on the widely used Ethereum Virtual Machine (EVM) cannot solve issues like performance limitations, poor scalability, and high costs.
Image Description: MEM vs EVM vs AWS Lambda
MEM provides a fresh solution to these problems, bridging the gap between scalability and transparency. MEM efficiently handles transaction information, promptly updates contract states, and permanently records them on the Arweave network. Anyone can independently verify the contract's results, ensuring public transparency and verifiability. Additionally, MEM's smart contracts can perform various operations like data-handling smart contracts using the Molecule library, enhancing scalability.
From a broader perspective, MEM brings many positive impacts to both the technical aspects of Web2 and Web3.
- From the Web2 Perspective: Unlike Web2 serverless functions, MEM functions are stateful and can quickly and accurately update smart contract states in response. Additionally, MEM improves efficiency through lazy evaluation, allowing anyone to verify if the contract state is complete and accurate. Most importantly, MEM inherits decentralization features from the blockchain and eliminates the high barriers of Web3 without requiring the use of encrypted wallets. In summary, MEM is also an ideal choice for the Web2 application stack.
- From the Web3 Perspective: In addition to the advantages mentioned earlier, MEM also possesses excellent flexibility, supporting cross-chain authentication and data invocation from any chain or API. Moreover, MEM is compatible with any programming language, significantly reducing developers' learning costs. Furthermore, developers can build applications with MEM without paying Gas fees, coupled with low entry barriers and other features, making it likely to be more widely applied in the future.
MEM Technical Architecture
MEM is built on the stack of molecules.sh, Arweave, and 3EM, implementing the Verifiable Atomic Computing Paradigm (VACP). By combining lazy evaluation, permissionless verifiable computing, and tamper-resistant data availability layers, MEM aims to maintain the integrity of core decentralization principles while addressing scalability and user experience issues.
MEM integrates a series of cutting-edge technologies to create a powerful and innovative development platform. Here are some core platforms and protocols that constitute the foundation of MEM:
- 3EM: 3EM is the execution environment for smart contracts within the Arweave ecosystem, characterized by high speed, security, reliability, and support for multiple programming languages. MEM utilizes 3EM to provide a runtime environment for smart contracts.
- Bundlr & Arweave: Bundlr efficiently packages MEM transactions onto the Arweave network, and Arweave serves as the Data Availability (DA) layer for MEM, storing data permanently to ensure security.
- everPay: everPay is a financial protocol with millisecond transaction speeds and zero gas. Integrated with MEM, it can create financial dApps with payment functionality.
- molecule.sh: The molecule. sh library extends native MEM functionality, acting as a bridge between MEM contracts and RESTful services, enhancing the scalability and flexibility of MEM applications.
- Supabase & Vercel Serverless Functions & PlanetScale: All three are key components of the MEM backend architecture, providing enterprise-level scalability for MEM and efficiently handling large amounts of data and transactions, offering users a good experience.
Verifiable Atomic Computing Paradigm (VACP)
MEM is the implementation of the Verifiable Atomic Computing Paradigm (VACP). VACP, short for Verifiable Atomic Computing Paradigm, is a novel scalability solution proposed by the Decent Land Labs team. It separates the computation and storage tasks in Web3 applications—off-chain computation, and on-chain storage, aiming to address scalability and user experience issues in Web3 while maintaining decentralization principles.
Key Elements of VACP
VACP provides Web3 developers with a robust framework that achieves both scalable and verifiable computation while maintaining decentralization, transparency, and data trust. This is thanks to the three key elements that make up VACP:
- Lazy Evaluation: VACP employs a lazy evaluation strategy, improving efficiency by decentralizing execution responsibilities to clients or intermediate layers. Clients no longer need to process all previous transactions to determine the current state but can execute contracts on demand. This approach maintains decentralization and trust while enhancing execution efficiency.
- Verifiable Computation: VACP utilizes an efficient centralized computation method, storing computation results on a decentralized blockchain, allowing anyone to verify the correctness of these results at any time.
- Tamper-Resistant Data Availability Layer: VACP utilizes Arweave as the Data Availability (DA) layer, ensuring the immutability of data, and thus guaranteeing data integrity and availability throughout the entire process.
In summary, VACP simultaneously achieves decentralization, scalability, and a good user experience by adopting the lazy evaluation strategy, enhancing efficiency. Since the choice is made to delay the computation result verification, data must be verifiable and trustworthy. Arweave, as an immutable and traceable permanent storage solution, is naturally adopted by VACP as the Data Availability (DA) layer.
Working Process of VACP
The working process of the Verifiable Atomic Computing Paradigm (VACP) roughly consists of two steps: uploading data to the DA layer and introducing a trusted third party to handle data tasks.
Image Description: VACP Working Process
Step One: Uploading Data to DA Layer
Data computation rules (smart contract/serverless functions code) and initial states are uploaded to the Arweave network. The initial state records all state changes that occur over time. These rules and states are uploaded for subsequent computation and verification.
Step Two: Introducing a Trusted Third Party to Handle Data Tasks
The trusted third party (TTP), also known as the Atomic Node, plays a crucial role, specifically handling tasks such as receiving user transactions, evaluating new states, and maintaining data caches. The trustworthiness of the TTP depends on its ability to honestly reflect the authenticity and validity of the data uploaded to the DA layer. The TTP needs to undergo verifiable computation checks by end users to ensure the integrity and accuracy of its operations.
MEM Operational Principle: Following VACP Principles
MEM follows the principles of VACP and is itself an implementation of VACP. Naturally, during its operation, MEM also possesses the three key elements of VACP—lazy evaluation, verifiable computation, and an immutable data availability layer.
The operation of the MEM system involves two core components: the processor (mem-core) and the orchestrator (Orchestrator). They play different roles, ensuring the normal operation of the MEM system.
- The processor is responsible for executing user transactions, updating smart contracts through lazy evaluation, and saving the latest state of the smart contract.
- The orchestrator serves as a transmission system, acting as a bridge between the processor and the DA layer, ensuring that transactions are successfully stored on the Arweave network.
MEM Working Process
When a user generates a transaction,
receives the transaction, recalculates the smart contract with the latest data, upgrades, and saves the latest state of the smart contract for users to verify at any time. Then, as a transport system, the orchestrator moves transactions generated by the processor to the Arweave network like a porter. Throughout this process, MEM ensures that the smart contract is always in the latest state, guarantees data trustworthiness, and acts as a trusted third party (TTP), achieving verifiable computation.
Additionally, the verifiable computation of MEM also requires adherence to some prerequisites—the source code of the smart contract must be compatible with
, and both must be stored on the Arweave network. Only in this way can it be ensured that executing the contract produces the same results whenever it is done
Use Cases of MEM
MEM adheres to VACP principles, bringing forth innovation and advantages, providing not only enhanced scalability but also improving the user and developer experience. In the Web3 space, the Decent Land Labs team has already built a series of core products based on MEM, including Arweave Name Service (ANS, Arweave domain protocol), Permacast (decentralized podcast protocol), Ark Protocol (Web3 wallet identity authentication protocol), and more.
Not limited to the Web3 space, developers in the Web2 space can also use MEM to build applications. Here are some representative use cases of MEM:
- Token-Gated Access: The application's UI submits data obtained from the blockchain network to MEM contracts, which are then stored on the Arweave network to provide precise declarations, and anyone can verify their validity.
- Decentralized Identity Management: MEM can be used to create a decentralized identity management system supporting multiple chains, allowing users to own their data and autonomously control identity verification permissions.
- Content Publishing Platform: Create a content publishing platform where users can publish and permanently store their content on Arweave. Data computation is handled by the MEM platform. Users can write, publish, and share articles while maintaining ownership and control of the data. The decentralized nature ensures data immutability and resistance to censorship.
- Serverless API Gateway: Utilize MEM's serverless capabilities to deploy API applications without gas fees, saving hosting costs. Additionally, developers can efficiently build API gateways using their preferred programming languages.
- Immutable Document Signatures: Leveraging MEM technology, users can sign and verify documents in a decentralized and immutable manner, ensuring the trustworthiness of the document signing process in Web2 applications.
Furthermore, the MEM team is developing xMEM for encrypting function code, input, and output data within MEM.
How to Use MEM?
MEM primarily targets developers and is currently in the testing phase, requiring developers to apply for whitelist access. Simultaneously, MEM officially provides comprehensive development documentation and toolkits to facilitate developers in writing, testing, and integrating MEM contracts. The content includes MEM development specifications, Molecules, MEM API, and MEM CLI.
- MEM Development Specifications: Content covers contract syntax specifications, contract specifications, transaction specifications, supported programming languages, etc.
- Molecules: This is a comprehensive developer toolkit and API for MEM developers, facilitating the integration of MEM contracts with any RESTful service.
- MEM API: MEM API follows the REST architectural style, providing endpoints that return JSON-encoded responses and adhere to standard HTTP response codes.
- MEM CLI: Developers can use the CLI to deploy MEM smart contracts.
- MEM IDE: MEM IDE is an immediately usable integrated development environment provided by the official platform, allowing developers to try MEM features and integrate them into projects.
Looking back at the development of internet technology at this moment, one can sincerely marvel. Humanity has been exploring new technologies to solve problems, bringing forth new issues, and then continuing to address these new challenges. Human society has been developing in this tireless exploration. The birth of the Molecular Execution Machine (MEM) has undergone the evolution of cloud computing and the rise of the new generation of serverless, leading to the development of the Web3 serverless functions platform.
MEM, based on the new paradigm of VACP, adopts the pattern of off-chain computation and on-chain storage. It has three key elements: lazy evaluation, verifiable computation, and an immutable data availability layer. It not only achieves scalability and verifiable computation but also maintains decentralization and transparency. As a powerful development platform, MEM allows developers to seamlessly build and deploy Web3 applications without delving deep into blockchain knowledge or maintaining their servers, using their familiar programming languages. Additionally, MEM provides developers with detailed development documentation and a complete toolkit.
MEM is a new choice under the existing "smart contract + middleware" framework and a powerful tool for developers to build applications. MEM is born to create a better future.