Inspiration

I was inspired by RPG games from the 90s and still enjoy playing them. The challenge lies in building sustainable game-economies for gaming on blockchain and finding the right fit of infrastructure for your gaming community, so that the hours spent playing games turn out to be rewarding and productive.

What it does

Vechain-Thor RPG Quest

Screenshot 2022-05-30 at 7 36 17 PM

An RPG dungeon game wherein the player has to encounter and fight monsters who are guarding chests, and gain loot from the chests in the form of ERC-20 equivalent VIP-180 $DGN (in-game) token (Dungeon Token), deployed on Vechain-Thor Testnet.

The player has to finally unlock the locked gates by seeking the keys to the token-gate who is locked inside a wall in the dungeon, and ultimately defeat the the ultimate evil angel who possesses the final key to the Vechain NFT (VIP-190) token. Once the user collect the Vechain NFT collectible, an NFT is minted to your NFT-Trophy Gallery(to be implemented).

The VeChainThor blockchain currently already has the VeChain Multi-Party Payment Protocol (MPP). Using MPP a user can interact with a smart contract, while the smart contract pays for the transaction fee using a delegator service uinquely developed on Vechain Thor, making use of the dApp for the end-user completely free.

Contract Addresses:

In game transactions along with contract Clauses for the trasnactions, can be viewed on the explorer

image image

The clauses associated with this contract call can be viewed in the clauses here on https://explore-testnet.vechain.org/transactions/0x08d6e07a5edde04843a5dd3ab562d7b93e7225ddbac59b4bc80ff851bb7c381c#clauses

Game Actions

  1. Collecting a chest earns you 4 $DGN tokens, with VTHO used for signing the transaction. The event triggers connection to the Sync2 Desktop wallet as shown below. image

  2. Then we open a transaction is signed and can be viewed in the activities. Note that the wallet is referring to the Token contract f(x) --> ending in ****EdD1, and incurrs a small transaction fee of 0.81VTHO.

    image image image image

  1. Kill enemies with the dagger. Every enemy character has a different HP. image

  2. Analytics can be viewed in the sponsorship dashboard, where we can add signer and reciver accounts, contract ABIs and whitelist accounts to sign transactions and even delegate transaction for others on the network. You can upload your contract ABI to have it decoded and see more details: Screenshot 2022-05-30 at 8 43 01 PM

  3. Player has three lives, can view number of DGN coins collected, and also the number of Vechain NFTs collected. image

  4. Player has to break walls unlock the room, and set the mysterious wizard free and obtain a key to unlock the token-gates. image

  5. In the end, the player kills the evil angel, obtains the key to the 2nd token gate and receives the Vechain NFT that marks the level pass.

    image Screenshot 2022-05-30 at 8 50 26 PM

How we built it

Tools and Tech Stack

  • The game is built on Phaser.
  • The app is built in React
  • Smart contracts are written in solidity since VeChain Thor is an EVM compatible blockchain network.
  • We use HardHat Thor package developed by Vechain-Energy, to deploy our smart contracts to https://testnet.veblocks.net using a wallet whitelisted on Vechain Energy Sponsorships Dashboard at https://sponsor-testnet.vechain.energy/by/105
  • Other packages used include web3 providers connex, implemented using Connex JS and Thor RestFUL APIs, vechain ethers and many more, used to interact with the smart contract ABI while emitting in-game events. Vechain Thor Blockchain provides the perfect platform to build games due to its scalability and robust infrastructure, and moreover low gas fees which are paid using VTHO tokens.
  • Sync2 Wallet to sign transactions on Vechain and return responses to the NodeJS dApp.

Challenges we ran into

  1. Connecting to Sync2 wallet on node using web3 providers connex API for the first time
  2. deploying contracts to thorchain using hardhat thor.

Accomplishments that we're proud of and what we learned

  1. Learning hardhat thor
  2. Learning Vechain infrastructure, obtaining funds from testnets
  3. setting up sponsorships and delegations by whitelisting contracts, addresses and ABI
  4. Interfacing with ABI using web providers connex

What's next for Vechain-Thor RPG Quest

  1. To have an in-game DEX, to allow users to swap other tokens on Vechain to DGN token, in order to buy various assets and collectibles in-game.
  2. In game marketplace to allow users to buy and sell NFT characters and game potions and equip the same in further levels.
  3. 1v1 gameplay between two warriors by staking tokens and fighting for the stake
  4. Ability to craft Rare NFTs and equip them, by on-chain XP (on-chain reputation), that is attained while playing the levels.
  5. Genesis NFT minting event through a mystery box sale, based on character rarity.

Built With

  • ethers
  • evm
  • hardhat-thor
  • phaser.js
  • solidity
  • sync2
  • vechain
  • vechain-energy
  • web3
  • web3-providers-connex
Share this project:

Updates