Unable to deploy contract on Rinkeby network using infura and mnemonic of metamask account.
I am using Atom as IDE for writing smart contract using solidity.
As soon as I execute node deploy.js, I get error as invalid member of stdlib I tried reinstalling npm, solc, truffle-hdwallet-provider but to no luck. Even the console.log does not print anything on console.
Below is the dependency in my package.json:
"dependencies": { "ethereumjs-testrpc": "^6.0.3", "ganache-cli": "^6.4.3", "mocha": "^6.1.4", "python": "0.0.4", "solc": "^0.4.25", "truffle-hdwallet-provider": "^1.0.8", "web3": "^1.0.0-beta.37" }
deploy.js
const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const {interface,bytecode} = require('./compile');
const provider = new HDWalletProvider(
'my mnenonic',
'infure URL'
);
const web3 = new Web3(provider);
const deploy = async()=>{
const accounts = await web3.eth.getAccounts();
console.log('Attempting to deploy from account',accounts[0]);
const result = 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 install
.^
in front of the version), if that doesn't work try with "1.0.0-beta.34".