hygem

Hydragem Blockchain Mining Game


Project maintained by Hydraverse Hosted on GitHub Pages — Theme by mattgraham

Hydragem


The HYDRA Blockchain Game

Mint free “magic” tokens by interacting with a smart contract on the blockchain, then combine with found & bought “blocks” to make gems having real HYDRA value!

This game consists of five tokens:

ID Name Description
💫 MAGIC Awarded to players looking for and minting BLOCK🧱
🧱 BLOCK Awarded to HYDRA staking wallets when players mint MAGIC💫
💎 HYGEM Awarded when combining and burning MAGIC💫 + BLOCK🧱
🪙 GCOIN Game payment token (1 GCOIN🪙 = 0.01 HYDRA)
🔥 FLAME Transaction gas token, value determined by creator refunds.

The goal of this game is to acquire and hold HYGEMs until they are redeemable for a value higher than the minting cost.

HYGEMs can be acquired for free by mining BLOCKs from player-owned staking wallets, or bought from BLOCK holders not participating in the game (not holding MAGIC).

How it works:

Every smart contract transaction on the Hydra chain is confirmed by a mined block, which is also what generates our coveted HYDRA staking rewards.

When a player mints MAGIC, the cost (starting at 0.01 HYDRA, or 1 GCOIN) is contributed to the HYDRA reward pool. At the same time, the address responsible for mining the HYDRA block associated with this transaction receives 1 BLOCK.

Players can acquire BLOCKs by buying from the miner for a slightly higher price, but only if the buyer is holding MAGIC without BLOCKs, and the seller isn’t holding MAGIC. This allows staking addresses to play by simply minting magic to ensure that no other players can buy the mined BLOCK out from under them.

NEW: Staking wallets can claim another address as a co-player, allowing minted blocks to be acquired for free and preventing anyone else from buying them!

Once a player has at least 1 MAGIC💫 and 1 BLOCK🧱, they can be burned together to receive 1 HYGEM💎.

HYGEMs can then be burned to receive GCOIN🪙 proprtional to the HYDRA prize pool value, and then GCOINs can be redeemed for HYDRA. This allows players to hold HYGEM until the redemption value is to their liking.

Note that HYGEM cannot be burned until the player has burned all available MAGIC+BLOCK pairs from their holdings.

Gameplay from hydra-cli

Use sendtocontract to access all below functions, and callcontract for views.

Mint MAGIC💫

This transaction sends 0.11 HYDRA to the game contract. The initial cost of minting starts at 1 G(EM)COIN, which has a value of 0.01 HYDRA. Minting costs are refunded as GCOIN, so the following transaction refunds 10🪙 to be used for future minting.

Replace ADDR=Tsjf5gGi3kJnCTfkn9ACKb3rHELVdAc8JU with your own address or leave blank to use the default address.

$ GEM=500655d58ac9d217e5265678fd0cace39a94f87b
$ ADDR=Tsjf5gGi3kJnCTfkn9ACKb3rHELVdAc8JU
$ hydra-cli -testnet sendtocontract $GEM 1249c58b 0.11 350000 $ADDR  # mint()
{
  "txid": "407fa9ac62c5b40eea640a4ad2889a654204d55a2fb19a056b0212ff4c051643",
  "sender": "Tsjf5gGi3kJnCTfkn9ACKb3rHELVdAc8JU",
  "hash160": "ca253ac9875464ddfb30f498c9e0e64bab7c6360"
}

Any amount of HYDRA beyond the mint cost is returned to the sender. The transaction can be located on the Testnet Explorer to determine the BLOCK🧱 winner.

Buy BLOCK🧱

This example uses the purchased GCOIN from the above transaction to pay for the BLOCK.

On testnet, the BLOCK holder is pretty much always the most prolific miner at TvuuV8G8S3dstJ6C75WJLPKboiA4qX8zNv.

$ hydra-cli -testnet gethexaddress TvuuV8G8S3dstJ6C75WJLPKboiA4qX8zNv
ecfdca6aced679c041241de8d12a90779f3dc71a

$ hydra-cli -testnet sendtocontract $GEM f088d547000000000000000000000000ecfdca6aced679c041241de8d12a90779f3dc71a 0 250000 $ADDR  # buy()
{
  "txid": "d904c47e330d30e955b215050cad48caa5818fc86c5db3ef2cfb81f526a9efe7",
  "sender": "Tsjf5gGi3kJnCTfkn9ACKb3rHELVdAc8JU",
  "hash160": "ca253ac9875464ddfb30f498c9e0e64bab7c6360"
}

The resulting call on the blockchain can be found here.

Any excess HYDRA paid will be returned as GCOIN, so it’s also possible to skip checking the price and send a maximum payment amount instead when the player is not already holding GCOIN.

The above is also a good example of parameter passing: in the sendtocontract call, f088d547 is the function identifier, and the rest of the data is the address parameter.

Parameters are always padded to length 64 with zeroes, and addresses are always converted to hex as above.

A tool is provided to help format smart contract calls, and includes a map of function names:

halo@blade:halos ֍ ./call.py -h
usage: call.py [-h] [-V] [-l] CALL [PARAM [PARAM ...]]

...

halo@blade:halos ֍ ./call.py --list
{
    ...
    'buy(address)': 'f088d547',
    ...
}

halo@blade:halos ֍ ./call.py "buy(address)" ecfdca6aced679c041241de8d12a90779f3dc71a
f088d547000000000000000000000000ecfdca6aced679c041241de8d12a90779f3dc71a

halo@blade:halos ֍ ./call.py burn
44df8e70

Burn MAGIC💫 + BLOCK🧱 to get HYGEM 💎

Now that 1 BLOCK has been bought, 1 HYGEM can be obtained by calling burn.

$ ./call.py burn
44df8e70
$ hydra-cli -testnet sendtocontract $GEM 44df8e70 0 250000 $ADDR  # burn() 
{
  "txid": "ae3574d14c2d0a1ed2880b7b3afa14248a9b03c577c7b5fd07c91c647c81b868",
  "sender": "Tsjf5gGi3kJnCTfkn9ACKb3rHELVdAc8JU",
  "hash160": "ca253ac9875464ddfb30f498c9e0e64bab7c6360"
}

Transaction: ae3574d14c2d0a1ed2880b7b3afa14248a9b03c577c7b5fd07c91c647c81b868

Burn HYGEM💎 for GCOIN🪙 award:

After obtaining HYGEM, it can be held, traded or burned to receive GCOINs.

$ hydra-cli -testnet sendtocontract $GEM 44df8e70 0 250000 $ADDR  # burn() 
{
  "txid": "79420b8512128971fc9e27b4b5a5b2aeb154356054e48caacb799979dc87ab9b",
  "sender": "Tsjf5gGi3kJnCTfkn9ACKb3rHELVdAc8JU",
  "hash160": "ca253ac9875464ddfb30f498c9e0e64bab7c6360"
}

Transaction: 79420b8512128971fc9e27b4b5a5b2aeb154356054e48caacb799979dc87ab9b

Redeem & exchange GCOIN🪙 with HYDRA:

GCOIN always has a 100:1 value with HYDRA and available liquidity to exchange tokens.

$ CALL="$(./call.py 'redeem(uint256)' 1.0)"; echo $CALL
db006a7500000000000000000000000000000000000000000000000000000000000f4240
$ hydra-cli -testnet sendtocontract "$GEM" "$CALL" 0 250000 $ADDR
{
  "txid": "d35582db1a20145b433d61cfd8efe64c7e36dca0b3cf18c06b79be74d8eef497",
  "sender": "Tsjf5gGi3kJnCTfkn9ACKb3rHELVdAc8JU",
  "hash160": "ca253ac9875464ddfb30f498c9e0e64bab7c6360"
}

Transaction: d35582db1a20145b433d61cfd8efe64c7e36dca0b3cf18c06b79be74d8eef497

It’s also possible to redeem all GCOIN at once:

$ CALL="$(./call.py redeem)"; echo $CALL
be040fb0
$ hydra-cli -testnet sendtocontract "$GEM" "$CALL" 0 250000 $ADDR
{
  "txid": "6bf6645e4eafece0683d2640051c802a5ac40e4fcd4fa1e764440e5b4ca0a399",
  "sender": "Tsjf5gGi3kJnCTfkn9ACKb3rHELVdAc8JU",
  "hash160": "ca253ac9875464ddfb30f498c9e0e64bab7c6360"
}

Transaction: 6bf6645e4eafece0683d2640051c802a5ac40e4fcd4fa1e764440e5b4ca0a399

Finally, to buy GCOIN using HYDRA:

$ CALL="$(./call.py coins)"; echo $CALL
22fcefbe
$ hydra-cli -testnet sendtocontract "$GEM" "$CALL" 1.0 250000 $ADDR
{
  "txid": "a8b59381681a39fddf0dc7569813d0847065d46480b45aa268103718c622275b",
  "sender": "Tsjf5gGi3kJnCTfkn9ACKb3rHELVdAc8JU",
  "hash160": "ca253ac9875464ddfb30f498c9e0e64bab7c6360"
}

Transaction: a8b59381681a39fddf0dc7569813d0847065d46480b45aa268103718c622275b

Function Details

Main Contract: 💎 HYGEM 💎HydraGem💎 [v9.4a-test] 500655d58ac9d217e5265678fd0cace39a94f87b

Functions

Generic Functions for All Contracts

All HydraGem contracts are tokens and share a common structure based from ERC20 tokens and openzeppelin libraries.

Auxiliary Contracts

Functions