Inspiration

As playing is probably the best way to learn new things, the purpose of this game is to allow everyone (especially people NOT familiar with blockchain, dapps and DeFi - we think about most our close friends and family), to play and get fun with these new concepts, in order to get a better understanding of what it is and how decentralized solutions differ from traditional ones, in particular in DeFi.

Remember how the classical Monopoly game let us understanding the basics of money, banks, loans, investments, capitalism. DeFi-Venture reinvents the Monopoly game, adapting the concepts and mechanism towards those emerging in the blockchain ecosystem.

By playing this game, the players learn how to interact with the blockchain. We also hope this will allow mainstream people to realize how some decentralized solutions redefine the way the financial services can be delivered. They would have a better understanding of the DeFi revolution, and eventually it would help them to jump in.

What it does

DeFi-Venture is a turn-based strategy game. As a player, you take the role of a crypto-entrepreneur and your goal is to become the wealthiest player, through founding and developing businesses in the crypto-space.

Game Rules

All players start with the same amount of cash and from the Genesis block. When it's your turn: roll the dices, and move on the board. Image: RollTheDices

  • When you land on a Startup, you can decide to found it only if no other player did it before. You have to pay the initial capital. Now the startup is yours.
  • If you land on a startup that is already owned by another player, you have to buy its product and pay the owner. Image: PayTheBill

So, basically, the more startups you own, the more revenues you can expect.

  • When you land on a Chance block, you pick a card and you have to perform an action like pay or receive cash.
  • When you land on the Covid block: Bad luck! You’re locked down in Quarantine and you can’t play the next round.

To grow your wealth, you must invest in your startups by injecting more cash, to increase your revenues when other player land on your blocks.

With the DeFi services, you can earn interest by staking cash, or borrow money by locking your assets as collateral.

Your investments can also be funded by performing an ICO, that means issuing and selling tokens for your startup. Image: DeFiServicesICO

Moreover, there is an in-game marketplace to exchange assets between players. Image: Marketplace

How I built it

Architecture

Image: Architecture

  • DeFi-Venture is a fully-decentralized game, meaning that all the game’s mechanisms are performed on the Matic blockchain by a set of smart-contracts.
  • PORTIS is used as a gateway to connect to the Matic Blockchain. This is a very good solution to embark users that doesn’t have a crypto-wallet yet.
  • A GameFactory contract is responsible to create the other contracts required for a game session.
  • There is an ERC20 smart contract to represent the in-game currency, an NFT contract to manage ownership of startups, a game master contract to implement and check the game rules, and a marketplace contract to manage exchanges.
  • In addition, a Chainlink VRF Coordinator is also used to generate random numbers.

Typical interaction

Image: SequenceDiagram

  • The user rolls the dices by calling the gamemaster contract, that returns the random values for dices, the new position reached by the player on the board, and the available options he can choose.
  • Then, the player chooses one of them and call the contract again to perform the required actions.
  • For this example, the player is acquiring an asset, paying for it a certain amount of tokens.

Challenges I ran into

One of the main challenge we had to face is to allow mainstream people (that don't have a crypto-wallet yet) to embark in the game. PORTIS comes with a solution for users to quickly get an Ethereum address and connect the Blockchain without having to install Metamask and generate keys.

Then, because we need very cheap and fast transactions, we are deploying the smart contracts on MATIC blockchain. We have tried to deploy on RSK testnet, but this was compromised by getting over the gas limit allowed by this network. Failed createGame() transaction

We also need to generate random numbers (when players roll the dices or pick a Chance card), so we are using CHAINLINK VRF to get that. Note: at the time of submission, CHAINLINK VRF is not available yet on Matic testnet (Mumbai). We have deployed a private CHAINLINK node, an Oracle contract and a VRFCoordinator on Mumbai, but documentation and support from CHAINLINK is still required to activate the VRF feature. Finally, we would appreciate the players would not have to pay transaction fees. Using a Gas Station Network would be a satisfying solution. However there is no Gas Relay straight available on Mumbai yet and we didn't have time to deploy our own GSN.

Accomplishments that I'm proud of

Even if not all mechanism are implemented, the basis are now here to provide the players with an interesting experience. I've managed to develop this game as fully decentralized. It's completely open (you just need an interface to connect the smart contracts), so any developer could propose its own gateway, or create some bots that would be able to play automatically with a predefined strategy.

What I learned

I've learned more about decentralized applications in general. In particular:

  • Smart contracts interactions
  • Deploy on Layer 2 blockchain solutions:
    • MATIC
    • RSK
  • Chainlink : how to deploy a node, an oracle contract, how does it work all together
  • Gas Relay : how to use meta-transactions to avoid the end-users to have to pay the transaction fees.

What's next for DeFi-VEnture

The development of this game doesn’t stop now.

First, I need to complete the most advanced mechanisms of the game.

I also need Chainlink VRF to be deployed on Matic (that is not done yet)

I want to connect a Discord server and bot to develop a community of players.

Then, I would be able to deploy on Mainnet.

Moreover, the users should be able to play without paying fees, thanks to a GasRelay that would be funded by a no-loss prize pool, but I didn’t have the time to integrate it yet.

Finally, I think about a 3D version of the playground deployed in Decentraland.

And more than that, I would like to play with family and friends.

Built With

Share this project:

Updates