ETHDenver: 15-17 February, 2019
The world is going to be chain-agnostic! Here is the proof!
Play cross-chain pacman in your browser. Its a proof-of-concept where one user can choose to play over Zilliqa blockchain and other one can play over Ropsten test network (Ethereum). The game seamlessly records who is winning and allows the swap of a digital sword to the winner. Along with Zilliqa and Ethereum, the game is currently using browser's own local storage as an off-chain oracle. Next task is to move this oracle to an Internet based database.
Solidity, Scilla, JavaScript, CSS, HTML5
Just clone the folder on your computer and once in the folder, run command http-server
. Make sure you have already installed http-server
from npm and your MetaMask is set to Ropsten and has some ETH in to cover the gas charges.
To play, open localhost:8080
in two tabs under same browser. Set one player for Ethereum and other for Zilliqa and play! The top score will get the sword of Aragorn as a reward. As users continue to play, the sword will keep switching between them based on the highest score.
IPFS Demo: https://cloudflare-ipfs.com/ipfs/QmR2nvCacJAQTK9drGzv1bYb95JWu7Bh1s18cgAsjxuR3Z/
- Find
contracts/HelloEthereum.scilla
andcontracts/HelloZilliqa.sol
in the project folder. - Deploy
contracts/HelloZilliqa.sol
to your favourite Ethereum testnet using remix IDE. I used ropsten and source code has ropsten contract address. - For deploying
contracts/HelloEthereum.scilla
on Zilliqa dev-net you will need to follow the quickstart example given here. For cross-reference you can see my deployment script provided inzillia-deployment-script/deployToZilliqa.js
. - Change to your ethereum testnet contract address in
js/ethereum.js
. - Change to your Zilliqa wallet private key in
js/zilliqa.js
. - To make the game compatible with IPFS, I browserified the Zilliqa-JavaScript-Library and included useful libraries here as
js/zilliqa-lib.js
. - All ethereum and zilliqa contract interaction functions are in
js/ethereum.js
andjs/zilliqa.js
.