Memo Game

A Hoken Tech workshop on the EOS blockchain

A video game that lives on a blockchain.

The Memo Game is a guessing game with a treasure at stake. It doesn't run on a server: its rules are written in a smart contract, a program nobody can switch off or rig. Have a go on the right, then see how it's built.

Network
EOS, Jungle 4 testnet
Contract
memogame2.gm
Languages
C++ and TypeScript

Try to guess

A simulation of the contract's rules, no real blockchain involved.

Treasure in the contract

58.0000 EOS

The next attempt costs 1.0000 EOS

# Player Word Paid

Three rules, written once and for all

The contract enforces them on its own. No referee, no admin making the calls.

Every attempt costs money

A player sends EOS to the contract and writes their word in the transaction's "memo" field. The first attempt costs 1 EOS. The money stays in the treasure.

Guess wrong and the price doubles

A wrong guess raises the fee: 1, 2, 4, 8 EOS. The more people get it wrong, the bigger the treasure and the more it costs to try again.

Guess right and take half

The right word triggers an automatic payment: half of the treasure goes to the winner. The other half stays in play and the fee drops back to 1 EOS.

So what is a blockchain?

Two pictures are enough to follow the rest of the page.

A notebook copied onto thousands of computers

A blockchain is a shared ledger. Every computer on the network keeps an identical copy, and each new line, that is each transaction, is added only if everyone agrees. That's why the past can't be deleted or rewritten.

A smart contract is a vending machine

Insert a coin, make your choice, and the machine does exactly what its program says. Nobody behind the counter. The Memo Game is just that: a machine that accepts EOS, reads the word and pays out if it's the right one.

Words you'll come across

How the game is built

Four pieces. Press "Follow a game" to see what happens when a player tries a word.

Diagram: the player uses the dApp in the browser, signs with the Anchor wallet, and the transaction reaches the EOS blockchain where the smart contract processes it. Player dApp the game's website Wallet Anchor, signs Blockchain EOS, Jungle 4 Smart contract memogame2.gm

Inside the contract

The program is about a hundred lines of C++. Here we read it piece by piece: the real code on the left, what it means on the right. Hover over an explanation to see which lines it refers to. The comments are translated; the messages between quotes are the original Italian ones from the deployed contract.


        

    The workshop, from code to a game online

    This is what we do during the workshop, in five stages. Each stage has the real screenshots and, for anyone who wants to try at home, the exact commands. All you need is a browser and a GitHub account: nothing to install.

      Resources to keep going

      Scan the QR codes with your phone or follow the links.

      Alfredo de Candia

      Who runs the workshop

      Alfredo de Candia, CTO of Hoken Tech

      Android developer with more than 60 published apps, crypto and blockchain specialist with more than 20 books to his name, and game director of over 50 games. Nominated at the NFT Awards 2020 and named best crypto journalist on Hacker Noon in 2021 and 2023.

      alfredo.decandia@hokentech.tech All Hoken Tech workshops

      Memo Game is an educational project by Hoken Tech. The tokens used are test tokens with no value.

      If you found the workshop useful, leave a review on Trustpilot.