0

I am making a contract instance with web3 and then calling a function of the instance.

I don't know why this isn't automatically mining in the local Ganache.

var Logistics = new web3js.eth.Contract(LogisticsData.abi, LogisticsAddress);
console.log(Logistics);
var newBox = Logistics.methods._createBox("0x345ca3e014aaf5dca488057592ee47305d9b3e10", "0xf25186b5081ff5ce73482ad761db0eb0d25abfbf");
console.log(newBox);

Console Log

  • How is your function _createBox defined? Perhaps it is defined as view or constant? – Ismael Apr 27 '18 at 3:10
  • It's supposed to create a Box contract, which should definitely appear on the blockchain. – Rychard May 1 '18 at 15:36
0

The issue is that you need to call send.

var newBox = Logistics.methods._createBox("0x345ca3e014aaf5dca488057592ee47305d9b3e10", "0xf25186b5081ff5ce73482ad761db0eb0d25abfbf")
    .send({ from: <0xFromAddress>, gas: <gas_amount> });

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.