游戏平台只是一个简单演示,方便迁移到其他项目。
- 发布游戏 账号一
- 兑换代币 账号二
- 购买游戏 账号二
- 评价游戏 账号二
- 游戏展示
- 其他功能: 查看已购买的游戏、查看已发布的游戏、开始游戏......
- 后续功能: 搜索、分类、游戏排行、最新资讯、帮助中心...... 代币合约可以采用ERC20 代币标准
- 安装
$ wget https://dist.ipfs.io/go-ipfs/v0.4.13/go-ipfs_v0.4.13_linux-amd64.tar.gz
$ tar -zxvf go-ipfs_v0.4.13_linux-amd64.tar.gz
$ cd go-ipfs
$ sudo mv ipfs /usr/bin/ipfs
$ sudo chmod 755 /usr/bin/ipfs
- 配置
$ ipfs init
$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST", "OPTIONS"]'
$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
- 启动
$ ipfs daemon
open http://localhost:5001/webui
- download
- save
Setting -> Reveal Seed Words
- set
Setting -> Customer RPC
as http://127.0.0.1:7545
- 安装
sudo apt-get install nodejs
sudo apt-get install npm
sudo npm install -g truffle
- 目录
contracts/: Directory for Solidity contracts
migrations/: Directory for scriptable deployment files
test/: Directory for test files for testing your application and contracts
truffle.js: Truffle configuration file
- download
- open the ganache, set Mnemonic as your MetaMask Seed Words, and Restart
- open the metamask, Reset Account.
- Every time you open ganache have to
reset
metamask! - Every time you open ganache have to
reset
metamask! - Every time you open ganache have to
reset
metamask!
# 启动 IPFS
$ ipfs daemon
# 启动 ganache
$ ./ganache
# 进入工作空间
$ cd mygame
# 安装项目依赖
$ npm install
# 编译
$ truffle compile
# 部署
$ truffle migrate
# 启动
$ npm run dev
- 文档
- 插件
- 案例