我的web3版本是1.0.0-beta.41,节点版本是10.15.1 solc编译器是0.4.25
使用接口和字节码导出成功地编译了compile.js。
我的deploy.js文件
const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const { interface, bytecode } = require('./compile');
const provider = new HDWalletProvider(
"punch hello latin float quality thank armor shoulder quick daring tone tell",
"https://rinkeby.infura.io/v3/c4683f6aea9f4e65a690b46d028dcc94"
)
const web3 = new Web3(provider);当我这么做
node deploy.js 我得到以下错误
Error: Please provide an valid Web3 provider
at ProviderResolver.resolve (/home/feynman/Programs/Ethereum/Ethmarket/node_modules/web3-providers/dist/web3-providers.cjs.js:720:13)
at Web3.AbstractWeb3Module (/home/feynman/Programs/Ethereum/Ethmarket/node_modules/web3-core/dist/web3-core.cjs.js:27:51)
at new Web3 (/home/feynman/Programs/Ethereum/Ethmarket/node_modules/web3/dist/web3.cjs.js:30:68)
at Object.<anonymous> (/home/feynman/Programs/Ethereum/Ethmarket/deploy.js:11:14)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)发布于 2020-04-22 05:09:07
不建议使用tuffy-hd钱包-provider,请检查版本的兼容性。
https://ethereum.stackexchange.com/questions/66470
复制相似问题