All posts
cover image
MUD v2 is ready
3 months ago By
Lattice

A few weeks ago, we announced the completion of the MUD v2 audit with Open Zeppelin, whose scope included the contracts and the code generation portions of MUD. After a few final polishes to the client integrations, we’re releasing the stable 2.0.0 version of MUD!

This is a big deal. There will be no more breaking changes to MUD v2. We are following semver, which means every new feature will be released as a new minor version (ie 2.1.0) and small internal patches as patch version (ie. 2.0.1). Even as we add more features and continue to improve, MUD v2 will always be backwards compatible.

Our reasons for building MUD (and your reasons for choosing to use it) are unchanged: we believe that MUD is the best open-source framework for building onchain applications. From automatic sync between chain and client, an out-of-the-box indexer, no-sweat upgradable contracts, and immediate support for third-party plugins and integrations, MUD provides everything you need to build scalable applications onchain.

With the stable release, MUD’s training wheels are off and we can officially recommend MUD v2 for production use.

But this is just the beginning. We have a very exciting few months ahead, with more MUD features coming and the release of Redstone mainnet — the home for MUD applications. Right now, we’re working on a more powerful indexer in collaboration with Index Supply, a deep account abstraction integration, and better onboarding flows for your users, regardless of their wallet (or if they have one). We’ll be updating you with these releases soon.

We wouldn’t be able to do this without early adopters of MUD who have given us constant useful and actionable feedback. Thank you to teams like Project Awakening / CCP Games, Sky Strife, Biomes, Primodium, Moving Castles, Small Brain Games, DEAR, Gaul, and more, who have built incredible onchain applications and who have helped us level up the MUD developer experience. To all MUD users, we’re grateful that you chose us to build your application.

Lastly, we would like to thank all the contributors to MUD: thank you for building in the open with us.

MUD v2's many features

Introducing the second version of MUD

While designing MUD v2, we had two focuses:

Focus 1: Make it super easy to build and operate onchain apps. With MUD v2, we removed tedious work like indexing and setting up event systems, and simplified contract upgrades. MUD is surprisingly boring in that regard: it just works.

Focus 2: Enable any third-party developer to build on top of an existing application, by deploying code and adding logic to an existing onchain world. We think this feature of MUD will open up a new category of applications built by the community that do not incur the overhead of collaborative development and brings Ethereum and the EVM closer to its original promise of composability.

In order to deliver on these focuses, we built two major pieces of technology for MUD v2 over the last year: Store and World.

A new storage engine for the EVM: Store

To make it easier to build onchain apps we threw away the storage model implemented into the Solidity compiler and replaced it with a runtime defined storage system that can be used by multiple contracts. This engine is called Store. We like to think of it as the SQLite moment of the EVM.

In this context, “runtime defined” refers to a storage system that can be extended after contract compilation and deployment. Given the EVM has immutable bytecode, including the storage access pattern of an application in the contract’s bytecode at compilation time seems reasonable, and that’s what the Solidity compiler does. But what might have been a reasonable way of dealing with EVM state almost 10 years ago is becoming a serious crutch. Onchain deployments keep getting bigger: they span multiple contracts, are written by multiple developers, and are upgraded over time.

We think it is time to move storage management away from the compiler and into a kernel that stands as a middleware between applications and the EVM state, the same way early operating systems allowed multiple applications to run on the same computer by segmenting the state and interleaving CPU access.

Store enables you to do new things onchain you didn’t know were possible. In Store lingo, data structures stored in EVM storage are called tables. They are very similar to tables in a relational database. As an example of their power, Store lets you add new tables at runtime without redeploying your contract or performing an upgrade with some spooky storage gaps or namespaced storage. Just like the kernel of a regular computer, Store will protect your state from storage corruption by forcing consumers of that state to go through a syscall on the Kernel. With these syscalls, Store can also call a piece of code each time a specific record is updated, as an example in order to implement specific checks or permissioning on that piece of data.

Store emits events on every change made to the state. This enables client applications to stay updated on every block and for indexers to rebuild the state of a Store. Never write a Solidity event again, forget about the Graph, and delete that big chunk of your client code bombarding RPCs with view function calls at load time and subscribing to a dozen events to stay in sync.

In order to make onboarding as painless as possible, Store is a standalone library. It’s a drop-in replacement for Solidity’s storage system into any smart contract. Store doesn’t force applications to rethink how they are operated and designed.

How MUD World works

A new way to build apps onchain: World

With MUD v2, one of our goals was to promote a different path for developers and communities to build and extend onchain applications. In order to introduce this new way of building onchain we created World: a smart contract framework built on top of Store.

World is a new paradigm for EVM applications. You can think of it like a community computer: it exists as a multiplayer kernel that accepts contributions – whether code or state – from anyone onchain.

Smart contracts added to the World are stateless, with all records & tables being controlled and protected by the World. No smart contract can introduce storage corruption or access unauthorized regions of state.

World has a programmable access management that lets any piece of state or logic control which account (or other piece of logic) can access them. This makes it possible to build hierarchies of trust, and let untrusted smart contracts read state and engage with rules without letting them write to storage directly.

This hierarchy of trust enables a team to define a set of digital physics onchain that can be built upon by anyone in the community: enforcing rules of creation, modification, and destruction end-to-end. World prevents modifications to happen without their corresponding rules being executed. No one can mint tokens from nowhere or teleport an onchain spaceship to the other side of the universe.

World also has native delegation. One can think of it like a super generalized version of transferFrom of the ERC20 token standard: transferFrom allows smart contracts to trigger token transfers on behalf of users up to a specific token allowance.

World generalizes this allowance concept to any onchain action: any entities within the World – whether they are humans, DAOs, or other onchain contracts – can let others execute actions on their behalf if specific conditions are met. As an example, this enables players in an onchain world to delegate management of their assets to a market or an offchain bot. They could also use it to enter escrow-less transactions or complex trades with other entities.

Building on World gives you all of these features out of the box.

Composable onchain worlds with MUD v2

Together, Store and World have introduced a significant capability: enabling third-party developers to add code to a running application in a secure manner. Allowing the community to build upon a shared world has never been done before for any smart contract system, EVM or others. We believe this core aspect of MUD v2 will have a lasting impact on the blockchain ecosystem, and it will require time to fully understand the new digital constructs that have been enabled by this development.

It has been very rewarding for us to see early MUD v2 users capitalize deeply on this pattern for their application. With MUD v2, you can “upload code” into Primodium, an onchain space conquest & manufacturing game, by following their developer documentation. If you are lucky enough to be at one of their hackathons, you can build atop the physics of Project Awakening in order to increase your chance of survival by cooperating with other players. And if engineering in space is not your cup of tea, Sky Strife & Biomes AW enable you to create within the world your own custom incentive systems to defeat a player, destroy a specific unit, or accumulate enough resources for your alliance.

The new way of building introduced by World brings us one step closer towards the vision of Autonomous Worlds. It is now possible to create a set of digital physics determining how the world creates and transforms, and subsequently destroy the root access to itself; forever enshrining a canonical set of rules without limiting the feature set: anyone in the world – humans and machines alike – can interact with these rules and build societies and engineering contraptions on top of them.

We are pleased to present this second major release of MUD and hope that you will find it valuable. See you onchain!

MUD: MUD Website | Twitter | YouTube | Careers | Discord