web3j icon indicating copy to clipboard operation
web3j copied to clipboard

Error when calling smart contract function from web3j on android

Open abd-ashraf opened this issue 2 years ago • 2 comments

Issue_title

When I load a smart contract and try to write to smart contract i.e change the state of smart contract, I am unable to do so, upon debugging this is the message that i see "java.util.concurrent.CompletableFuture@123123[Not completed]". How can I write to smart contract ?

Issue_description

Please describe what are you trying to do and why it doesn't work

Issue_context

Please provide additional information that might be helpful

abd-ashraf avatar Apr 20 '22 04:04 abd-ashraf

java.util.concurrent.CompletableFuture@fa5f51d[Not completed]

to be precise, this is what returns after i execute this line, "contract.vote(candidateAddress).sendAsync();"

abd-ashraf avatar Apr 20 '22 04:04 abd-ashraf

@abd-ashraf Issue related to java.util.concurrent.CompletableFuture is because concurrency is not handled properly. To change the state of a smart contract you should deploy it first and after interact with is wrapper class generated with web3j. Also you can do it using transaction manager. Please let us know if this issue is still ongoing with the current web3j version and tell us how to reproduce it.

gtebrean avatar Mar 08 '23 13:03 gtebrean