![](/img/trans.png)
[英]Unable to deploy Solidity contract to Rinkeby network (Invalid asm.js: Invalid member of stdlib)
[英]Solidity w/ Rinkeby Test Network | Uncaught Error: invalid address
我正在介紹區塊鏈課程,並試圖將我的項目部署到網絡托管站點上。 當我在本地執行我的程序時,它工作正常並且 metamask 能夠正確處理事務。 將我的項目放在虛擬主機上后,出現錯誤:
未捕獲的錯誤:無效地址
我能做些什么來解決這個問題? 這是我的 JS:(注意:init 和 metamask 的東西都是我的教授寫的)
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}`);
}
}
);
}
我想您應該使用另一個地址,而不是您測試時使用的本地地址。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.