Dapp-Development
錯誤:遷移 kovan
來自:truffle migrate –network kovan >> ProviderError: VM Exception while processing transaction: revert
>truffle migrate --reset --network kovan Warning: Both truffle-config.js and truffle.js were found. Using truffle-config.js. Compiling your contracts... =========================== > Compiling .\contracts\Token.sol > Artifacts written to D:\Blockchain Dev\t2\build\contracts > Compiled successfully using: - solc: 0.5.8+commit.23d335f2.Emscripten.clang Warning: Both truffle-config.js and truffle.js were found. Using truffle-config.js. Migrations dry-run (simulation) =============================== > Network name: 'kovan-fork' > Network id: 42 > Block gas limit: 0x7a1200 1_initial_migration.js ====================== Replacing 'Migrations' ---------------------- > block number: 13446679 > block timestamp: 1568292923 > account: 0x8cf9f3920726e671716Fe6c44821DC0b56035B8D > balance: 5.86826832679724222 > gas used: 246393 > gas price: 2 gwei > value sent: 0 ETH > total cost: 0.000492786 ETH ------------------------------------- > Total cost: 0.000492786 ETH 2_deploy_smartcontract.js ========================= Deploying 'Token' ----------------- > block number: 13446681 > block timestamp: 1568292936 > account: 0x7D163E973E31a7532dB7EfeeAaaE360FEBD48126 > balance: 99.999477718 > gas used: 261141 > gas price: 2 gwei > value sent: 0 ETH > total cost: 0.000522282 ETH Deploying 'Shop' ---------------- > block number: 13446682 > block timestamp: 1568292946 > account: 0x8cf9f3920726e671716Fe6c44821DC0b56035B8D > balance: 5.86661835279724222 > gas used: 797964 > gas price: 2 gwei > value sent: 0 ETH > total cost: 0.001595928 ETH Error: Invalid JSON RPC response: "" at Object.InvalidResponse (D:\Blockchain Dev\t2\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\web3\node_modules\web3-core-helpers\src\errors.js:42:1) at t.InvalidResponse [as onreadystatechange] (D:\Blockchain Dev\t2\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\web3\node_modules\web3-providers-http\src\index.js:92:1) at t._a [as dispatchEvent] (D:\Blockchain Dev\t2\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:27:61) at t.dispatchEvent [as _setReadyState] (D:\Blockchain Dev\t2\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\xhr2-cookies\dist\xml-http-request.js:208:1) at t._setReadyState [as _onHttpRequestError] (D:\Blockchain Dev\t2\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\xhr2-cookies\dist\xml-http-request.js:349:1) at ClientRequest._onHttpRequestError (D:\Blockchain Dev\t2\node_modules\truffle-hdwallet-provider\dist\webpack:\truffle-hdwallet-provider\Users\gnidan\src\work\truffle\node_modules\xhr2-cookies\dist\xml-http-request.js:252:47) at ClientRequest.emit (events.js:197:13) at TLSSocket.socketErrorListener (_http_client.js:397:9) at TLSSocket.emit (events.js:197:13) at emitErrorNT (internal/streams/destroy.js:91:8) at emitErrorAndCloseNT (internal/streams/destroy.js:59:3) at processTicksAndRejections (internal/process/next_tick.js:76:17) ------------------------------------- > Total cost: 0.00211821 ETH Summary ======= > Total deployments: 3 > Final cost: 0.002610996 ETH Warning: Both truffle-config.js and truffle.js were found. Using truffle-config.js. Warning: Both truffle-config.js and truffle.js were found. Using truffle-config.js. Starting migrations... ====================== > Network name: 'kovan' > Network id: 42 > Block gas limit: 0x7a1200 1_initial_migration.js ====================== Replacing 'Migrations' ---------------------- > transaction hash: 0x71f1ecd87d73ac93b1a0b851cbec1ee14ea33f4c6e8d1f0337c5f2a735238565 > Blocks: 1 Seconds: 5 > contract address: 0x99B3B76E319A398B7f31C425Bf86bf3F9A00e1ef > block number: 13446694 > block timestamp: 1568292972 > account: 0x8cf9f3920726e671716Fe6c44821DC0b56035B8D > balance: 5.86353325279724222 > gas used: 261393 > gas price: 20 gwei > value sent: 0 ETH > total cost: 0.00522786 ETH > Saving migration to chain. > Saving artifacts ------------------------------------- > Total cost: 0.00522786 ETH 2_deploy_smartcontract.js ========================= Deploying 'Token' ----------------- > transaction hash: 0x6a66f4e346b295ae6a7b930049dcf2a78d1f60466acc28e06a2f6d382bdc2a21 > Blocks: 2 Seconds: 5 > contract address: 0x55eAe6a8AA8d78E76E23469D60fCA9D871acf737 > block number: 13446699 > block timestamp: 1568292992 > account: 0x8cf9f3920726e671716Fe6c44821DC0b56035B8D > balance: 5.85716997279724222 > gas used: 276141 > gas price: 20 gwei > value sent: 0 ETH > total cost: 0.00552282 ETH Deploying 'Shop' ---------------- > transaction hash: 0xcbc525179d836c872fcc4abf4554580bff9407a89f0b47b83494c6854d2f5b2b > Blocks: 1 Seconds: 5 > contract address: 0x35599a6CA54496cfA5F6E57aCf7D59b0c27376A1 > block number: 13446703 > block timestamp: 1568293008 > account: 0x8cf9f3920726e671716Fe6c44821DC0b56035B8D > balance: 5.84091069279724222 > gas used: 812964 > gas price: 20 gwei > value sent: 0 ETH > total cost: 0.01625928 ETH Error: Error: Error: invalid address (arg="_to", coderType="address", value=undefined) at Object.run (C:\Users\WINDOWS\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-migrate\index.js:92:1) at processTicksAndRejections (internal/process/next_tick.js:81:5) Truffle v5.0.33 (core: 5.0.33) Node v11.12.0 PS D:\Blockchain Dev\t2>
看起來與上一個問題中的問題相同。您應該添加兩個最後的參數(0 和 2)以
HDWalletProvider(mnemonic, link, 0, 2)
現在您的帳戶$$ 1 $$未定義,因為它沒有被提供者解鎖。您也可以嘗試
console.log(accounts)
檢查未鎖定帳戶的數量。 此外,我仍然看到Migrations 試執行(模擬) - 這意味著您還沒有將其關閉。