Solidity Contract:
contract MyContract {
bytes32 public product;
uint public amount;
function setOrder(bytes32 _product, uint _reorderAmount,) public returns (bool success);
}
Javascript web3js (without node.js):
<script src="./web3.min.js"></script>
<script>
web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/key"));
web3.eth.defaultAccount = "0x...address of my account...";
var myContract = web3.eth.contract([...abi...]);
var contractInstance = myContract.at('0x...contract address...');
contractInstance.setOrder(web3.toHex('ProductName'),3000);
</script>
This works when I have ganache-cli running, but not on a testnet (e.g. Ropsten). On a testnet I can only getter functions, but how do I call a setter function? What am I missing here?
siloContract
? and what version of web3 you are using ? – Kaki Master Of Time May 11 '18 at 12:23MyContract
. I am using 0.20.6 – sunwarri0r May 11 '18 at 12:30coinbase
) to be able to call transactions on ropsten. – Kaki Master Of Time May 11 '18 at 12:37