Wild Ones — Our EOS Hackathon Hack
I participated in the the EOS Hackathon this past weekend with my friend Olive and we created a game called Wild Ones.
As an engineer, I like to think of blockchains as simply a new way to store, interact and retrieve data. That’s really it. I have thought long and hard about when a blockchain is actually useful and one use case that stands above most is tokenizing assets. When you want to take an item, either physical or digital, specify a limited supply, track ownership and metadata, that is a solid reason to use NFTs on a blockchain. We decided to tackle this ourselves so let’s get into the nitty gritty.
To create our game we forked Minecraft using voxel.js, a JavaScript implementation of Minecraft, and enabled in-app purchases by creating NFTs on the EOS blockchain. With only 36 hours to build, we decided to focus on tokenizing player skins. To create the NFTs we used an open source NFT smart contract, written by @eoscafeblock. This contract was well documented and easy to work with so a special thanks to Syed at @eoscafeblock for creating that contract and making it open source. We also decided to host the NFTs metadata on IPFS, which you can think of as a decentralized datastore, because why not.
EOS smart contracts are compiled with the EOS CLI (called cleos — clever, I know) to a .wasm and .abi file. Once the contacts were compiled we then used cleos to set the contracts on chain. With the compiled contracts on chain, our next step was integrating eosjs, a front end library to interact with the chain. Eosjs allowed me to programmatically transfer the assets within our app’s client.
In the demo video below you can see the “Sneaky Fox” NFT is on chain and owned by Casey at first. Then, when player1 buys the “Sneaky Fox” by pressing “Quick Buy” in the UI, the “Sneaky Fox” is transferred on chain from casey to player1. SUCCESS!
All in all, I am very happy with this hack and have learned a ton about EOS development and tooling over this past weekend. Check out our awesome working demo below! Ping me with questions on twitter @caseykcaruso.
Special thanks to EOS New York (https://www.eosnewyork.io/) and EOS Cafe Blok (https://www.eoscafeblock.com/) for helping me learn about the EOS architecture and building sweet open source tools.