Thanks for sending also the html.
contractInstance.address in line 41 returns undefined, therefore just try to console.log contractInstance and that’s what you see:
So now try to console.log(contractInstance._address) as in the object.
Thanks for sending also the html.
contractInstance.address in line 41 returns undefined, therefore just try to console.log contractInstance and that’s what you see:
So now try to console.log(contractInstance._address) as in the object.
These is an issue that you have to troubleshoot, because you are the one knowing in which network you contract has been deployed and if it still is.
I checked your contract address on ropsten and it does not seem that you deployed it there
Have you deployed it in your local blockchain? Is the contract still deployed, have you deployed a new instance?
Does the contract address in your web3 instance matched the contract deployed in the blockchian?
Take some time and investigate these things.
Happy coding
Hi @filip
When I console.log(contractInstance) at first I could not find main.js file. After restarting coumputer I could see the main.js file with the error Failed to load resource: the server responded with a status of 404 (File not found)
I have connected MetaMask and using brave browser. How to solve this?
Thank you.
Hey @oneworldcoder
No worries, the favicon missing is not a bug
A favicon short for favorite icon, , is a file containing one or more small icons.
Example
From what I see in your console, you don’t have any issue.
Happy coding,
@dan-i my test transaction has failed. Do you have any suggestions? MetaMask indicates that there is 99.9702 ETH in the account, but when I input values in the website and click the add data button nothing appears to happen (i.e. it does not ask me to confirm). When I refresh MetaMask, it appears to give an insufficient funds error -
My code is as follows:
$(document).ready(function() {
window.ethereum.enable().then(function(accounts) {
contractInstance = new web3.eth.Contract(abi, “0x61e8C7256858091252B14563bBEF4AC9Bf776C0d”, {from: accounts[0]});
console.log(contractInstance);
});
$("#add_data_button").click(inputData)
});
function inputData() {
var name = $("#name_input").val();
var age = $("#age_input").val();
var height = $("#height_input").val();
var config = {
value: web3.utils.toWei(“1”, “ether”)
}
contractInstance.methods.createPerson(name, age, height).send(config);
}
Specify the account that has to send ether in your config (in your case seems to be accounts 3)
var config = {
value: web3.utils.toWei(“1”, “ether”)
}
contractInstance.methods.createPerson(name, age, height).send(config);
@dan-i - Fyi: The account did not appear to be the issue because my account 3 in MetaMask had the same public account address and private key as Ganache’s account 0. Updating the code to 3 failed so I returned the code to 0. In the event another has this issue, I removed MetaMask then reinstalled. For some reason, this resolved the issue without having to make any changes. Thanks
Hi @filip I am trying to get the data from the contract, but I keep getting this error :
I have connected the account from ganache with metamask and I have ganache open, I have also deployed the contract by using “migrate --reset” and the account that I am using has 85 eth in it. Do you have any suggestions?
Thank you.
Hi @filip and everyone:
I am following the video and try to deploy People Dapp into my local webserver. I don’t receive any error
. But I think the main.js is not sourced probably, so I cannot get any response on the contractInstance. Would you get me some hints on what is missing? I have uploaded the code into my Github : https://github.com/kwokkawai/dapp-templateThank you,
Hey @jaykch
That’s most likely an issue with your dapp, can you describe how to reproduce it and post your code?
Cheers,
Dani
I see Metamask warnings in your code but not errors. Does your dapp work correctly?
HI Dan,
Thanks for your help
Basically, I am setting up the Dapp. However, I cannot get the console.log(contractInstance) log showing on my chrome console. I have added the main.js on index.html, I have pasted the api into api.js, I have changed the contract address in main.js. but you see, I have put the console.log in multiple places, but I still don’t get any log from the browser. I have checked the setting on my google chrome, I think I have enabled the neccessary preference setting.
Hey @Paul_Kwok
Thanks for uploading your dapp.
Do you correctly see this console.log("hello");
?
Just for the sake of testing, please try to use another browser.
Let me know the result and also post a screenshot of your google console.
Push your contracts to github so that I can clone your repo and test it myself.
I wish you a great day.
Cheers,
Dani
Have you tried another browser as suggested in the previous post? I am able to see the contract instance using your code