Lost Dungeon is a casual mobile game built to show how blockchain technology can improve player experience without adding complexity. This project demonstrates how to build "invisible" onchain features that let players focus on gameplay while still owning their items.
What is Lost Dungeon?
Lost Dungeon is an experimental ARPG developed by Openfort to showcase seamless onchain integration. Players can explore dungeons, defeat enemies, and collect loot as they would in any traditional game. Behind the scenes, the game uses account abstraction and session keys to handle item ownership and transactions, meaning players never see a wallet pop-up or pay for gas fees.
Why We Built This Game
We created Lost Dungeon to solve a common problem: early onchain games often sacrificed fun for technical ideology. Players were forced to manage keys and sign every action, which broke the immersion of the game.
Our goal was to build a mini-game where players have total control over their assets without the "crypto jargon." By using Openfort, we enabled genuine ownership of in-game items while keeping the experience fast and interconnected.
Game Architecture
Blockchain
Lost Dungeon is built on top of Avalanche Fuji Testnet. Leveraging Avalanche as the game’s public cloud infrastructure ensures transparency, security and immutability. Developers need to “do your own research” on the blockchain you want to launch and grow as each blockchains have different tradeoffs, demographics and focus.
Gaming Backend
Lost Dungeon uses Playfab as a backend as a service solution together with Azure functions to execute certain custom logic. At its core, the gaming assets and economics of the game are in the blockchain making the game a “web2.5” approach.
Player Authentication
Lost Dungeon uses Playfab Authentication to onboard users with and without existing wallets. Providing a unified experience regardless of how crypto-savvy the player is.
In-Game Wallets
In Lost Dungeon, every player gets a wallet that is generated in the background. We call these "vaults" to better fit the gaming theme. These vaults are created during the signup process, so players don't need to connect an external extension like MetaMask to start playing.
- Unified Onboarding: Every player gets a smart wallet. If they already have an EOA (like a Ledger), they become the owner of that smart wallet. If they don't, we create a secure, non-custodial wallet linked to their email. To the player, both experiences are exactly the same.
Here is how we link an email to a non-custodial account
_10import Openfort from "@openfort/openfort-node";_10const openfort = new Openfort(process.env.OPENFORT_API_KEY);_10const OFplayer = await openfort.players_10 .create({_10 name: req.body.CallerEntityProfile.Lineage.MasterPlayerAccountId,_10 });
- Playing as a Guest We’ve also created a “play as a guest” button where players enjoy the game without having to sign up. This onboarding creates a wallet in the background that players would be able to claim if they want to save their progress in the game.
Gasless Transactions
Gas fees are one of the biggest blockers for new players. Forcing a user to buy a native token just to play a game often leads to immediate drop-off.
Lost Dungeon uses gas policies to sponsor these costs. This allows players to mint items and collect rewards without ever needing to hold AVAX. The result is a smooth, uninterrupted experience that feels like a standard Web2 game.

Read more about gasless transactions.
Signless Transactions (Session Keys)
Session keys are a major upgrade for onchain UX. They allow players to pre-authorize transactions for a specific period of time. In Lost Dungeon, this means you can play the entire game without being asked to "confirm" every action.
Here is how we use session keys on Lost Dungeon. We create a local session key to be able to buy a weapon (mint an asset) by pre-approving functions of the smart contract during a specific period of time.
_17using Openfort;_17_17public class Web3AuthService: MonoBehaviour_17private OpenfortClient _openfort;_17_17private void Start() {_17 _openfort = new OpenfortClient("pk_test_…");_17}_17private void RegisterSession() {_17 Debug.Log("Registering session...");_17 var loadedSessionKey = _openfort.LoadSessionKey();_17 if (loadedSessionKey == null) {_17 var sessionKey = _openfort.CreateSessionKey();_17 walletConnectorKit.ChangeState(State.CreatingSessionKey);_17 _openfort.SaveSessionKey();_17 }_17}

Read more about gaming popless experience.
Beyond the wallet
Purchasing Assets (ERC721)
The Shop screen enables players to purchase weapons using their $GOLD tokens. Let’s walk through how this works.
The ERC721 contract allows players to “claim” the assets as long as they meet the onchain conditions defined on the claim condition of the contract. When a player clicks on “Buy” we hook up the purchase buttons of each UI item with the claiming function.
If the conditions are met, the player will exchange some $GOLD tokens for a weapon NFT.
_55const currencyAddress = process.env.GOLD_CONTRACT_ADDRESS;_55const weaponAddress = process.env.OF_WEAPON_CONTRACT;_55const _proof = [_55 "0x0000000000000000000000000000000000000000000000000000000000000000",_55];_55const _quantityLimitPerWallet = 1;_55const _receiver = resultData["OFplayer"].Value;_55const _tokenId = Number(offerId);_55const _quantity = 1;_55const _pricePerItem = {_55 "0": "1000000000000000000",_55 "1": "10000000000000000000",_55 "2": "20000000000000000000",_55 "3": "30000000000000000000",_55 "4": "40000000000000000000",_55 "5": "50000000000000000000",_55};_55const _data = "0x";_55const _allowlistProof = [_55 _proof,_55 _quantityLimitPerWallet,_55 _pricePerItem[offerId],_55 currencyAddress,_55];_55const interaction_1: Interaction = {_55 contract: process.env.OF_GOLD_CONTRACT,_55 functionName: "approve",_55 functionArgs: [weaponAddress, _pricePerItem[offerId]],_55};_55const interaction_2: Interaction = {_55 contract: process.env.OF_WEAPON_CONTRACT,_55 functionName: "claim",_55 value: "0",_55 functionArgs: [_55 _receiver,_55 _tokenId,_55 _quantity,_55 currencyAddress,_55 _pricePerItem[offerId],_55 _allowlistProof,_55 _data,_55 ],_55};_55_55_55const transactionIntentRequest: TransactionIntentRequest = {_55 player: _receiver,_55 chainId: 43113,_55 optimistic: true,_55 interactions: [interaction_1, interaction_2],_55 policy: process.env.OF_TX_SPONSOR,_55};_55const transactionIntent = await openfort.transactionIntents.create(_55 transactionIntentRequest_55);
You can find the Weapons Minting Contract used by the game here.
Collecting Coins -$GOLD (ERC20)

The $GOLD token works as the in-game currency within Lost Dungeon. The in-game mechanics rely on the token to upgrade your progress in the game.
When onboarding for the first time, we drop the player with 1 GOLD. Players complete runs to obtain GOLD Tokens, which in turn can be spent to purchase weapons from the shop. These are NFTs owned by the players, and are reflected inside and outside of the game.
Some of the mechanics implemented in the game:
-
Reading balance. We’ve set a CRON function to periodically refresh the player’s balance. Additionally, we hook up a refresher for related user actions that update their balance.
-
Minting Flow. With Last Dungeon we used the aforementioned Session Keys to approve every action happening onchain. That’s in the case of the dungeon, the collection of Gold, triggers a minting event automatically.
We could also decide to put those transaction onchain once the game is over and batch them all together in one single mint to save on gas fees, but for the sake of this example we wanted to show how smooth it is with single transactions.
You can find the $GOLD Token Contract used by the game here.
Other notable features we could include
- Transfer Ownership Allowing players with non-custodial wallets to transfer their ownership to a self-custodial wallet without exposing private keys.
Read more about how to transfer the account ownership.
- Token Bound Accounts Turning battle passes or simple player avatars into smart wallets that could also host more game tokens and assets without. This approach ensure an easy transfer of wallets via the NFT directly instead of the signer.
Read more about the benefits of ERC6551.
- Ecosystem ID Openfort's headless approach makes it ideal for building a gaming wallet on top of. Additionally, this enables the creation of companion apps and enhances the gaming ecosystem.
Read more about how to create your own ecosystem ID
- Playing as a guest functionality Playing as a guest is a common way for players to authenticate to games, and all BaaS providers offer that functionality. The problem is that if the player has made some progress while playing as a guest, they will lose it for the next gaming session.
Learn how to implement it in our PlayFab guide.
Get Started
By using the Openfort APIs and Unity SDK, we were able to build Lost Dungeon in a fraction of the time it usually takes to integrate blockchain. We focused on the fun—the onchain part was the easy part.
The SDK is open-source and ready for you to use.
