Transcription: Filecoin Virtual Machine 

Protocol Labs
Protocol Labs
·
Transcription: Filecoin Virtual Machine

The Filecoin network is blazing a trail as the go-to platform for storing and accessing NFTs, public good datasets, Web3, and Metaverse assets. It's not just a mere I/O layer of Web3 – Filecoin now has the potential to offer even more value by adding general smart contract
programmability.

Officially launched on mainnet on March 14, the Filecoin Virtual Machine (opens new window) is set to become the core component of the next stage of the decentralized storage ecosystem's evolution. By layering computation on top of storage, FVM opens up endless possibilities for cross-chain interoperability and integration in a completely trustless manner.

Excited to learn more about FVM? Our latest Transcription blog post features Molly Mackinlay, head of engineering, product, and research development; and Raúl Kripalani, lead engineer on FVM. This talk on FVM took place during LabWeek22 (opens new window) in October 2022, and while a few of the topics covered here may be behind us, much of the discussion is still relevant, and it's important to look at the steps that brought us to this important moment.

# The value of smart contracts - 0:05 (opens new window)

Hello, my name is Molly Mackinlay, the Protocol Labs EngRes (opens new window) lead. And this is Raul Kripalani, the Filecoin Virtual Machine (opens new window) (FVM) Project Lead and we're excited to introduce to you the most exciting new upgrade in Filecoin since the mainnet launch.

By this stage, I'm sure many of you have heard about the Filecoin Virtual Machine. Just to recap, the FVM project delivers on-chain programmability, aka smart contracts, to the Filecoin network. This is a big deal, because it enables developers to customize what the Filecoin network can do for its users besides storage and retrieval. Helping first-time developers to build — not with Filecoin, but rather on Filecoin as a platform.

"Smart contract values"

These are just some of the applications that we are personally so excited about: Data DAOs, liquid staking, storage-collateralized lending, decentralized compute and a lot more are possible with FVM. Let's dive into a few of these.

# How FVM leads to responsible data preservation - 1:17 (opens new window)

First: staking and loans. There's a huge opportunity for Filecoin token holders to put their resources to work within the Filecoin economy, helping Filecoin storage providers access FIL for storage collateral and offering interest in exchange. These loans can even be under-collateralized thanks to the on-chain storage history of past storage provider performance, which can be used to generate reputation scores that identify good borrowers. Loans can even be automatically repaid to investors by using a multi-sig as the storage provider owner address that includes lenders and a third party to help negotiate payback.

These new smart contracts give every token holder access to new yield opportunities on their token holdings, while also benefiting the whole Filecoin economy. For another example, we know that many data storage clients don't just want to store data for a year or two, they want to store it once and leave the long-term persistence problem to the network itself. Filecoin has always put control of data storage in the hands of individuals and clients, but FVM unlocks new opportunities. With FVM, perpetual storage becomes a simple smart contract on top of Filecoin's verifiable storage proofs.

Just provision a wallet with a storage endowment and set repair bots to monitor your data CIDs and storage deals, always making a new storage deal with qualifying storage providers whenever Filecoin's daily proofs of storage indicate a copy needs replication. This gives you the same long-term permanence that other blockchains claim, while also benefiting from Filecoin's verifiable storage proofs which ensure that your data is being stored and replicated correctly by the network, raising the bar for responsible data preservation everywhere.

FVM also unlocks new programmable storage tools that can offer multi-protocol storage retrieval, assurance contracts, data bounties, and many more. FVM is also unlocking a new way for the Filecoin ecosystem to monetize and coordinate. New ERC-20 tokens can be launched on top of FVM or bridge directly to token pools on other chains. And L2 networks can plug into Filecoin to benefit from its storage power and security.

# New tools governing data access - 3:40 (opens new window)

This gets even more exciting when you introduce data access controls. For example, a threshold encryption network, like Medusa (opens new window), can individually or programmatically govern who can access a data collection without any of the contract validators having the data's access themselves. This is even more exciting as a tool to power and govern data DAOs. The FVM allows a group of individuals or organizations to curate and preserve a collection of data, like a collection of NFTs.

"Governing data access"

These collections can also govern or monetize data access and pool the returns from data access into a shared DAO treasury to fund the collection's preservation and growth long term. You can even program your own smart contract to automate the growth and monetization of your data collection by generating and acquiring new data using that shared treasury.

This all helps power and harness step three of the Filecoin Master Plan (opens new window): to unlock compute over data stored in Filecoin to enable web-scale applications. Today, we have over 280 petabytes of data stored on Filecoin – nearly 9x what we had one year ago – and most of this is a valuable open source data like the collection of all NFTs, the million song data set, LANSAT, Folding@Home, Flickr Commons, Internet Archive and more. And these open data sets are a great opportunity to make available to compute networks helping avoid duplication of storage and computing resources.

Filecoin is already bringing this powerful new ecosystem to the rest of Web3, helping provide cheap storage and, soon, computation to the chain history of other networks. Solana, for example, is already backing up its chain state to Filecoin, but with FVM, we can actually become a data availability layer for Web3 that also provides long-term storage, decreasing the requirements for validators across the Web3 ecosystem.

We expect the Filecoin Virtual Machine to support many Layer 2 computation networks, either optimizing for verifiability through ZK proofs or privacy through fully homomorphic encryption or for specific use cases like image processing, ETL (extract, transform, load), or machine-learning pipelines. All of these together unlock a huge new opportunity for massive scale data science. Scientists can better collaborate on shared data sets, publish and earn rewards from valuable process data, and accelerate the global data analytics industry, which is expected to reach over USD $346 billion by 2030.

This new activity is going to increase the Filecoin chain activity massively, and we're getting ready for scalability demands with interplanetary consensus (opens new window): a new generation consensus construction that allows storing child chains and seamlessly transferring state from chain to chain. FVM, compute over data, and interplanetary consensus combine to meet the programmability, computation and scalability needs for web-scale applications to grow and thrive on Filecoin, like Twitter, Netflix, TikTok, Spotify and more.

Next, Raul is going to tell us more about how FVM is unlocking these epic new capabilities through its architecture, developer experience, and community growth.

# A new approach to architecture, developer experience and community growth - 8:15 (opens new window)

I'm Raul, the project lead for FVM, and today I'm going to go through the architecture, developer experience and the awesome community that is forming around FVM. Hopefully, you will get to be a part of it as well.

On the technical front, when we conceived FVM, we envisioned a system that could host multiple runtimes and serve as a seamless conductor between them. This is important, because blockchain runtimes are still developing very rapidly and they're harboring different developer communities that prefer different languages and approach things very differently. We don't know exactly which one of those is eventually going to win right now. The EVM is one of those runtimes that the community is really revolving around, but there might be other runtimes in the future.

In reality, all of these chains actually need these runtimes and the workloads and the programs running in these runtimes eventually need access to storage. Storage is such a core primitive in computing in general that you can't really decouple it from the blockchain. What we're trying to build – whether FVM is a multi-runtime environment such that these runtimes are developing – we'll be able to host them on the FVM and give them seamless access to storage.

To make this possible, we drew inspiration from the hypervisor model. The model of the hypervisor basically creates the underlying substrate that allows hosting these multiple runtime environments on top of it. Essentially, it virtualizes the machine. The actor model, on the other hand, is the interaction paradigm between the different workloads that would be running on top of these, on top of these runtimes and smart contracts.

On the other hand, we also drew inspiration from the Linux kernel itself, like isolation, how we manage and map memory, the environment storage abstractions and the way that workloads, programs and smart contracts are able to access those through syscalls.

# A deeper dive into the technical architecture of FVM - 11:50 (opens new window)

First of all, it is based on WebAssembly. We're using Wasmtime from the Bytecode Alliance in our reference implementation of the FVM. In the future, there might be more implementations of the FVM. We're excited to see more implementations of the FVM emerge. As Wasm itself is running at the hypervisor layer, the FVM can power multiple runtimes, like the EVM, Secure EcmaScript, and more, through the virtualization model. Each actor that runs on the FVM runs in isolation. It runs inside a sandbox and it can basically escape that sandbox by making syscalls. It's very much inspired by the Linux model.

A very important part of this is that all data managed by the FVM is actually content addressed data. Essentially all data — whether it's parameters, blocks storage, and so on — everything is IPLD data, which also models links between these different blocks, which creates a very powerful model, such that in the future, the FVM could support not just smart contract execution, but also more complex workloads going forward that operate on content-addressed data.

Two critical elements of the FVM is that it supports foreign addressing. This is important because when you're bringing in runtimes, they usually come in with implicit assumptions about how they address other smart contracts. For example, the FVM runtime uses 160-bit addressing. If we want to create that seamless conductor between runtimes to be able to support a multi-addressing model and that's basically why foreign addressing is such an important part of this.

The FVM also performs gas accounting and execution halt by instrument. What the FVM does is it meters execution and, currently, we're using that metering to determine execution. In the future, projects like IPVM from Fission (opens new window) can create a more generalized compute environment for content-addressed data. Those metering characteristics and those metering flows can be used for other things, for example, cost metering and charging the user for the execution of workloads, and so on.

Shipping the FVM itself is a hard engineering endeavor as it transforms the entire execution layer of the network. That's why we've been delivering this project in stages. Earlier in July 2022, we shipped the Skyr network upgrade (opens new window) to Filecoin mainnet, which installed the FVM on mainnet, meaning that everything that's currently running on mainnet is actually already powered by the FVM.

This is currently just built-in actors, because the FVM, as it stands in mainnet, is not programmable yet. The FVM core team is hard at work creating the programmability and adding programmability to the network. This is coming through the first programmability milestone which is 2.2. The first runtime that we are shipping is the Filecoin FVM, and this makes Filecoin entirely compatible with Ethereum. This allows Filecoin to meet existing Web3 developers where they are, because people get to reuse their existing knowledge of languages like Solidity, Yule libraries, like web3.js and ethers. Awesome tools like Truffle, Hardhat, Foundry and Remix just work with Filecoin, and another added benefit of this is that folks can deploy contracts that have already been battle-tested and audited heavily in the Ethereum network directly into Filecoin, giving rise to all these basic primitives, like ERC-20 tokens, NFTs, DAOs and so on pretty quickly in the Filecoin network.

This milestone required whole new protocol developments, like an address-class account abstraction and non-chain events. The Lotus (opens new window) client as of today already supports the Ethereum JSON-RPC API which enables existing Ethereum tools to interact with Filecoin without knowing that they are actually interacting with Filecoin. In the next month, we expect to finish the development of this Milestone 2.1 and as we get closer to the date we are lining up a set of hackathons (opens new window) so that developers can build on top of FVM.

We expect the FVM to hit mainnet by February 2023 and at that point, we will move our focus towards further protocol improvements and these are important to enable more powerful Filecoin applications down the road to support other protocol developments like IPC, interplanetary consensus.

# The next step: Meet Wallaby

I also wanted to let you know about Wallaby. Wallaby is our bleeding edge testnet. We've been incrementally delivering to Wallaby every week, sometimes even on a daily basis. It is operated by community members and it has a hosted RPC endpoint faucet and a wallet so you can just point at it and start hacking. It also supports the Ethereum JSON-RPC API for full compatibility with Ethereum and it's already seen hundreds of contract deployments throughout its various instantiations. In the next weeks, Wallaby would be promoted to a stable testnet, which we're building.

As we finish our incremental development on Wallaby, we will be promoting this unstable testnet Wallaby into building it. This testnet will not reset frequently. Resets and upgrades will be announced ahead of time.

The Wallaby testnet, as well as other Filecoin networks, can be added with a single click already. That can be added with a single click already by going to chainless.org. You just type in ‘Filecoin’ or ‘Wallaby.’ Make sure to activate testnets and with a single click you can just add it to your wallet, like, for example, Metamask.

# A closer look at various tools and the development experience - 17:30 (opens new window)

I wanted to showcase what the current development experience looks like with some of these tools. Metamask is the most popular wallet in the Ethereum ecosystem, where Ethereum Json RPC already supports Metamask. As of today, you can already perform value transfers contract calls contract deployments and even use the asset-tracking features of Metamask to track ERC-20 token holdings across various contracts on the Filecoin network.

Another tool that we have already tested and we're working extensively with is Remix. Remix is a lightweight ID that Ethereum developers have been using for a long time. Today, most developers use integrated plugins and IDs such as Visual Studio code and so on, but Remix still gets used quite a bit for casual coding. Thanks to the Metamask-Web3 integration, web3.js integration contracts written in Remix can be deployed straightaway into the Filecoin network and be inspected in various ways.

Another tool that we support is Hardhat. Hardhat is a very popular development environment for the developer toolbox and for Ethereum developers. If you want to get started using Hardhat on Wallaby, you can do that straightaway. Another thing that I wanted to highlight is that the reason why developers want to deploy on Filecoin is really to interact with this powerful storage system, the storage market, the storage provider lifecycle, the miner lifecycle and a lot more. Solidity is the most used Web3 development smart contract language, and we want to make it easy for contracts developed in Solidity to be able to use all those parameters that the Filecoin network provides.

So for this reason, we're developing a Solidity library with partners of ours that act as the glue between Solidity contracts and the Filecoin system itself. This library is called Filecoin.sol for now. It will basically allow you to easily call built-in actors to access convenient utilities and data types and also Filecoin primitives such as Randomness, cryptographic functions and a lot more. This library is currently being prototyped.

A critical piece of user and developer experience are block explorers. Block experience is essentially the window to everything that's happening on chain, and with the FVM, we might have the handicap of a new dimension of activity that's happening on chain and we're not able to introspect it or make sense of it. That's why we're investing early in the new set of new generation explorers. On the one hand, existing explorers are adapting themselves to FVM, like for example Filfox (opens new window), and there's a new set of explorers that are going to be emerging that are being developed by partners in the ecosystem like Filmine (opens new window), Glif (opens new window), Zondax (opens new window) among others.

Why so many explorers? Because each explorer is going to focus on a different side of the developer experience and the user experience. Over time, we expect that these functionalities will converge, but for now, we're very keen on exploring different models.

If you're excited about everything that you've heard and would like to get started building with FVM you should join The FVM Foundry (opens new window). There are more than 100 teams and builders that have registered to date and they're building amazing things. We run weekly sessions where you get access to the core team to support you closely and also dedicated channels so you can ask your burning questions and get answers very quickly.

I can guarantee you it's very fun, and it's great to see on a weekly basis all of the progress that the community is making, deploying, and experimenting — and really helping us test everything that we build. There are already tons of resources available today and there are more and more getting written and posted every day. You've got developer forums, videos, walkthroughs, blog posts and a lot more. We're looking for not just builders but also brilliant developers to join the ecosystem and to accompany us during this journey to write, to continue writing resources and helping out other developers.

Even if you don't have a Filecoin app in mind and you just want to join the developer community and help us test things out, write resources, educational material and so on, Early Builders is what you should join.

Thank you.