OK i know that this is silly question but cant wrap my head around smart contracts .I am using web3j to make a simple android dapp. It should have add deposit, withdraw deposit and get current amount of deposit. And it works just great. With hardcoded contract address that i get from remix.but the problem is that when i install mu dapp to another deviance i get the same balance and all.The same thing is with different private and public keys.I get the same balance and all. but when i tried to deploy contract like this:

 private String deployContract(Web3j web3j, TransactionManager transactionManager) throws Exception {
    return MyContract.deploy(web3j, transactionManager, ManagedTransaction.GAS_PRICE, Contract.GAS_LIMIT)

and use contract adress from this code i got error:

org.web3j.tx.exceptions.ContractCallException: Empty value (0x)

So i dont know what to do here? i am using mumbai test net for polygon

Web3j.build(new HttpService("https://speedy-nodes-nyc.moralis.io/xxxxxxxxxxxxxxxx/polygon/mumbai"));

1 Answer 1


The contract address should be the same for all the users of your dApp, but in this dApp you should differentiate between public keys of the users. It is common to use a map to do this.

Use a mapping from address (the private key of the user that you can access using msg.sender) to balance. That way all the users will have different balances and noone will be able to access other person's wallet (unless you code otherwise)

  • I guess rhis is answer i looked for :) thanks :)
    – gojic
    Dec 22, 2021 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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