1. 程式人生 > 其它 >Dapp開發petshop——truffle官方例程

Dapp開發petshop——truffle官方例程

truffle-pet-shop

pet-shop是truffle的官方例程。

之前參考https://learnblockchain.cn/2018/01/12/first-dapp/的中文教程,但是裡面有一些錯誤,修改起來麻煩。

後面直接參加官方例程https://trufflesuite.com/tutorial/index.html,雖然是英文,但寫的很好,一步一步來。就是現在的repositotyhttps://github.com/driftalong2/petshop

使用之前,需要

1.安裝Ganache,啟動

2.在瀏覽器裡安裝MetaMask,匯入Ganache的金鑰

下載之後:

npm install
truffle compile
truffle  migrate
truffle test

最後,執行

 npm run dev

瀏覽器會自動彈開,進入這個頁面。

記錄一下使用過程可能會出現的錯誤:

  1. npm install沒有許可權,或者安裝完之後找不到安裝的包
    https://blog.csdn.net/weixin_46794385/article/details/119847646

  2. Truffle Unbox failed問題解決方法
    https://blog.csdn.net/weixin_45591812/article/details/116800865

  3. 合約版本錯誤
    https://blog.csdn.net/sinyusin/article/details/88558519