I can see my contract in my console. The solidity code and abi is in the the index.html. I can't figure out how to call this function and send 0.01 ether with it as well. I would think it is something like GuessingGame.playGame(function() {}) but where could I possible see where it wants it's parameters? I can get it to work in remix by doing compile > create > input .01 ether in value > hit playGame button



Using web3.js v1+, you have to:

  1. get the contract instance: const ctr = new web3.eth.Contract(abiDefinition, ctrAddress)
  2. send() a transaction to the contract method:

    const txId = await ctr.methods.playGame().send({from: sendingAccount, value: amountInWei })

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.