Tutorial #3 - NFT¶
In this tutorial we will explain how to start using NFTs with the Stratis Plugin for Unreal Engine.
The employment of Blockchain technology within the gaming industry has become more ever more apparent with the launch of several popular play-to-earn models. The Stratis Plugin for Unreal Engine enables game developers to design, build and deploy games using existing programming languages within a familiar environment.
Non-Fungible Tokens are an area of particular interest for those developing games with in-game valuables. By introducing an NFT, the player can genuinely own in-game items, removing the risk of losing earned items through forgotten login details and account deactivations. This brings the birth of a radical change in gaming marketplaces, with decentralized platforms offering the exchange of in-game items without the need for a trusted intermediary.
For this tutorial, you need to setup Stratis Full Node, as described in the Getting started section.
Deploying a new NFT¶
At first, we need to generate a new address and fund it. You will need tokens in order to deploy and interact with an NFT.
To create instance of UNFTWrapper, we can use
contractAddress- address of deployed contract. For
createDefaultInstancemethod, canonical NFT contract address will be used.
manager- valid pointer to
outer- “parent” object for our new instance.
To deploy the NFT contract, we need to use the
ownerOnlyMinting- parameters passed to constructor of the NFT contract
callback- error-aware callback, return either transactionID of contract deployment transaction or error.
Once the transaction is mined it’s executed and your contract is deployed. After that you can use transaction id to get a receipt which will contain new contract’s address. For example:
UNFTWrapper::mint with specified target owner address will result in
minting a new NFT that will belong to that address. For example:
Getting NFT balance¶
NFT balance of address is the amount of NFTs that this address controls.
You can get it with
UNFTWrapper::getBalanceOf like this:
Transferring NFT to another address¶
To transfer an NFT you need to use
UNFTWrapper::transferFrom and specify
address from which transfer should occur, receiver address and id of a
token you want to transfer.