Secret Heros

Secret Heroes is an NFT based card battle game based on secretNFTs - NFTs with private metadata on Secret Network. Players buy pack for fighter cards(NFTs) and don't know their opponents fighters strength before the fight.

Secret Heros

Created At


Project Description

Secret Heroes is card game based on secretNFTs. Built on Secret Network, Secret NFTs have private ownership and private metadata. More on Secret NFTs:

Players can buy NFT cards (heroes) with four different skills. Players can “battle” their cards against 2 other players. The game randomly determines a skill to evaluate and determines a winner based on which card has the highest value for that skill. The winner receives all the cards used in the battle. No player has any information about other players’ cards at any point except the winning card.

Detailed description

  • Alice buys a pack of cards, which are SecretNFTs. Each card has 4 different skills, generated based on a PRNG algorithm.
  • Alice can enter an arena to battle her heroes (NFT) with that of other players. No player has any information about other players’ heroes, so the result of the fight is not deterministic. The fight contract randomly chooses a skill to be considered in the fight. Winner (the owner of the card with the highest skill level) takes all the cards.

How it's Made

Secret Heroes uses Secret Network for game logic, unity for front-end / 3D game engine.

Secret Network

Based on Cosmos SDK, Secret Network is the first and only privacy preserving smart contracting platform. Secret smart contracts in secret network have encrypted inputs, state and outputs. Secret Heroes build upon the SNIP-721 secretNFT standard on Secret Network which is an implementation of ERC-721 with private ownership and private metadata.

There are 2 secret contracts in Secret Heroes, hero minting contract and battle contract

  1. Minting contract: Minting contract generates 3 new heroes (as in you are buying a pack of Pokemon cards) with different skill levels and rarities. Each time mint function is called, the contract generates 20 random numbers (5 random numbers for each skill). The random numbers are then converted to a number between 1-100 using modulo100. For each skill the lowest value is taken to determine the hero's score across the 4 skill levels.

  2. Battle contract: Battle contract receives secretNFTs (cards) from players. When the battle contract receives 3 cards, the contract generates a random number to determine which skill the fight will be based on. Battle contract is able to decrypt the skills (private metadata of secretNFTs), determine the winning card. The other two losing cards are then transferred to the owner (address) of the winning card


Secret Network has randomness algorithm (ChaChaRNG) that is generated in the trusted enclave of each validator. Entropy is provided to the algorithm to determine the random numbers:

  • Card (skill) generation is based on entropy provided by minting card contract creator, the player who' minting the cards and some network parameters (block height / time)

  • Battle skill selection entropy is generated by entropy from 3 players, RNG from the previous fight, and some network parameters (block height / time)

In addition to the secret contracts and secretNFTs, the hackathon project makes sure of secret.js (similar to web3.js) libraries and Keplr wallet to interact with Secret Network.

Frontend & Client

The Frontend is a slim react web application, interacting with the secret network using the secretjs library, as well as the Keplr Wallet.

The client itself is created in Unity3d, leveraging C# and WebGl for high visual quality and interactivity. Blockchain data is polled from the frontend and pushed into the Unity context to trigger game state changes. Interactions of the player can be transmitted using a procecdural .js library, that emits functions for interactions withing Unity into the frontend code.

The 3d models used are from an assetpack and are only arranged / recombined during the hackathon. Animations, interactions and everything besides the pure 3d data was created during the weekend.

background image mobile

Join the mailing list

Get the latest news and updates