Hot answers tagged

2

This is my implementation of getting the latest block number. I set up the project using https://docs.web3j.io/getting_started/#gradle import org.web3j.protocol.Web3j; import org.web3j.protocol.core.methods.response.EthBlockNumber; import org.web3j.protocol.http.HttpService; import java.util.concurrent.ExecutionException; public class App { public ...


1

If you are trying to generate a Java smart contract wrapper you should use the web3j cli. You can still use truffles contract schema. $ web3j truffle generate [--javaTypes|--solidityTypes] /path/to/<truffle-smart-contract-output>.json -o /path/to/src/main/java -p com.your.organisation.name https://web3j.readthedocs.io/en/latest/smart_contracts.html


1

The problem was actually not with the Project.load method but with .send() when using Web3j on android you have to use sendAsync().get() to make it work. So the problem is solved.


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