首先創建metacoin目錄,cd到該目錄,下載metacoin
前提:已安裝truffle
$ truffle unbox metacoin
編譯該項目
$ truffle compile
安裝Ganache
此次使用Ganache的圖形界面版本,打開瀏覽器導航到https://https://github.com/trufflesuite/ganache/releases 選擇相應版本下載即可
下載完成後,在終端使用chmod命令
chmod +x /ganache-2.5.4-linux-x86_64.AppImage
然後運行文件
./ganache-2.5.4-linux-x86_64.AppImage
運行結果如下:
創建個人區塊鏈
點擊continue,選擇quickstart即可生成個人區塊鏈,區塊鏈已生成十個賬戶,每個賬戶擁有的餘額爲100 ETH
部署合約
Ganache安裝調試完成後即可對metacoin進行部署,在終端鍵入命令:
$ truffle migrate
部署結果如下: