Stark Loot - A proposal to build next generation of Loot on a ZK Roll-up

Gas and transaction speed. Anyone remotely acquainted with custodial wallets is aware of how big an impact gas prices can have on the usability of the system. Users don’t trade, dApps make tradeoffs in platform designs due to potential user costs and games become unplayable.

The core tenets of the Lootverse (data on-chain, composability of derivatives) by their nature rely on high gas operations - and as future gaming mechanisms evolve - these requirements will only increase.

Our mission from the genesis of the Bibliotheca project was to build a completely on-chain game that could scale to 1m+ concurrent users. No infrastructure needed other than a UI client to run.

At Realms x Bibliotheca we have developed and released an alpha version of our on-chain Settling game- currently developed on Arbitrum, and incorporating various elements such as:

  • ERC20, ERC721 and ERC1155 tokens
  • Staking NFT + yield contracts
  • 2-way NFT bridge from Ethereum to Arbitrum
  • Raiding mechanisms (P2P gaming contracts)
  • AMM to trade resources

The game has been developed with extensive community input - with Realms holders shaping the mechanics that they would like to play in the future. Great ideas have spawned out of the community such as building complex army formations and constructing structures affecting statistics, incorporating other tokens (mLoot, OG Loot, gLoot etc) in various ways so that the entire Loot community can participate, wars between the Orders discovered by the Genesis project, hidden on-chain cryptex puzzles, and turn/physics based games.

After hitting fee limits and encountering structural barriers - constantly forcing reevaluation (simplification) of our implementation, we realised that to enable complex composability (with fees the user can stomach)- both within a derivative and between projects - the Lootverse needs a cheaper method of shared on chain logic. The ability to cheaply store and interact with data is vital to a vibrant decentralised community of assets like Loot

The Solution

By bundling transactions on an L2 (like Arbitrum, Optimism, StarkNet or zKsync) before submitting to layer 1 - user’s are able to make substantial savings in gas fees - but still have the consensus security and interoperability of layer 1. Layer 2s can currently be categorised as one of two main mechanisms; Optimistic, and ZK (Zero Knowledge) Rollups .

Which Layer 2

Vitalik gives a good overview of the rollup solutions at An Incomplete Guide to Rollups

For a brief overview:

Optimistic

Pros

  • First to launch
  • More developer tooling
  • Complete EVM
  • Established TVL

Cons

  • 7 Day lockup period to withdrawal
  • Less transaction per second
  • High fees - and increasing relative to ETH fees

ZK Rollups

Deep dive into Zks - Ethereum-powered ZK-Rollups: World Beaters - HackMD

Pros

  • Lower fees and more scalability (fees decrease with more transactions on the network)
  • Instant withdrawals to L1
  • Each transactions is validated by cryptographic proof - not “optimistic” reliance on fraud proofs - therefore finality means transactions cant be reordered like in Optimisic’s 7 day dispute period

Cons

  • Less tooling - not as established e.g user account interaction not yet implemented by MetaMask, no subgraphs
  • Not EVM
  • Developers need to learn a new language

Although developing on Arbitrum has allowed many possibilities not available on mainnet - such as raiding transactions for USD$1-6 instead of up to $60 - as we have built out further complexity and our community’s vision for the gaming aspects has grown - the cumulative effect of these (still much lower) fees become unpalatable, and recent volatility in Eth gas fees have been reflected - with base transactions rising to $10 at times.

This volatility will only increase as ethereum grows, and until sharding from ETH2 happens the L1 calldata cost will continue to increase.

After a thorough analysis of other solutions - we believe StarkWare’s StarkNet platform (mainnet launch end Nov ‘21) is the most promising long term solution for Loot’s L2 gaming needs.

StarkNet

  • StarkWares validation mechanisms and Cairo language has been used in production for over 6 months by high volume applications such as Dydx (largest defi derivatives trading) and Immutable X (NFT platform powering God’s Unchained and TikTok) - settling over 40M transactions and $150B of trades
  • Approaching EVM compatibility (through transpiler)- but core language is Cairo -optimised for high transaction validation. Although Cairo is somewhat of a technical barrier - it allows far greater flexibility than Solidity - especially for gaming interactions such as provable physics simulations and turn based applications (https://twitter.com/guiltygyoza/status/1454657064555499522 ) .
  • Unique “volition” hybrid on-chain/off-chain data solution - which greatly expands developer capabilities due to not having to worry about Eth storage costs for every operation
  • Cairo enables expressive provable gaming engines that is not possible with solidity. See Dopewars Cairo engine https://github.com/dopedao/RYO

Tools

https://starknet.io/playground/ = Online Code Playground

https://voyager.online/ = Block & Contract explorer

Hello, StarkNet — Cairo documentation = Starknet/Cairo language docs

https://github.com/seanjameshan/starknet.js = Javascript library for contract interactions like web3.js or ethers.js

https://github.com/Shard-Labs/starknet-hardhat-plugin = Hardhat plugin

https://github.com/OpenZeppelin/nile/ = Contract compiler/deployer like Hardhat

Resources

Cairo | Perama’s notes. - Gold standard of notes (Dope wars developer)

What is required for the Lootverse on Starknet

The end goal is ease of interoperability between projects, and for (all not just whale) users to participate in a wide array of experiences across projects. This will require

  • Effective bridging/ proof of ownership for L1 assets to be used on L2
  • L2 marketplace for cheaper trading of assets (NFTs and ERC1155s)
  • More effective minting (8000+ * 0.05 Eth of fees is a lot of wasted excess that would have been better spent on community building) and distribution of assets to stakeholders
  • Best practices for developers on StarkNet (Cairo vs Warp EVM, composability between projects, on-chain vs off-chain)

All these tools and developer experience can be shared across Lootverse projects once built and we can all live in the Lootverse cheaply and efficiently.

If we gain enough support for this proposal, we will set up a special purpose DAO to help fund this initiative.

17 Likes

Did some reading and reflecting on Starkware. I, for one, absolutely love this cutting-edge way of thinking.

Once you have what you feel is adequate support, what would be the next steps along this journey?

  • Details on the special purpose DAO? How much funding do you need?
  • What does migration look like? Are you thinking about starting on Starkex and then porting over, or just waiting entirely for Starknet mainnet?
  • Thoughts on what a rough new development timeline would look like? I’m guessing we’re looking at 2022 milestones now, but sounds like it’ll be more than worth it.
3 Likes

i support this proposal

1 Like

Think this is the right move going forward in scaling the participation of people in the Lootverse.

3 Likes

I support this and wanted to elaborate on what is possible by building on StarkNet.

Since account abstraction is built-in to Cairo from day-1, there is an entirely new, unconquered design space that is available for game devs on the Lootverse. For example, rather than creating a user Account which requires a signature to execute functions (as Ethereum accounts behave), an exotic LootOrderAccount (LOA) could be created. This LOA can be programmed to not require signature, but simply requires that the get_caller_address is associated to the same Loot order. This means anyone could trigger functions on behalf of the LootOrderAccount, as long as they’re in the same order. This opens up a whole new arena for coordination, even across projects.

Another advantage that StarkWare has is ability to prove execution with less constraints on computation. Game designs which were previously constrained by gas execution limits would be free to add more logic and have more runway for long-term co-evolution alongside communities.

In my opinion, Realms is leading the charge here.

4 Likes

It’s really interesting to hear that your experience with Arbitrum is reduced transaction fees but not reduced enough. The future of blockchain games depends on transaction fees being close to zero.

I’m involved in a lootverse project that is designing around the limitations of Ethereum mainnet. I’d fully support any lootverse consensus move to a viable L2. Your links and insights show that Starkware is a good choice right now and we’d likely follow the lead of Realms for future lootverse projects.

3 Likes

I’m no coder, but this sounds great to me. And, if it means trading can happen without high gas fees, of both resources and realms, seems almost like a no-brainer if we really want this game to be big.

Question, is this paving the way for the entire loot ecosystem to move over to L2, potentially,? And, moreover, the entire NFT ecosystem?

1 Like

Hey, sorry if I misunderstood, but what is the exact proposal ? Building interoperable solution for the whole Lootverse ? Or simply shifting the chain for the Realm project ?

Also, after reading this article The ultimate guide to L2s on Ethereum — Mirror what about building on Immutable X ? I am not 100% sure, but this is not exactly same as building on starknet. Immutable X allow the user to choose between publishing its data on chain or off chain. Users that want even lower transaction fees and doesn’t care as much as security (still very secure though) can choose the validium and publish data off chain.

Am I missing something or Immutable X is even better than Starknet ? (built with the same infrastructure but allowing more flexible data storing option ?)

Yes, this proposal is to shift the entire game aspect of Loot onto Starknet. We would spearhead the infrastructure and assist projects in the transition.

The reality is, no actual game is going to exist on layer 1. Everything needs to happen on an L2, more specifically a ZK rollup.

I want to see future OG/GA Loot bags are used as LP’s for game assets.

For example. A contract could be written that allows OG loot bags to ‘mint’ their bag in items directly onto Starknet once a week. These items could go into a marketplace.

This marketplace could be accessed by Unity or game engines and the items be used within them. This is only possible on L2.

2 Likes

Yep I 100% agree with this, there is no way any games will be developped on L1, at least on Ethereum.

How could we make that happen ? What would be the next steps as for you ? Raising awarness of the Lootverse before making a proposal ?

Could somebody please explain me this: if I have my loot on main net & the zkrollup uses the same ETH address as main net, then do I need to transfer my original loot from main net or is the L2 aware of the fact that I do own the loot? if it is automatic then it is amazing since I would not need to transfer anything in order to participate in onchain games on the rollup. The worst outcome would be to transfer there & back since I need it for different games on different layer 2s & main net

Think of your main Loot bag as data stored on L1. You can go to any number of L2s and ‘mint’ a version of it on the rollup. This version can then be used, but you still have access to your main Lootbag.

We have already begun mapping and building what is needed.

Our hope is that other developers will contribute to these foundational pieces, then the next generation of Loot builders can easily jump in and build rich & gas-efficient experiences.

L1 Lootbags will always be the game primitives, as they were designed to be. But the computation and gameplay will happen with a ZK back-end. This is not to say every game has to be fully on-chain. But game devs will be able to tap into the ZK item liquidity and efficiently and access the game items.

Correct me if I’m wrong, but what is annoying with this is that if someone buys a lootbag on L2, then he still has no right on the lootbag and basically have a worthless Loot right ? The real value always is on L1 …

I see, so the way we can help is by spreading the word that Loot is building a set of contracts to bridge & play on starknet ?

The ‘mint’ onto L2 would be an unbundled lootbag. The LP (bag holder) could just add the items into an item AMM for new players to buy.

So the L1 becomes the productive asset, but the actual equipable items appear on L2. Then some kind of durability/loss function will eventually destroy them, keeping supply in check.

Yes! Please just spread the word.

I believe the prevailing factor in decision right now should the easiest L2 for developers to build on. The core value of Loot is the community that builds on top of it.

Some disadvantages of StarkWares for community to consider:

  • Alpha in mainnet. Still way to go to be battle-tested.
  • Has its own language, which on my opinion is unnecessary obstacle for developers. Also the code needs to be rewritten if we decide to move to another L2.
  • Lucks the hardhat testing framework support. Though they say ShardLabs is working on solution.
  • Lucks the support on Dune Analytics, which makes it harder for analytics to build dashboards and be transparent about Loot dapps progress. Optimism and Arbitrum will be supported very soon, according to feature board.
1 Like

Those are really good points. At the same time it seems like Starknet offers a processing/gas/tx environment that we’re likely never going to get on Arb or Optimism.

All valid points - StarkNet is definitely still an alpha product but it’s feature-set is rapidly expanding - and appears to be the most battle tested of the ZK solutions thus far.

  • It does have it’s own language (Cairo) - which is optimized for L2 gas and allows for extra functionality such as volition and account abstraction - which we believe can provide great optimizations for gaming experiences beyond just minting NFTs. There is also a Solidity transpiler being developed (at https://github.com/NethermindEth/warp) for those that do not wish to learn another language or rewrite code. It does remain to be seen how this will compare from a user cost perspective against zkSync/Loopring/Polygon’s zkEVM or the Optimistic Rollups

  • The Hardhat plugin does appear to have Mocha tests implemented (https://github.com/Shard-Labs/starknet-hardhat-plugin#test) - but I haven’t verified as we are using OpenZepplin’s Nile instead (https://github.com/OpenZeppelin/nile) which has proven to be adequate for our needs.

  • I’m not aware of a dashboard solution yet - although Dune have also stated the zkRollup’s are also on their roadmap - StarkNet is still missing events (due in the next month or two) - which once added will allow for analytics/data providers like Dune and The Graph to start indexing.

1 Like

Thinking from first principles here and the long game

We will just discuss on-chain gaming here. By this I mean, game state, game logic, and game primitives are all on-chain (obviously some things cannot be fully on-chain like .vox files etc, but ultimately they are just a lens on the actual game, and other developers could create different UIs).

Three Cs; Composability, Cheap Cost, Computation

For true rich on-chain games to emerge we require 3 things; cheap fees, cheap computation, composability.

Composability

Games must be able to perissionlessly interoperate with each other. If the games are running on the same chain then this is easy. It’s possible across chains but will come to the detriment of the UX as NFTs are unique and cannot just be realised on another chain instantly like fungible tokens can.

Solution to composability - Permissionless smart contract platform

Cheap Cost

Gas cost is the mind-killer. Games need to have cheap tx costs otherwise rich gameplay can never exist past simple txs (like wolf game). But it’s a stretch to call that a game.

Nothing is going to happen on L1, and it’s a matter of when not if that eth just becomes a settlement layer for rollups.

ZK Rollups scale with users - They will become cheaper the more people use them, with the flywheel effect once they pick up steam. Not only the tx cost but innovation by StarkWare like volition will allow for even cheaper data storage. - Volition and the Emerging Data Availability spectrum | by StarkWare | StarkWare | Medium

Solution to cost - ZK Rollup

Computation

Intense computation was never meant to exist on Ethereum, it wasn’t designed this way. Execution of contracts needs to be run on by miners (until ETH2) to validate the hash submitted, so contracts are limited in their capacity. Zero-Knowledge (ZK) proofs change this by producing proof that a program has run, a validator can trust that what is submitted without having to rerun the program. Now it’s 1000 line contract costs the same as a 100 line contract in computation costs.

Games are heavy in computation, so clearly for games to emerge that we all want to play, we need cheap computation.

Solution - ZK Rollup

Summary

Only within a Zero-Knowledge Rollup can all 3 things exist in harmony and allow the promise of entirely on-chain gaming to flourish.

The barrier right now is that Cairo is a new language for developers. But I suspect this will be overcome once developers realise the three C’s are needed for gaming.

2 Likes

One suggestion:

why not mint an annual play pass for each Loot!
that Loot play pass could be moved from main net to Starkware or whatever L2.
Furthermore, it could be accessed through Metamask easily, since the value wouldn’t be high enough to need to keep it in a hardware wallet.
Now the ownership of that play pass would entitle everyone who controls it to mint all projects that launch in this year & to play all games where the play pass is required. The people who have no time to mint/play could simply rent or sell this annual play pass but keeping their Loot.
it would be way easier because OG loot could stay in the hardware wallet on main net.
the annual play pass that is valid one year could live on l2 & metamask wallet.

1 Like