Closed humanwhoexplores closed 3 years ago
Q.) What is the account from which the deployment was made ?
Added a line to check the balance of the account
`const deploy = async () => { const accounts = await web3.eth.getAccounts();
console.log("All the accounts we got are ", accounts); console.log("Attempting to deploy from account", accounts[0]);
let balance = await web3.eth.getBalance(accounts[0]); console.log("The balance is ", balance);
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); };`
BRO : this is not my MetaMask's Acct. : IT should be All the accounts we got are [ '0xB3870FD16fe62235017D440E3539Df784Dd4c36D' ] Attempting to deploy from account 0xB3870FD16fe62235017D440E3539Df784Dd4c36D The balance is 0
Next :-
Added deploy.js in this commit
https://github.com/humanwhoexplores/smart-contracts/commit/ba86e11888e8add4eeec4d65bf8c6bb0e1c8d41d
Bro : Added this code
var mnemonic = "SCRAP DISH BROCCOLI UPDATE LOUNGE AFRAID ARREST KNOW RENEW LEADER SUNSET COPY";
var infura_provider_url = "https://rinkeby.infura.io/v3/7985ca9520d8459b9e3ef03d4ecbe81c";
const provider = new HDWalletProvider( mnemonic, infura_provider_url);
The mnemonic is of my MetaMask Account :- but the account it get is not my account :: Why ??
Confirmed two times : the MNEMONIC is CORRECT
It works when i am testing it Locally : with Ganache Cli ! Let me take some insights from there.
Still Troubleshooting
Done : - One LITTLE ISSUE
var mnemonic = 'scrap dish broccoli update lounge afraid arrest know renew leader sunset copy'; I wrote it in :- UPPER CASE it should be in LOWER CASE
I got this while carefully auditing https://www.udemy.com/course/ethereum-and-solidity-the-complete-developers-guide/learn/lecture/9020488#overview
Back to Basics :-
The commit that solved the issue :- https://github.com/humanwhoexplores/smart-contracts/commit/fed1d1f07fdb9e57493bd9fbf119b050f2f42830
I get the above mentioned error
while deploying my contract I deploy my contract by hitting the command $ node deploy.js