3

I am creating a DApp for android and want to be able to create a wallet for each user when they register. I am using web3j, can see how to make wallets in the command line but can't see how to do it in java code. Ideally it would save the users private key and data on their phone or on an equally safe server. Does anyone know how to do this?

Thanks.

1 Answer 1

3

Web3j documentation explains most of the things. I found this android ethereum wallet created using web3j. Might help you. https://github.com/matthiaszimmermann/ethereum-paper-wallet

Alternate: I would recommend cross-compiled go-ethereum for Android. This is a light client for mobile devices and does not require you to download the entire blockchain. After importing maven dependency for the same you will get an API to interact with the blockchain (example program). You can create new account, check balances and send transactions.

The only thing is that Android API is not documented hence it is difficult to work with it. I hope the developers would do something about it in the future.

Updated:

Ethereum don't have have an Android API till now, but auto complete tools in IntelliJ or Android Studio will help you. You can refer to the following code to get a little understanding of the API.

Ethereum creates a keystore file whenever you create a new account which is something like this:

{"address":"bab565b65fede.....7a98ab7c330c","crypto":{"cipher":"aes-128-ctr","ciphertext":"ab4913efa82.......d3d5fe335025596","cipherparams":{"iv":"ece5ac32........4942b58"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"bcd244b8ee3def42........0d4c78758d858d3502"},"mac":"1c618efa10d54......3f5a3e4377"},"id":"0e0416d0-2a58-43c9-86cc-2c1eaa11957b","version":3}

Where "address" is your wallet address and "crypto" constains your private key enctypted with a passphase. So ethereum will help you manage user accounts, you just have to create a mapping between usernames and wallet addresses.

4
  • Hi, thanks for the reply. Have had a look through the go-ethereum, can't seem to figure out fully how to make a wallet for a person, and also when creating their private - public key pairs where is it safe to keep the private keys for each user? Will I keep a hashed version and they will have to remember their private key and login with it? Thanks again.
    – B.K Lewis
    Jul 17, 2017 at 16:55
  • 1
    Ethereum don't have have an Android API till now, but auto complete tools in IntelliJ or Android Studio will help you. You can refer to the following code to get a little understanding of the API.
    – Upperwal
    Jul 19, 2017 at 16:43
  • I have updated the answer.
    – Upperwal
    Jul 20, 2017 at 9:44
  • Perfect, am using this now and will probably use IPFS to store the information on the users. Thanks a lot!
    – B.K Lewis
    Jul 20, 2017 at 14:13

Your Answer

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

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