Wiki

Clone wiki

Etherlinker for UE4 / Getting started

Getting started

First steps

  • Download release archive from here: https://drive.google.com/open?id=1OH30pWSP5c8Jthd1OEHdFf3BtfmN69D8 or clone repository (Git LFS required). If you're using plugin's version from Unreal Marketplace, delete EtherlinkerExampleProject/Plugins folder. If you're not using the latest version of Unreal Engine, still download the latest archive and use its EtherlinkerServer folder as a replacement for your own engine version EtherlinkerServer folder. Also, do the same for "EtherlinkerExampleProject\Content\IntegrationServer" folder.

  • Download and configure Visual Studio to use in Unreal Engine (https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/DevelopmentSetup/VisualStudioSetup/).

  • Download and install OpenJDK 11.0.1 (read F.A.Q. to learn how to install and configure it).

  • Open provided EtherlinkerExampleProject in UE Editor (click Yes, when you will see message about missing modules to compile project). If you have any issues at this point, make sure that you installed Visual Studio (https://docs.unrealengine.com/en-us/Programming/Development/VisualStudioSetup)

  • Open from the top menu Edit -> Project Settings -> Plugins -> Etherlinker tab.

  • Set required parameters for Etherlinker plugin:

    Contracts To Compile Directory - directory, where your new custom contracts located. They will be copied to IntegrationServer and compiled when you press Compile Contracts button in UE4 Editor.

    Example: D:[Work]\ContractsToCompile

    Integration Server Source Directory - directory, where IntegrationServer located. It will be used to recompile integration server, when you press Compile Integration Server or Compile Contracts button in UE4 Editor.

    Example: D:[Work]\Etherlinker\EtherlinkerServer\Stratum

    Integration Server URL - link to the Integration Server to send requests from UE4 Project.

    Example: https://localhost:8451

    Integration Server Parameters - custom JVM parameters for Integration Server (like the amount of maximum memory, which can be used).

    Example: -Xms128m -Xmx512m

    Is Local Integration Server - set to true, if you are planning to use integration server at end-user PC or false if you're using it at your dedicated server.

    Run Integration Server Silently - set to true if you don't want to show integration server console window in the taskbar and run it purely at the background.

    Compile Contracts Script - the name of the script, which will be used to compile new custom contracts. By default is compileContracts.bat. This file should be located at [UE4ProjectDir]/Content/IntegrationServer directory.

    Compile Integration Server Script - the name of the script, which will be used to compile integration server. By default is compileIntegrationServer.bat. This file should be located at [UE4ProjectDir]/Content/IntegrationServer directory.

    Default Wallet Path - default wallet path, where Integration Server will place wallet files. You should fill it if you're planning to use the Integration server on a dedicated server.

    Infura URL - put here your access URL from Infura (https://infura.io/) to be able to interact with Ethereum blockchain from integration server.

  • If in Edit->Project Settings->Android SDK you configured Java Location (probably it equals to JDK 1.8), change its location to JDK 11 (read FAQ, Android Support section for more details).

  • Run Integration Server from the toolbar (look for Etherlinker icon) or from Top menu->Window->Etherlinker menu.

  • Run project in UE4 Editor and press "F" (for non-VR mode) or "Facebutton1" on left motion controller (for VR mode) to open Wallet Authentication widget. Load wallet data in a preferred way.

  • If you want to run java tests of Integration Server, then add wallet address, mnemonic and infura URL into application.properties in tests/resources directory inside EtherlinkerServer folder.

  • If you're developing for Mac or mobile platforms, ensure to read F.A.Q. for more details about your platform support.

Integration server management

To start/stop/restart/check integration server from UE4 Editor you can use Etherlinker menu from UE4 Editor toolbar or from Window -> Etherlinker top menu. It will use .war file, located in [UE4ProjectDir]/Content/IntegrationServer directory, which contains Integration Server. Make sure that java.exe is available in your PATH variable(so you can call it from the console without specifying a full path to it, for example) in case if something not working.

You can also run it manually from the console with "start javaw -Xms128m -Xmx512m -jar stratum-1.0.war" command from this directory.

If you don't want to use embedded Tomcat, integrated into a .war file, you can also deploy .war file in your own dedicated Tomcat instance.

It's also possible to run integration server from your UE4 project/game via blueprints/C++ code. Just use nodes, like Start/Stop/Restart/Check Integration Server for that. Keep in mind that those functions are not multiplayer-ready, which mean that you can't run them on the server and the result will be propagated to clients.

Terminal blueprint

If you started EtherlinkerExampleProject, then in Showcase level you will find a lot of terminals. Each one of them will execute a specific function, which you can see in a text box below the terminal.

The terminal blueprint will show you how you can interact with Ethereum blockchain and could be a foundation on which you will build your own logic/blueprints. Inside of it, it contains BP_EtherInteractorComponent, which contains some generic code, required to send/receive responses from IntegrationServer.

There are two main events inside Terminal blueprint: Use and OnEtherResponseReceived. Inside of Use event, we are making an EtherlinkerRequestData structure from parameters, which were set inside the terminal and send them to IntegrationServer.

Inside of OnEtherResponseReceived we are processing EtherlinkerResponseData structure, which contains the result of our operation, executed on IntegrationServer.

Terminal blueprint parameters

Let's review the variables inside Terminal blueprint, which you must set to execute requests via Integration Server and interact with Ethereum blockchain:

  • OperationType:

    There are five main operations, which you can execute on Integration Server:

    • getWalletBalance - with this operation type you can receive balance for the selected wallet. You should set the Wallet Address parameter to execute this operation. This operation won't consume any ETH.

    • deployContract - allows you to deploy a new contract and receive its address. You should specify Contract Name parameter to execute this operation.

    • createWallet - allows you to create a new wallet file and receive its address and mnemonic. To make this operation work, you should specify the Wallet Path and optionally Wallet Password in BP_PlayerState. This operation won't consume any ETH.

    • transferEther - allows you to send ETH from your wallet to specific wallet directly. You should specify ReceiverAddress and Eth Amount to Send parameters. It will use your wallet credentials, specified in BP_PlayerState to make a transaction.

    • empty - no operation will be executed. Can be set in DefaultErrorProcessor terminal to receive all errors, which is not bounded to specific Sender Id

    • execContractMethod - one of the most important operation types, because it allows you to execute custom contract methods on ethereum blockchain. In order to make it work properly,you should specify Contract Address, Contract Method Name, Contract Name and Contract Method Params/Param Types in case if your methods contains input parameters. To see how to set up specific input parameters, look at "Exec contract method with parameter" section in Showcase level. This operation may consume ETH, which depends on executed method.

  • Sender Id:

    Unique sender identifier, which is using to receive a response from Integration Server. By default EtherManager component (located in BP_PlayerState) will broadcast response event to all subscribers (like terminals) and with Sender Id, you can decide if you should process this event on certain subscriber or not. You should always set this parameter and it must be unique.

  • Contract Address:

    Address of the deployed contract. Example: 0x5d260ae2d5014e450a70dc24be0f191353ec1a1e

  • Contract Method Name:

    Method, which should be executed. Example: stringTest

  • Contract Name:

    Contract name, which is the name of a Java class wrapper of solidity contract, which you will get after contract compilation. For example: com.academy.contracts.MethodParamsTester, where "com.academy.contracts." is a default package for compiled contracts in Integration Server and "MethodParamsTester" is an actual name of solidity contract.

  • Contract Method Params:

    Custom input parameters for the selected contract method. Should be in the same order as in solidity contract. If you have an array parameter, you should specify all its value in one parameter. Look at "Exec contract method with parameter" section in Showcase level for examples.

  • Contract Method Param Types:

    Types of custom input parameters for the selected contract method. Should be in the same order as in solidity contract. Look at BP_ParamTypes blueprint to see available types. Look at "Exec contract method with parameter" section in Showcase level for examples.

  • Wallet Address:

    Can be used with getWalletBalance operationType only and specify wallet, which balance you want to check.

  • Gas Price:

    The higher the value, the faster your transactions will be processed. The value should be in Wei format. Default value: 22000000000

  • Gas Limit:

    The maximum amount of units of gas you are willing to spend on a transaction. The default value is 4300000

  • Should Convert Result from Wei To Eth:

    Allows you to receive results in user-friendly ETH format instead of long Wei format with a lot of digits. It's recommended to set it true in transferEther, getWalletBalance operations and in execContractMethod if the method returns value in Wei format by default.

  • Infura URL:

    You should specify your custom access URL from Infura (https://infura.io/) to be able to interact with Ethereum blockchain from integration server.

  • Receiver Address:

    Can be used with transferEther operationType to specify wallet on which you will send ETH.

  • Eth Amount To Send:

    Can be used with transferEther operationType in order to specify how much ETH you want to send.

  • Server Address:

    You can specify custom URL for Integration Server, if you want to interact with different Integration Servers. If this value is empty, then value from Etherlinker plugin settings will be used by default.

  • Can Be Used:

    If set to true, then user can interact with terminal. If set to false, then user can't use terminal.

  • Use Current Wallet As Wallet Address

    If true, then a terminal will use Wallet Address from BP_PlayerState instead of an address, which was set in the terminal via Wallet Address variable. This will work with getWalletBalance operation type. In all other cases wallet address from BP_PlayerState will be used instead by default.

  • Use Current Wallet Address As First Parameter

    Many built-in contracts have methods to check the balance of various things and require to specify wallet address as the first parameter. This flag will set the first parameter to the current user wallet address. You still need to set some pre-defined value (no matter what) as a first parameter (which will be ignored later) to add more than one pre-defined parameters to request.

User wallet management

In order to execute operations on Ethereum blockchain, which required gas to operate, you should set user wallet parameters. You can do this at BP_PlayerState blueprint manually (good for tests) or via provided wallet authentication widget (press "F" in Showcase level with non-VR pawn).

Let's review those parameters:

  • WalletAddress:

    Your wallet address, which you will use to make a transaction on Ethereum blockchain.

  • WalletPassword:

    If your wallet has a password, then put it here.

  • WalletMnemonic:

    If you don't want to use wallet files, you can specify BIP39 12-words wallet mnemonic here to get access to the wallet.

  • WalletPath:

    You can specify a directory, where newly generated wallets will be added or specify the certain path to wallet file if you want access to the wallet via wallet file.

  • WalletAuthType:

    You can specify two different types to access wallet: "Mnemonic" and "PrivateKey". Mnemonic will allow you to access wallet with BIP39 12-words mnemonic and PrivateKey will allow you to access wallet via selected wallet file.

Those parameters will be automatically added in each request to IntegrationServer.

Each request, which making changes in Ethereum Blockchain, will take some time to execute. Execution speed depends on gas price, which you were set and some other factors. You should notify your user that operation is in progress and later tell him a result of operations. If you just started Integration Server, then the first operation could take few seconds to run on the server(due to server initialization).

Built-in contracts

There are a couple of built-in contracts, which you can use in your projects as a foundation and change them to your own needs.

Let's review them:

  • Donations.sol:

    A simple contract, which allows you to accept donations from your users to speed up the development of your project and give users additional benefits for that.

    Contract methods:

    • withdrawDonations - allows the owner to withdrawn funds from a contract to the owner's wallet.

    • donate - allows users to donate a specific amount of ETH to the contract

    • getBalance - will return the balance of the contract - how much ETH currently can be withdrawn by owner.

    • checkDonations - allows you to check how much ETH user with specific wallet address donated to your project.

  • EtherGaldToken:

    ERC20 token example. It uses some parent contracts from Open Zeppelin library as well as some custom contracts, like PremiumSubscriptionToken or PremiumItemToken.

    Contract methods:

    • withdrawFunds - allows the owner to withdrawn funds from a contract to the owner's wallet.

    • getTokenPrice - will return current price in ETH of one token

    • setTokenPrice - the owner can change the price of the token with this method

    • buyToken - allows users to buy tokens

    • checkTokenBalance - allows users to check their token balance

  • PremiumSubscriptionToken:

    This contract can be used inside your token contracts, and its main goal is to provide the ability to buy a subscription for N days to get access to certain premium features, like premium accounts, access to certain locations, unique perks, etc.

    Contract methods:

    • addPremiumSubscriptionType - allows you to add new Premium Subscription Type with certain Id and price per day.

    • editPremiumSubscriptionType - allows you to edit existing Premium Subscription Type with selected Id. You can change the price per day for this subscription type.

    • deletePremiumSubscriptionType - allows you to delete existing Premium Subscription Type with selected Id. It won't affect existing subscriptions but will prevent from buying new subscriptions with this Id.

    • getPremiumSubscriptionPricePerDay - this method will return price per day for selected premium subscription type.

    • buyPremiumSubscription - allows the user to buy a subscription with selected Id for a selected amount of days.

    • checkPremiumSubscription - this method will check if the user has an active subscription to selected premium subscription type.

    • batchAddPremiumSubscriptionTypes - allows you to add new Premium Subscription Types with certain Ids and prices per day in one batch.

    • batchEditPremiumSubscriptionTypes - allows you to edit existing Premium Subscription Types with selected Ids in one batch. You can change the prices per day for those subscription types.

    • batchDeletePremiumSubscriptionTypes - allows you to delete existing Premium Subscription Types with selected Ids. It won't affect existing subscriptions but will prevent from buying new subscriptions with those Ids.

  • PremiumItemToken:

    This contract can be used inside your token contracts, and its main goal is to provide the ability to buy unique lifetime premium items and check if the user has them. In this way, you can sell access to certain permanent premium features, access to certain locations, unique perks, etc.

    Contract methods:

    • addPremiumItem - allows you to add new Premium Item with certain Id and price.

    • editPremiumItem - allows you to edit existing Premium Item with selected Id. You can change the price for this item.

    • deletePremiumItem - allows you to delete existing Premium Item with selected Id. It won't affect existing items, but will prevent from buying new items with this Id.

    • getPremiumItemPrice - this method will return price for selected premium item.

    • buyPremiumItem - allows user to buy item with selected Id.

    • checkPremiumItem - this method will check if user has item with selected Id.

    • batchAddPremiumItems - allows you to add new Premium Items with certain Ids and prices.

    • batchEditPremiumItems - allows you to edit existing Premium Items with selected Ids. You can change the prices for those items.

    • batchDeletePremiumItems - allows you to delete existing Premium Items with selected Ids. It won't affect existing items, but will prevent from buying new items with those Ids.

  • EtherPetToken:

    ERC721 token example.

    Contract methods:

    • withdrawFunds - allows the owner to withdrawn funds from a contract to the owner's wallet.

    • getRandomEntityPrice - will return current price in ETH of random entity

    • setRandomEntityPrice - the owner can change the price of random entity with this method

    • buyRandomEntity - allows users to buy random entity

    • grantRandomEntity - allows owner of a contract grant random entity to selected user

    • createFreeRandomEntity - allows users to get free random entity if they don't have any entities

    • getEntityName - get entity name property

    • getEntityDNA - get entity DNA property

    • checkTokenBalance - allows users to check their token balance

Showcase level examples

Showcase level contains lots of examples on how to execute certain operations on Ethereum blockchain.

Let's review them:

  • Basic operations:

    Contains examples of core operations: GetWalletBalance, ExecContractMethod, DeployContract and Create Wallet. It's recommended to use those terminals as a reference on how to set specific parameters to execute certain actions on Ethereum blockchain.

  • Exec contract method with parameter:

    This group of examples will show you how to execute contract methods, which contains parameters of specific type and methods with multiple parameters.

  • Transfer ETH to another wallet:

    In this group of examples, you can see how to transfer ETH from your wallet to another wallet.

  • Donations contract example:

    This group will show you how to deploy donations contract, make a donation and check it and withdrawn funds from donations contract to the owner of a contract.

  • ERC20 token example:

    In this group of examples, you will see how to deploy EtherGald token contract and buy some tokens. You can also check your token balance via terminal.

  • Premium subscription example:

    Here you can see how to buy a premium subscription for N days and check it. Keep in mind that this example already has premiumSubscriptionType created before via JUnit test in IntegrationServer code. If you need to add/edit/delete certain premiumSubscriptionType, use methods, described above in the PremiumSubscriptionToken section of this document in the same way, like any other contract method execution via terminal.

  • Premium item example:

    Here you can see how to buy premium items and check them. Keep in mind that this example already has premiumItem created before via JUnit test in IntegrationServer code. If you need to add/edit/delete certain premiumItem, use methods, described above in the PremiumItemToken section of this document in the same way, like any other contract method execution via terminal.

  • ERC721 token example:

    In this group of examples, you will see how to interact with EtherPet token.

  • VR Examples:

    This group of examples designed to work in VR (however, some of them may be adapted for non-VR usage). Here you can find such examples like Virtual Wallet Card authentication example, portable terminals or ERC721 Entity Summon Terminal example.

Keep in mind that if you deployed new contract with a terminal blueprint, you should also change the Contract Address parameter in all terminals, which are using this contract.

Singleplayer vs Multiplayer wallet management

In the singleplayer project, all wallet data exists on the user machine. In multiplayer it exists on the server (dedicated or hosted modes).

In UE4, for dedicated server mode, in-game server instance bounded to the specific map. So if you will authenticate your wallet data in one level on the server and then change level with "Open level" node or "ClientTravel" to another, then your character will be moved to another server instance, which doesn't have any wallet data. In this case, you have to authenticate again. Another alternative is to use "Seamless Travel" (read more here: https://docs.unrealengine.com/en-us/Gameplay/Networking/Travelling) and make the server to move to another map with you (as well as all other players on this map). If player hosts a game, then he is a "Server", which means that it contains all wallet data (depends on the project, it may not be a secure option, look at dedicated server mode). So if he moves to another map with "Open level", then all players will move with it.

Local vs Remote wallet authentication

In wallet authentication widget you may find two main authentication options - Local and Remote. Let's look at the differences between them.

Local wallet authentication - means that you're using only UE4 to authenticate wallet. In singleplayer game it's obvious - all operations will happen on the user machine.
However, in the multiplayer project, your wallet data exists only on the server, which means that you still can use local wallet authentication, but with some limitations. For example, authentication with mnemonic will work almost the same, like in single player. But authentication with the private key may or may not be an option, because it requires to specify the private key path.
So you can change the widget to automatically populate wallet path with server directory and during authentication server will look at the specified directory for keys on its file system. End-users won't have access to private keys in this case and must provide passwords for wallets to make them secure. In this case, it could be similar to remote authentication with login/password, but here you will use pair address/wallet password to authenticate users.

Remote wallet authentication - means that you will use other ways to authenticate wallet. By default, there is a simple H2 database instance running within Integration Server, which holds a database with user logins/passwords/wallet data. In real production, you have to use more efficient database (like PostgreSQL) if you need high performance and security. The UE4 project will contain the Integration Server database to get proper wallet data and authenticate the user. Depends on your setup it may or not may be a secure option and probably will suit only for big projects with dedicated back-end developers.

Encryption of wallet data for remote wallet authentication

Integration server contains useful encryption utilities to save your wallet data in database securely and even move wallet data in insecure networks.

You can see usage example in CryptoAPITests.java file.

Basically, all what user need to have is a login/password pair. His password will be used to encrypt/decrypt randomly created encryption keys with AES-256. And with those keys wallet data can be encrypted/decrypted by using RSA/AES256/ECDSA/HMAC by the following algorithm:

Actual wallet data will be encrypted with AES256(PBE WITH SHA256 AND 256 BIT AES-CBC-BC). Random AES256 key will be generated (SHA1PRNG, 512 bytes) and encrypted by RSA encryption(key size up to 8192). Wallet data also will be signed with ECDSA (SHA384/ECDSA, prime192v1) to check if data was changed. Message authentication code (HMAC-SHA512) also will be generated to check if data was changed.

Don't forget to change salt in AES256.java file for better security.
For even better security you can remove symmetric key from SecuredData container and store it somewhere else.

Wallet authentication widget

Example project has built-in wallet authentication widget, which you can activate by pressing "F" button for Non-VR project or "Facebutton1" button on left touch controller for VR project to open VR Widget Selector. Let's review menus of this widget:

  • Create new wallet

    In this menu you can select which type of wallet you want to create:

    • Create local wallet

      Allows you to create a local wallet and optionally set password for it. Wallet will be created on PC, where Integration Server started. This way is good for single-player projects, so wallet keystore file will be created on end-user PC (that's why it's a local wallet). But in case of a multiplayer project, wallet keystore file will be created on the server side, because the integration server will be on the server side. In both cases, end-user in response will receive wallet address, mnemonic and password, which can be fully or partially shown to the user in a preferred way (BP_Terminal_01 blueprint shows them all). If the user already initialized wallet and created new after that, then Wallet Path from initialized wallet will be used. If wallet wasn't initialized, then EtherlinkerKeys folder inside Project Folder will be used as Wallet Path (so you can find wallet keystore file in it).

    • Create remote wallet

      Here you can create a remote wallet, which will be properly encrypted and stored in a remote custom database (by default H2) by Integration Server. User needs to enter login, password and password confirmation in order to create a remote wallet. Read "Encryption of wallet data for remote wallet authentication" section for more details about wallet encryption. In order to use this wallet later, the user has to load wallet via "Load remote wallet" menu to get wallet data from remote database. This way of wallet creation is good for multiplayer projects. Wallet management fully handled by you and not by your users. You can fully hide wallet data from the user or show them all after wallet creation/authentication, so they can use created wallets somewhere else. Wallet password and encryption password equal to the password, entered inside this menu.

  • Save current wallet

    In this menu, you can save your current wallet in an encrypted file on the local filesystem (or on server side filesystem in case of the multiplayer project). You have to enter an encryption password (not equal to wallet password) to encrypt/decrypt wallet data via AES-256 (built-in UE4 implementation was used). You also need to enter a filename. The resulted file will be placed in the EtherlinkerKeys directory inside project directory with a selected filename and .wallet extension. You can load wallet via "Load wallet from save file" menu.

  • Load local wallet

    In this menu you can select a way of loading wallet data:

    • Load wallet from save file

      Here you can load wallet data from a file, created in "Save current wallet" menu. You need to enter filename and password. File with wallet data should be located in EtherlinkerKeys directory inside of project directory and have .wallet extension. Decryption will be completed by using the provided password.

    • Load wallet with mnemonic

      In this menu you can load wallet data by using BIP39 wallet mnemonic (12 words). You need to enter wallet address, mnemonic and optionally wallet password in order to initialize wallet. If you mistyped in input parameters(entered wrong wallet address, for example), you won't be notified (wallet still will be initialized) until you will try to execute the operation, which requires ETH in order to execute.

    • Load wallet with private key

      Here you can load wallet data by using private key from JSON keystore file. You need to enter the path to the keystore file with the private key inside (if you created local wallet previously, you probably have the one) and optionally password. If you mistyped in input parameters(entered the wrong password, for example), you won't be notified (wallet still will be initialized) until you will try to execute the operation, which requires ETH in order to execute.

  • Load remote wallet

    In this menu, you can load remote wallet, created in "Create remote wallet" menu. You need to provide correct login and password. You will be notified if you entered the wrong data.

Donations widget

This widget will allow you to use built-in example Donations contract and additionally show you how to add your own custom widgets, which will interact with Ethereum blockchain.
You can activate widget by pressing "G" button for Non-VR project or "Facebutton1" button on left touch controller for VR project to open VR Widget Selector. The whole widget is pretty simple and contains two methods - donate and check donations.

Widget development steps (can be used to add your own widgets in a similar manner):

  • Create [BP_DonationsUser] interface with methods for both server and UI.
  • Implement interface in BP_PlayerState. Make sure to transmit events from client to server (look at "Process donation requests from UI" comment section in blueprint). Also, don't forget to add response processors (look at "Process responses from Integration Server" comment section in blueprint). Add a reference to [DonationsWidget] and set it via interface methods(can be done after next step completion).
  • Create [BP_Donations_UI] widget. Implement [BP_EtherWidgetInterface] interface. Implement logic to interact with the server through interface methods of Player State blueprint. Implement logic to process responses from Player State blueprint.
  • Make [BP_Donations_VR] blueprint to show the widget in VR.
  • Add proper inputs [DonationsMenu] in Edit->Project Settings->Input
  • Implement widget activation/deactivation in [BP_FirstPersonCharacter] blueprint.
  • Add widget activation method to [BP_EtherPlayerController] interface.
  • Implement widget activation method in [BP_PlayerController] - you can copy/paste from existing code. Don't forget to disable showing other widgets when your widget is active (need to change existing code checks). Also update CloseCurrentVRMenu method. You have to destroy your widget on deactivation - look for other widgets for example - this is because widget interactor not work properly with multiple hidden widgets (looks like UE4 bug).
  • Implement widget activation/deactivation in [BP_VRMenuSelector_UI] blueprint. Change widget size in BP_MotionController.

Ether Transfer widget

This widget will allow you to send Ether to other wallets.
You can activate widget by pressing "T" button for a Non-VR project or "Facebutton1" button on left touch controller for VR project to open VR Widget Selector.
The widget contains two methods - send and check balance (can also be used to check your own balance if you will specify your own wallet in receiver wallet address).

ERC20 Token User Menu widget

This widget will allow you to operate with custom tokens (EtherGald Token in Example Project) as a user (not an owner of a contract).
You can activate widget by pressing "C" button for a Non-VR project or "Facebutton1" button on left touch controller for VR project to open VR Widget Selector.

Let's review menus of this widget:

  • Buy Tokens

    Here you buy tokens, check your token balance and get a current token price. You can specify ETH amount to use to buy a proportional amount of tokens, according to the current token price.

  • Buy Premium Items

    In this menu, you can buy premium items, get item price in tokens and check if you already bought this item. You should specify Item Id manually in this widget, but in your project, it probably better to make it more user-friendly according to your project specific and use conversion from item name/icon/etc to item Id. If the item does not exist, you will see zero price and can't be able to buy it.

  • Buy Premium Subscription

    Here you can buy a premium subscription for a certain amount of days, get subscription price in tokens and check if you have an active subscription or not. If the subscription does not exist, you will see zero price and can't be able to buy it.

ERC20 Token Admin Menu widget

This widget will allow you to manage custom tokens (EtherGald Token in Example Project) as an admin (owner of a contract).
You can activate widget by pressing "V" button for a Non-VR project or "Facebutton1" button on left touch controller for VR project to open VR Widget Selector.

Let's review menus of this widget:

  • Manage Tokens

    In this menu you can mint tokens to the selected wallet address, change the token price or withdraw funds from contract to the owner's wallet.

  • Manage Premium Items

    Here you can add, edit or delete premium items. By default, between add and edit methods the only difference is in emitted events and delete event will be completed successfully even if the item does not exist.

  • Manage Premium Subscriptions

    Here you can add, edit or delete premium subscriptions. By default, between add and edit methods the only difference is in emitted events and delete event will be completed successfully even if subscriptions do not exist.

ERC721 Token User Menu widget

This widget will allow you to operate with custom ERC721 Entities (EtherPet Token in Example Project) as a user (not an owner of a contract).
You can activate widget by pressing "B" button for a Non-VR project or "Facebutton1" button on left touch controller for VR project to open VR Widget Selector.

Let's review menus of this widget:

  • Create ERC721 Entities

    Here you can buy random entities, get first entity for free if you don't have any and get a current random entity price. You should enter the correct price of ERC721 entity in order to buy it.

  • Get ERC721 Entity Info

    In this menu, you can get various info of specified entity with certain Id - Name, DNA, Owner.

  • Search ERC721 Entities

    Here you can make various search requests to get all entity ids for the specified owner, get entity count or get an entity Id by using Index value (for example, if the user has 3 entities with Ids [124,521,662], then index = 1 will return Entity Id = 521).

ERC721 Token Admin Menu widget

This widget will allow you to manage custom ERC721 Entities (EtherPet Token in Example Project) as an admin (owner of a contract).
You can activate widget by pressing "N" button for a Non-VR project or "Facebutton1" button on left touch controller for VR project to open VR Widget Selector.

Let's review menus of this widget:

  • Manage ERC721 Entities

    In this menu you can grant random entities to the selected wallet address, change the entity price or withdraw funds from contract to the owner's wallet.

Authentication with Wallet Card in VR

Wallet card will allow you to easily authenticate wallet in VR mode.
First of all, authenticate with standard VR Widgets and set master password for wallet cards.
Then take a clear wallet card and put it to authentication device to store wallet data.
Save this card like any other actor via default UE4 Save/Load Game functionality.
Next time you can simply take this card and put it to authentication device in order to authenticate wallet (don't forget to set a wallet card master password to decrypt data).
All wallet data are encrypted inside this card with AES-256 and will be decrypted only inside the authentication device.
This way will allow the user to enter wallet data only once and use them later without hassle.
You can also use multiple wallet cards to quickly switch between different wallets.

Updated