Contract-Deployment

發布部署合約 LinkedIn 課程 - 乙太坊:建構區塊鏈去中心化應用程序 (DApps)

  • June 12, 2019

我對乙太坊智能合約完全陌生。我正在關注 LinkedIn 上的課程

$$ Ethereum: Building Blockchain Decentralized Apps (DApps) $$. 我已經能夠按照教程編譯智能合約,但我無法將它遷移到我的測試伺服器。

我收到以下錯誤:

PS C:\Users\xxxx\desktop\contracts> truffle migrate development

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.


Starting migrations...
======================
> Network name:    'development'
> Network id:      5777
> Block gas limit: 0x6691b7


2_deploy_contracts.js
=====================
Error: SyntaxError: Unexpected token {
   at Object.run (C:\Users\xxxx\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-migrate\index.js:92:1)
   at processTicksAndRejections (internal/process/task_queues.js:89:5)
Truffle v5.0.21 (core: 5.0.21)
Node v12.4.0

我在 Windows 10 上執行

按照 LinkedIn 上的說明。松露配置是:

module.exports = {
 networks: {
   development: {
     host: "127.0.0.1",
     port: 9545,
     network_id: "*"
   }
 }
}

部署合約的腳本是:

var ApprovalContract = artifacts.require("ApprovalContract");

module.exports = funtion(deployer) {
 deployer.deploy(ApprovalContract);
}

謝謝

function遷移腳本中的關鍵字有拼寫錯誤。

引用自:https://ethereum.stackexchange.com/questions/71770