我的deploy.js文件:
const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const { interface, bytecode } = require('./compile');
const provider = new HDWalletProvider(
'author wreck frown ladder bench bag inside dutch mandate pipe home extend',
'https://rinkeby.infura.io/v3/4c368968d0004941bf8c567b4ddf93ca'
);
const web3 = new Web3(provider);
const deploy = async () => {
const accounts = await web3.eth.getAccounts();
console.log("Attempting to deploy from accounts",accounts[0]);
await new web3.eth.Contract(JSON.parse(interface))
.deploy({data: bytecode, arguments: ['Hi There!']})
.send({gas:'1000000',from: accounts[0] });
console.log('Contract deployed to',result.options.address);
};
deploy();
在npm上在终端中运行部署:
错误:EVM已还原事务:{“ blockHash”: “ 0xe8897e8ba4b283b198702aa9606de4d354f5b94441cf12e4b5c15a16a7514101”, “ blockNumber”:4500938,“ contractAddress”: “ 0xba3294B11cc9Aa98cb0Fa0fC2F5d832093dA836B”,“累计使用的气体”: 2783089,“来自”:“ 0x7cfe96f849eb98d7220aa5a7911926c30a019df3”,
“ gasUsed”:1000000,“ logs”:[],“ logsBloom”: “ 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 “ status”:否,“ to”:null,“ transactionHash”: “ 0xaf0b95a399f60d26c3769007ed7a1a864e7f74781b56555b707dd067e3929810”, “ transactionIndex”:17} 在SafeSubscriber._next(/home/shreyas/inbox/node_modules/web3-core-method/dist/web3-core-method.cjs.js:1062:32) 在SafeSubscriber .__ tryOrUnsub(/home/shreyas/inbox/node_modules/rxjs/internal/Subscriber.js:205:16) 在SafeSubscriber.next(/home/shreyas/inbox/node_modules/rxjs/internal/Subscriber.js:143:22) 在Subscriber._next(/home/shreyas/inbox/node_modules/rxjs/internal/Subscriber.js:89:26) 在Subscriber.next(/home/shreyas/inbox/node_modules/rxjs/internal/Subscriber.js:66:18) 在TransactionObserver.emitNext(/home/shreyas/inbox/node_modules/web3-core-method/dist/web3-core-method.cjs.js:454:16) 在_callee2 $(/home/shreyas/inbox/node_modules/web3-core-method/dist/web3-core-method.cjs.js:424:24) 在tryCatch(/home/shreyas/inbox/node_modules/regenerator-runtime/runtime.js:45:40) 在Generator.invoke [作为_invoke](/home/shreyas/inbox/node_modules/regenerator-runtime/runtime.js:271:22) 在Generator.prototype中。 [下一个](/home/shreyas/inbox/node_modules/regenerator-runtime/runtime.js:97:21) 在asyncGeneratorStep(/home/shreyas/inbox/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24) 在_next(/home/shreyas/inbox/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9) 在processTicksAndRejections(internal / process / task_queues.js:89:5)处错误:事务已 由EVM恢复:{“ blockHash”: “ 0xe8897e8ba4b283b198702aa9606de4d354f5b94441cf12e4b5c15a16a7514101”, “ blockNumber”:4500938,“ contractAddress”: “ 0xba3294B11cc9Aa98cb0Fa0fC2F5d832093dA836B”,“累计使用的气体”: 2783089,“来自”:“ 0x7cfe96f849eb98d7220aa5a7911926c30a019df3”,
“ gasUsed”:1000000,“ logs”:[],“ logsBloom”: “ 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 “ status”:否,“ to”:null,“ transactionHash”: “ 0xaf0b95a399f60d26c3769007ed7a1a864e7f74781b56555b707dd067e3929810”, “ transactionIndex”:17} 在SafeSubscriber._next(/home/shreyas/inbox/node_modules/web3-core-method/dist/web3-core-method.cjs.js:1062:32) 在SafeSubscriber .__ tryOrUnsub(/home/shreyas/inbox/node_modules/rxjs/internal/Subscriber.js:205:16) 在SafeSubscriber.next(/home/shreyas/inbox/node_modules/rxjs/internal/Subscriber.js:143:22) 在Subscriber._next(/home/shreyas/inbox/node_modules/rxjs/internal/Subscriber.js:89:26) 在Subscriber.next(/home/shreyas/inbox/node_modules/rxjs/internal/Subscriber.js:66:18) 在TransactionObserver.emitNext(/home/shreyas/inbox/node_modules/web3-core-method/dist/web3-core-method.cjs.js:454:16) 在_callee2 $(/home/shreyas/inbox/node_modules/web3-core-method/dist/web3-core-method.cjs.js:424:24) 在tryCatch(/home/shreyas/inbox/node_modules/regenerator-runtime/runtime.js:45:40) 在Generator.invoke [作为_invoke](/home/shreyas/inbox/node_modules/regenerator-runtime/runtime.js:271:22) 在Generator.prototype中。 [下一个](/home/shreyas/inbox/node_modules/regenerator-runtime/runtime.js:97:21) 在asyncGeneratorStep(/home/shreyas/inbox/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24) 在_next(/home/shreyas/inbox/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9) 在processTicksAndRejections(internal / process / task_queues.js:89:5)/home/shreyas/inbox/node_modules/solc/soljson.js:24 (Module.asmGlobalArg,Module.asmLibraryArg,buffer);变量 __GLOBAL__sub_I_ABIFunctions_cpp =模块[“ __GLOBAL__sub_I_ABIFunctions_cpp”] = asm [“ __ GLOBAL__sub_I_ABIFunctions_cpp”]; var __GLOBAL__sub_I_ABI_cpp = Module [“ __ GLOBAL__sub_I_ABI_cpp”] = asm [“ __GLOBAL__sub_I_ASTJsonConverter_cpp =模块[“ __GLOBAL__sub_I_ASTJsonConverter_cpp”] = asm [“ __ GLOBAL__sub_I_ASTJsonConverter_cpp”]; var __GLOBAL__sub_I_AST_cpp =模块[“ __GLOBAL__sub_I_AST_cpp”] = asm [“ __ GLOBAL__sub_I_AST_cpp”]; var __GLOBAL__sub_I_ArrayUtils_cpp =模块[“ __GLOBAL__sub_I_ArrayUtils_cpp”] = asm [“ __ GLOBAL__sub_I_ArrayUtils_cpp”]; var __GLOBAL__sub_I_AsmAnalysis_cpp =模块[“ __GLOBAL__sub_I_AsmAnalysis_cpp”] = asm [“ __ GLOBAL__sub_I_AsmAnalysis_cpp”]; var __GLOBAL__sub_I_CompilerContext_cpp =模块[“ __GLOBAL__sub_I_CompilerContext_cpp”] = asm [“ __ GLOBAL__sub_I_CompilerContext_cpp”]; var __GLOBAL__sub_I_CompilerStack_cpp =模块[“ __GLOBAL__sub_I_CompilerStack_cpp”] = asm [“ __ GLOBAL__sub_I_CompilerStack_cpp”] 中止({})。使用-s ASSERTIONS = 1进行构建以获取更多信息。
有解决方案吗?