Solidity w/Rinkeby测试网络|未捕获错误:无效地址



我正在介绍区块链类,并试图将我的项目部署到web托管网站上。当我在本地执行程序时,它运行良好,元任务能够正确处理事务。当我把我的项目放在网络主机上时,我得到了错误:

未捕获错误:地址无效

我能做些什么来解决这个问题?这是我的JS:(注:init和元任务都是我的教授写的(

function init () {
let button1 = document.querySelector ("#button1");
button1.addEventListener ("click", buttonPress);
let button2 = document.querySelector ("#button2");
button2.addEventListener ("click", cashout);
// load Demo1.abi.json obtained from the Compiler tab of Remix
// (click the ABI button and save the clipboard contents to the file)
fetch ("./countdown.abi.json")
.then (function (response) {
return response.json ();
})
.then (function (abi) {
window.abi = abi;
});
}
function getInstance () {
let contractAddress = "hiddenContractAddress";
if (contractAddress === "") {
console.err ("no contract address set");
}
let factory = web3.eth.contract (window.abi);
let instance = factory.at (contractAddress);
return instance;
}
function buttonPress(evt) {
let instance = getInstance ();
let sender = web3.eth.accounts[0];
instance.buttonClick ({
from : sender,
value : 100000000000000000,
gas : 200000
},
function (error, result) {
if (!error) {
let currentwinner = document.querySelector ("#currentwinner");
if (sender == currentwinner.value){
window.alert("Unable to process transaction: You are already winning!");
console.log(result);
}
else{
window.alert("Your button press has been processed!");
console.log(result);
}
} else {
console.error (`get error: ${error}`);
}
}
);
}

我想您应该使用另一个地址,而不是您测试的本地地址。