Skip to content

Instantly share code, notes, and snippets.

@sai-sondarkar
Created August 12, 2018 11:01
Show Gist options
  • Save sai-sondarkar/ec0b25a233a09ab9c61c6d5936dd5e92 to your computer and use it in GitHub Desktop.
Save sai-sondarkar/ec0b25a233a09ab9c61c6d5936dd5e92 to your computer and use it in GitHub Desktop.
const HDwalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const {interface,bytecode} = require('./compile.js');
const provider = new HDwalletProvider(
'parrot scout around below weasel purity best van group time habit enforce',
'https://rinkeby.infura.io/v3/49ed452b63ba4d3d885c289814b766cb'
);
const web3 = new Web3(provider);
const deploy = async() => {
const accounts = await web3.eth.getAccounts();
console.log('attemping to deploy the contract from account',accounts[0]);
const result = await new web3.eth.Contract(JSON.parse(interface))
.deploy({data: '0x'+bytecode, arguments: ['Hi ITM NWIT']})
.send({from: accounts[0],gas: '1000000'});
console.log("Deployed at " + result.options.address);
};
deploy();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment