问题描述
我使用 Ganache 和 nodeJS。每当我努力使用 JavaScript 部署我的合约时,都会挖掘相关块,这表明已部署给定的合约,但不会更新发件人帐户(或部署者帐户)的余额。我能看到有什么问题。
JavaScript 代码:
const Web3 = require("web3");
web3 = new Web3(new Web3.providers.HttpProvider(Web3.currentProvider));
.
.
.
const cid = <a value>;
const pid = <a value>;
const source2='path of my solidity file';
const compiledMyContract = solc.compile(source2);
const myContractJson="path of json version of my solidity file";
const myContractJs = JSON.parse(fs.readFileSync(myContractJson));
const contractByteCode="...";
const gasEstimate = await web3.eth.estimateGas({data: contractByteCode});
const myContract = new web3.eth.Contract(myContractJs.abi,null,{data: contractByteCode});
myContract.deploy().send({from:<address>,gas: gasEstimate,gasPrice:
200}).then((instance) => {
console.log("Contract mined at " + instance.options.address);
instance.methods.function_A(cid,pid).send({
from:<address>,gas: 2000000,gasPrice: 200
});
.
.
.
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)