Truffle實踐

智能合約實踐

使用模擬器開發智能合約

1. 開發的客戶端
  1. 測試開發:EtherumJS TestRPC
  2. 正式開發:gethgit

    • 在本身的私有鏈條上建立用戶github

      geth  --identity "newEth" --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*" --datadir "cdata"  --port 30303 --rpcapi "personal,db,eth,net,web3" --networkid 999  --rpcport 8549  --targetgaslimit 4712388 console
    • 建立帳號和解鎖帳號web

      > eth.accounts
      > personal.newAccount("123456")
      > personal.unlockAccount(eth.accounts[0], "123456", 20*(60*1000))

2. 使用truffle開發框架

1. 框架一遍truffle API
  • 實踐MetaCoin,具體的步驟參考官網
mkdir MetaCoin
cd MetaCoin
truffle unbox metacoin
2. 智能合約交互

重點理解合約交互npm

solidity API
3.相關規範

3.FAQ

3.1. 版本
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: exceeds block gas limit

多是版本不對api

3.2.沒有account
Error: Expected parameter 'from' not passed to function.

there is no accountcors

3.3. 解鎖用戶
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: authentication needed: password or unlock

使用truffle框架

相關文章
相關標籤/搜索