Integrating Enjin Coin (ENJ) with Unity using the Enjin Unity SDK — Part 1 — Enjin Account & Wallet
What you will need
Part 1
- An Enjin developer account which you can create here: https://kovan.cloud.enjin.io/ — Make sure while developing it is on the kovan.cloud.enjin environment. Kovan is the Ethereum test net.
- The Enjin Wallet on your smart phone. It can also be emulated in Android. This example will use an emulator.
Part 2+
- The Enjin Unity SDK
- Unity3D (2019.3.0 or higher to support the Enjin SDK)
- A local server-side development environment. This example will use Express Js.
Part 1 Setting up the Enjin Wallet
Creating the wallet
Once you have the Enjin Wallet application installed you’ll be able to create a token wallet.
Press the Plus (+) button and you’ll get the ‘New Wallet’ menu.
From here select ‘Create Wallet’ and then ‘CONFIRM’.
If you already have a development wallet you can also Import it.
Give your wallet a name and then press ‘OK’.
Next, you will be given a screen where you can pick which coins you want to store in the wallet.
Before creating the wallet we want to add the Kovan test net coins.
Change to the ‘ALL’ menu and press the search button.
You want to find the Kovan Ethereum (KETH) and the Kovan Enjin (KENJ) and add these. You will only use real Ethereum and Enjin when your application is ready for production.
Note: If you can’t see the Kovan coins you will need to activate Developer Mode after you create your wallet. This will be covered in the next section. Don’t worry you will be able to add them after you create the wallet.
With both of these ticked you can ‘Create Wallet’. Or just press ‘Create Wallet’ if you don’t have developer mode on yet.
Securing your wallet
You will be prompted to enter a password for your wallet. Do this to complete the creation.
Backing up your wallet
Once you have entered your password you will be asked if you want to backup your wallet. Since this is a development wallet you don’t have to, but it is recommended not to skip this. If you forget your password you will not be able to recover your wallet if you don’t create a backup.
When you select ‘BACKUP’ you will be given your 12 recovery words. Write these down somewhere. The Enjin wallet will ask you some questions about the words to make sure that you wrote them down correctly. These words will need to be re-entered in the same order and same spelling when you import a wallet.
Important side note: For a testing wallet it’s not as important, but for your actual wallets NEVER store the recovery words somewhere where they can be easily accessed. If someone has your recovery words then they have your coins. Never share your password or recovery words with anyone.
Developer mode
If you weren’t able to add the testing coins in the last section you probably didn’t have developer mode turned on. See the steps below and refer to the images.
- Open the menu
- Go to ‘SETTINGS’
- Scroll to the bottom of settings until you reach the app version.
- Tap the app version 10 times or until it tells you that developer mode has been turned on.
Tap/Click App Version until Developer mode turns on.
(If needed) you can now add the testing Kovan coins.
Go back to the menu and select ‘WALLETS’.
From the wallets menu you can add additional coins by pressing the plus (+) button. This will bring up the same menu from before, where you can search for ‘keth’ and ‘kenj’. Add these.
Getting testing coins
You might, however, notice a small problem. You don’t have any KETH or KENJ. This is where the Kovan Faucet comes in. In order to get some free coins though, you’ll need to know your wallet address first. We can find this out as we create and link a testing project.
Creating a developer account on the Kovan test net
To utilise Kovan coins you will need a project and Enjin developer account on the Kovan instance of Enjin.
Visit https://kovan.cloud.enjin.io/ and create an account.
Make sure it is kovan.cloud
Once you create an account and verify your email you will be able to access the developer console. You will notice it says Ethereum Kovan so you know you’re in the right spot. Press ‘Create Project’ to create a project.
Enter a name and description and you can upload an image if you want, but it’s optional. When you’re ready press ‘SAVE CHANGES’.
We are now ready to link our wallet and collect our Kovan coins.
Press ‘Please link your wallet’ on the left-hand side of the page. This will take you to a page containing a QR code and an ID Code. Open up your Enjin Wallet and select LINK PROJECTS from the menu. Then you can press the ‘LINK PROJECT’ button on the above page.
If you’re on your phone you can scan this code on the Enjin Wallet.
If you’re on an emulator you can just enter in the ID Code.
You will also be prompted to enter your password. When you do, it will load and then you will receive a confirmation.
When you’re done, refresh the page to make sure the wallet did link. You should see your wallet address.
Unfortunately it’s still empty… but we can do something about that. We’ll now use the Kovan Faucet to get some KENJ and KETH.
Click on the wallet address to copy it to your clipboard.
Then visit: https://kovan.faucet.enjin.io/
You will arrive at the Faucet Dashboard.
Paste in your wallet address and then press ‘Get testing KENJ’.
You will shortly receive a confirmation that the transaction was successful.
If you get the above success message, return to your Enjin wallet and check your wallet balances. You should have received 200 KENJ and 0.01 KETH.
Note: You may have to click on the coin before the wallet balance will update.
End of part 1
Part 2 (coming soon) will cover the Unity SDK and the GraphQL platform.