The State of Web3 in Unity. Let’s dive into the current state of… | by Kirill Sidorov | Sep, 2022

Let’s dive into the current state of web3 SDKs and find out how we can provide the best blockchain features in Unity

1*TJoZnj2Uk W0rr rUgcuhw

According to the NewzooTrend Report dated 2022, 49% of unique wallets interacting with decentralized applications have been used in blockchain games. The report also points out the trend of big brands specializing in music and entertainment becoming highly interested in Metaverse projects.

My vision is that the only way to move forward with the Web3 gaming and Metaverse paths is to continue enhancing the user experience to make it clear, straightforward, logical, and, yeah, you’re right — Entertaining! Let’s dive into the current state of affairs on that path and find out how we can bring the Web3 technology and provide the best blockchain features for one of the most popular gaming engine — Unity.

This article of mine applies to the EVM-compatible blockchains cause we know the way it works under the hood there, don’t we?:) Here, I’m focusing mainly on the Unity libraries and features; however, some information may also apply to other engines. Also, we all love open source, so I’ve written only about the open-source libraries I could test.

First things first, let’s start by taking a look at how we can connect to the blockchain on different platforms. I’d like to emphasize that I usually use wallets to store private keys. Of course, you can use a different approach, but in this case, do it at your own risk. In addition, I’m going to say that I start with the most simple solutions and continue to add complexity, finishing with solutions that can’t be called otherwise than the Way of Samurai.

Web platforms have the longest history of working with the blockchain. The most advanced Web3 libraries have been created for the Web. Everything started from web3.js, which was followed by ether.js, and then Embark. The Web provides a vast number of different wallets, from browser plugins (Metamask, Coinbase) to dApps (MyEtherWallet), and then services (Torus) as well.

Ankr Gaming SDK

Ankr Gaming SDK provides all the base features to interact with the blockchain except for deploying smart contracts. It supports calling web3.js methods from C# code, which extends the SDK to the capabilities of the best-known library in the Web3 world. And meanwhile, it supports all injected wallets such as Metamask, Coinbase, etc., as well as Torus. Ankr Gaming SDK is implemented as part of a universal SDK and doesn’t require any particular prerequisites for integration. It is worth mentioning that Ankr provides the same-functionality SDK for Unreal Engine as well.


Moralis game kit

Moralis is a service that allows managing Web3 applications on the Ethereum and Solana blockchains, using various wallets, and connecting with other services like Firebase or PlayFab. The only thing you have to be warned about is that they have a very specific high-level API, and you’d better research on its compatibility for your particular purposes.

Custom way

If you have pretty specific use cases, good JavaScript experience, and you don’t want to use third-party solutions, you can develop your own integration using the WebGL platform. As you might already know, Unity provides an excellent means for calling the JavaScript code directly from C# scripts. Also, you can use the JS libraries I mentioned before: web3.js, ether.js, Embark, etc.

To start your project development, you can use Metamask — the most popular wallet having rather good docs. But to extend supported wallets, I recommend using libraries like web3modal.

There’s no need to differentiate between the Android and iOS platforms because they use a single approach to connect with the blockchain — WalletConnect.

WalletConnect is a pretty straightforward protocol that uses mobile wallets to sign transactions with a user’s private key. Of course, you can store it in your application, but that would mean lots of security concerns fall on your shoulders.

WalletConnect consists of 3 participants: your application, a bridge server, and a mobile wallet. I’d say the only participant that needs an explanation is the bridge server. It’s a dedicated server that registers applications and wallets and works like a proxy for a wallet-application interconnection.


Let’s dig into the five steps of how the protocol works:

  1. Your application shares the bridge server’s session ID and address with a mobile wallet (using a deep link or QR code).
  2. Then both your application and mobile wallet get registered on the bridge server under the same session ID.
  3. Your application prepares a transaction and sends it to the bridge server.
  4. The bridge server transfers this transaction to your mobile wallet.
  5. The mobile wallet performs the transaction.

Of course, it’s an oversimplification of a protocol, but it’s quite enough for the purpose of this article. Let’s take a look at the SDKs you can use for the current platforms.

Ankr Gaming SDK

As I mentioned before, it’s a universal SDK. The same goes for the Web platform — it provides all significant features for interconnecting with the blockchain. It is based on the WalletConnect and Nethereum libraries and offers a convenient API taken from web3.js best practices.

The SDK is implemented to have an in-house system that works with contract events, which enables you to request and subscribe to events with flexible queries. Also, the SDK supports all the wallets compatible with the WalletConnect protocol (Metamask, Trust, etc.). And the cherry on top — the development is carried out by Ankr, which ensures regular updates, decent docs with examples, best practices, and articles for the Web3 newcomers.


Moralis game kit

That is the same game kit I mentioned in the Web Platform section. It has the same features and integrates with the WalletConnect and Nethereum libraries. That means you have all the Nethereum features out-of-the-box and the support of all wallets compatible with the WalletConnect protocol (Metamask, Trust, etc.).


Web3Auth SDK

Web3Auth is a platform with a mission to extend Web3 with the convenience of the Web2 Internet. They’re providing the functionality of signing in via social login providers (Google, Facebook, etc.), allowing to buy cryptocurrencies within the wallet. But as a rule of thumb, in Web3, more convenience always means less security. And it’s absolutely true for that kit. Upon signing in, it returns you a logged-in user’s private key. It means that now you are responsible for storing and protecting the main secret of a user’s wallet. And I’m not even talking about sending a private key via a network, which is an operation vulnerable to Man-In-Middle and other attacks. But if your target the user experience over security, you can use this solution. Also, you can integrate with Nethereum and get all the advantages of this library in your project — it allows you to use a private key to set up a Web3 provider.

Custom way

If you’re planning on creating your own solution for Android or iOS platforms, you would have a couple of ways to go:

  • Use third-party wallets to sign transactions. In that case, the WalletConnect protocol will help you.
  • Ask users to share private keys with you. In that case, only a high level of cryptography and security champs would help you.

Let’s consider the way with the WalletConnect protocol as the most common. You’ll have to import several libraries into your project, such as WalletConnect.Core, WalletConnect.Unity, and Nethereum. Then you will have a fascinating quest to resolve dependencies and find the proper versions of libraries. I recommend you just take them from Ankr Gaming SDK or Moralis game kit because those libraries are already set for interoperability. Among other things, you will need to deploy a bridge server to be able to connect with wallets.

Actually, I wouldn’t separate standalone platforms into a different category because they connect with wallets the same way as Android and iOS. A particular peculiarity in using WalletConnect for the standalone platforms is using QR codes instead of deep links to connect with wallets. To be honest, I haven’t tested the libraries from the previous category for all the standalone platforms, but Ankr SDK is implemented to support all of those, and Web3Auth SDK promise to work on Windows. As far as I know, there is no problem with using Nethereum on standalone platforms, that is why Moralis also can be used, though I’m not hundred percent sure about it. The recommendations on custom development from the previous section can also be applied to standalone platforms.

I’d like to say that tools for GameFi are currently in the early stages of development. There are no undisputed leaders on the market, and the development of your own SDK wouldn’t be considered an act of madness like it would certainly be for the more mature parts of development. But it’s a current state of the blockchain industry itself where each new day brings new solutions and tools. It will take a while to get to a high level of maturity.

Certainly, it’s not a full list of the Web3 solutions for Unity, but I’ve tried to find the most interesting projects related to Web3 and Unity, and range it by maturity. If you know other projects that deserve attention or want to express your point of view, let’s meet in the comments.

AuthorsKirill Sidorov (material selection, experiments with SDKs, technical writing)Evgeni Danilov (editing, breathed life in text)

News Credit

%d bloggers like this: