Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now
1

It's okay to define a contract instance every time you need it, as the ABI and deployed address haven't changed, and your web3 library is only creating a Javascript object off-chain, not checking on-chain or doing anything slow over the network. I think the efficiency difference is negligible, but if you can create your contract instance once and pass it ...


1

The solution was to create and add the account from which to send the transaction into a wallet. adding the line web3.eth.accounts.wallet.add('address_private_key') above the method.send() fixed it for me.


1

This line: contract.getCounter().send(); should be contract.getCounter().call({from:yourAccount}); Reason When you request state from Ethereum, it doesn't cost gas because you're just reading a node. If the node is on your computer, you're just reading your hard drive. On the other hand, when you change state, it requires miners to pick up the change ...


Only top voted, non community-wiki answers of a minimum length are eligible