Integrating an In-Game NFT Wallet for Mobile GameFi

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Integrating an In-Game NFT Wallet for Mobile GameFi
Complex
from 1 week to 3 months
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    858
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    743
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1159
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1034
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    968
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    562

Integrating an In-Game NFT Wallet for Mobile GameFi

A player clicks "equip" — the interface freezes, the transaction fails, the NFT never appears. An hour later they've moved to a competitor. In GameFi, every transaction is a UX challenge. If the wallet isn't optimized for the gaming context, the user experience collapses. We tackle this problem end-to-end: from architecture selection to store deployment. Our team has 7+ years in mobile development and 15+ GameFi projects, including integrations with Immutable X, Polygon, and Ronin.

Architecture for a Mass Audience

The choice between custodial, non-custodial, and embedded wallets defines the entire architecture. Custodial (keys on server) — simple onboarding but KYC and server trust required. Non-custodial (keys in Keystore/Secure Enclave) — full control, but complex for players. Embedded wallets via MPC libraries (Privy, Magic, Dynamic) — a compromise: email/social login, keys in HSM. For casual GameFi lately, this is the de facto standard.

How to Choose the Wallet Type for GameFi?

Selection criteria: audience, transaction frequency, onboarding budget.

Parameter Custodial Non-custodial Embedded
Onboarding Email/password Seed phrase Email/social
Security Server (HSM) Keystore/Secure Enclave MPC + HSM
KYC Required in some countries Not required Usually not required
Gas Developer pays User pays Developer/user pays
Development cost Medium High Medium

For games with millions of users, embedded is the optimal balance.

Why Optimistic UI Is Critical for Gaming Transactions?

A blockchain transaction is not an HTTP request. It enters the mempool, waits for block inclusion (10 seconds on Polygon, instant on Ronin). Meanwhile the user continues playing. Blocking the interface is unacceptable.

Pattern: Optimistic UI + background monitoring. Update state immediately (equip, claim reward), send transaction, track its status. If it fails, roll back.

// iOS — optimistic update
func equipItem(_ nft: NftItem) {
    store.dispatch(EquipAction(tokenId: nft.tokenId))
    Task {
        do {
            let txHash = try await walletService.equip(nft)
            await monitor(txHash: txHash, onFail: {
                store.dispatch(UnequipAction(tokenId: nft.tokenId))
                showError("Transaction failed")
            })
        } catch {
            store.dispatch(UnequipAction(tokenId: nft.tokenId))
        }
    }
}

Monitoring — polling via WebSocket or JSON-RPC every 3–5 seconds.

Gas Estimation and Fee UI

For non-custodial wallets, show gas before confirmation. eth_estimateGasgasPrice → convert to USD via CoinGecko API. Don't show native token without USD equivalent — the player doesn't know what 0.0023 MATIC costs. Immutable X provides gas-free transfers, which are 100x cheaper than Polygon and 1000x cheaper than Ethereum. Average transaction cost on L2 is under $0.001, gas savings up to 99% compared to Ethereum. Network comparison:

Network Average NFT transfer cost Confirmation time
Ethereum $30–100 10–20 min
Polygon < $0.001 ~2 sec
Immutable X 0 Instant
Ronin < $0.001 ~1 sec

Local NFT Data Storage

Load NFT metadata via tokenURI (ERC-721) or IPFS gateway. Cache locally — Room / Core Data. Images — separate cache via Glide (Android) / Kingfisher (iOS) with IPFS URL.

@Entity(tableName = "nft_items")
data class NftItem(
    @PrimaryKey val tokenId: String,
    val contractAddress: String,
    val name: String,
    val imageUrl: String,
    val metadata: String, // JSON
    val isEquipped: Boolean = false,
    val cachedAt: Long = System.currentTimeMillis()
)

Serve IPFS URLs through our own gateway for stability.

Transactional UX — The Hardest Part

Common wallet integration mistakes - Not accounting for confirmation delays and not providing fallback - Lack of metadata cache — every inventory open triggers a load - Ignoring App Store rules (prohibition of fiat NFT sales without IAP) - Storing keys in SharedPreferences or UserDefaults

Private Key Security

Non-custodial: keys only in Android Keystore or iOS Secure Enclave. Transaction signing inside the store — keys never leave the secure area.

val keyStore = KeyStore.getInstance("AndroidKeyStore")
keyStore.load(null)
val privateKey = keyStore.getKey(KEY_ALIAS, null) as PrivateKey
val signature = Signature.getInstance("SHA256withECDSA")
signature.initSign(privateKey)
signature.update(transactionHash)
val signedBytes = signature.sign()

NFT Inventory and Filtering

Inventory with 200+ NFTs filtered instantly via Room queries. Use LazyColumn or UICollectionView with DiffableDataSource. Sort by rarity_score from metadata.

App Store / Google Play and Web3

Apple accepts NFT apps but prohibits NFT purchases via third-party payment systems without App Store commission (30%). Allowed: displaying NFTs, transfers between wallets, in-game use. Prohibited: fiat sales without IAP. For marketplace — only WebView with external site. Google Play explicitly allows NFTs, but same fiat sales rules apply. App Store Review Guidelines 3.1.1.

Step-by-Step Integration Process

  1. Game economy analysis — determine wallet type, L2, gas budget.
  2. Architecture design — library choice (Privy/Magic/Dynamic), cache scheme, data model.
  3. Smart contract integration — connect ERC-721/ERC-1155, gas calculation.
  4. Client-side implementation — wallet, Optimistic UI, monitoring, cache.
  5. Testing on TestFlight/Firebase — simulate 1000+ transactions.
  6. Store deployment — verify compliance with Apple/Google guidelines.

What's Included

  • Wallet architecture selection (custodial, non-custodial, embedded) for your economy
  • Cache scheme design and NFT data model
  • Smart contract integration and gas calculation
  • Client-side implementation with Optimistic UI and transaction monitoring
  • Testing on TestFlight/Firebase with peak load simulation
  • Assistance with App Store and Google Play review
  • Documentation and source code handover
  • 3-month warranty support after deployment

Timeline

Basic custodial wallet with NFT viewing and transfers: 1–2 weeks. Full-featured non-custodial with game mechanics and Optimistic UI: 3–5 weeks. Cost is quoted individually based on chosen network and integration scope.

Get a consultation on wallet architecture for your game — we'll estimate your project in 2 days. Contact us to discuss the integration.

How to Choose a Local Data Storage Solution (Room, Core Data, Realm, Isar)?

We've all seen the scenario: the app loses data when the network drops — and it's not just a bug, it's a failure of the use case. The user fills out a form, taps "Submit", gets a timeout, and loses everything. Or worse: data gets sent twice due to incorrect retry logic. A properly chosen and configured storage layer solves this problem once and for all. The wrong choice can cost teams months of rewriting code and up to 70% of time spent on synchronization. Our experience — 10+ years in mobile development, over 50 projects with offline storage — confirms: the storage choice determines 80% of future performance and synchronization issues.

In practice, storage selection is driven by two factors: data type and synchronization requirements, not library popularity.

Room (Android) — a wrapper over SQLite with compile-time verification of SQL queries. If a query is invalid, the build fails — better than a SQLiteException at runtime. Room integrates well with Kotlin Flow and LiveData, making reactive UI updates straightforward. The main challenge is schema migrations. @Database(version = N, exportSchema = true) with migration files in assets/databases/ is mandatory; otherwise, fallbackToDestructiveMigration() will simply delete the user's data on app update.

Core Data (iOS) — not a database, but an object graph management framework over SQLite (or XML, or in-memory). NSPersistentContainer with viewContext for reading on the main thread and newBackgroundContext() for writing is the basic setup. The trouble begins when a developer calls save() on viewContext from a background thread: EXC_BAD_ACCESS at a random moment, happens once a week, with almost nothing useful in the crash log. You must use performAndWait or perform for each context strictly on its own thread. Apple Core Data Programming Guide recommends this approach.

Realm wins where you need speed with large object sets and built-in reactivity through Results + observe(). Realm stores objects directly without ORM mapping, so reads require no deserialization. According to our measurements, Realm processes reads 2–3 times faster than Core Data for volumes over 10,000 objects. On Flutter, the Realm SDK (ex-MongoDB Realm) supports Device Sync — but that's a managed service with separate infrastructure.

Hive and Isar are Flutter-specific solutions. Hive is a key-value store, fast, simple, suitable for settings and caches. Isar is a full document-oriented database with indexes, written in Rust, compiled to native code. For Flutter apps with offline functionality, Isar is now preferred: built-in query builder with type-safe filters, transactions, watchObject/watchQuery for reactivity.

Platform Solution Reactivity Synchronization
Android Room + Flow LiveData/Flow WorkManager
iOS Core Data NSFetchedResultsController CloudKit
Flutter Isar Streams Custom / Realm Sync
Cross-platform Realm RealmResults.observe Device Sync
Flutter (simple) Hive ValueListenable None

Contact us for a free audit of your current storage and optimization recommendations — this will save you hundreds of development hours and up to 60% of server request traffic.

Why Is Offline Synchronization the Hardest Part?

Local storage itself is not complicated. The complexity lies in synchronizing with the server in the presence of conflicts.

The most common pattern is optimistic updates with rollback. The user edits a record, the UI reflects the change instantly, a background request goes to the server. If the server returns an error, we roll back the local state. Sounds simple. In practice: if the user has left the screen and returned before the rollback (which may take 3 seconds), the UX is broken. You need an explicit operation queue with states (PENDING, SYNCED, FAILED) in a separate table.

On Android, for background synchronization we use WorkManager with Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED). Don't forget setInputMerger(ArrayCreatingInputMerger::class) when batching tasks — otherwise, concurrent runs will overwrite data. A typical operation queue implementation:

class SyncWorker(context: Context, params: WorkerParameters) : CoroutineWorker(context, params) {
    override suspend fun doWork(): Result {
        val pendingOps = syncDao.getPendingOperations()
        for (op in pendingOps) {
            try {
                apiClient.send(op.payload)
                syncDao.markSynced(op.id)
            } catch (e: Exception) {
                syncDao.markFailed(op.id, e.message)
                return Result.retry()
            }
        }
        return Result.success()
    }
}

On iOS, the equivalent is BGTaskScheduler with BGProcessingTaskRequest. iOS limitations on background execution time (~30 seconds for refresh tasks) mean that synchronization must be incremental: not "sync everything," but "sync the next N records, save the cursor."

Conflicts in multi-device scenarios are resolved with one of three approaches:

  • Last-write-wins based on updated_at (simplest, loses data on concurrent edits)
  • Server-wins (client always accepts server version)
  • Three-way merge (complex, requires a common ancestor — suitable for documents)

For most B2C apps, last-write-wins with a user-level time vector is sufficient, but for collaborative editing, a CRDTs approach is needed — then look at Automerge or Yjs with mobile bindings.

How We Build the Storage Layer

The repository pattern is not optional — it's mandatory. UserRepository doesn't know where the data comes from: Room, Realm, or network. The ViewModel calls repository.getUser(id), gets a Flow/Stream, and displays data. Caching logic resides inside the repository.

For Flutter, a typical architecture: Isar for persistence, Riverpod for state management, ConnectivityPlus for network status, and a custom SyncService with an operation queue. Riverpod's AsyncNotifier conveniently covers the logic of "show cache, update from network, show new data." Example repository with caching:

class UserRepository {
  final Isar isar;
  final ApiClient api;

  Future<User> getUser(String id) async {
    // try from local storage first
    final cached = await isar.user.where().idEqualTo(id).findFirst();
    if (cached != null) return cached;
    // otherwise from network
    final remote = await api.fetchUser(id);
    // save locally
    await isar.writeTxn(() => isar.user.put(remote));
    return remote;
  }
}

Another important topic is encryption. If the app stores medical data, payment cards, or corporate documents, SQLCipher (Android) and NSFileProtection (iOS) are not optional. Realm supports encryption natively via a 64-byte key that must be stored in Keychain/Keystore, not in SharedPreferences. Skimping on security can lead to data leaks with serious consequences.

What the Work Includes

We guarantee a transparent process and document each stage:

Stage Result
Requirements audit Document analyzing data types, volumes, synchronization scenarios
Schema design ER diagram, migration files, conflict resolution plan
Repository layer development Code with unit tests (in-memory DB + network mocks)
Synchronization integration Operation queue, error handling, fallback logic
Profiling and optimization Report from Android Profiler / Core Data SQLDebug, recommendations
Deployment and documentation Deployment instructions, API description, repository access

Want to avoid common mistakes when designing storage? Contact us — we'll help design a reliable local storage from scratch or improve an existing one.

Stages of Work

We start with a requirements audit: what data, what volume, is synchronization needed, are conflicts possible. At this stage, it becomes clear whether Core Data or an SQLite-based solution is needed, whether Realm Sync is required or simple REST polling will suffice.

Next, we design the schema with migrations in mind. Schemas change in any project — the question is not "will there be migrations," but "how painful will they be." We export the schema as JSON, store it in the repository, and write tests for each version's migration.

Development includes unit test coverage for the repository layer: network layer mocks, a real in-memory database for query testing. Before release, we profile queries using Android Profiler (Database Inspector tab) or Core Data debug flags (-com.apple.CoreData.SQLDebug 1).

The implementation timeline for a storage layer with basic offline synchronization ranges from 2 to 6 weeks, depending on schema complexity and conflict resolution requirements. Contact us to get a consultation on choosing the optimal stack and migrations.