0

How to create an Ethereum wallet (Keystore JSON file) in android using org.web3j:core:3.3.1-android (web3j library). Please guide me to create one.

2

Using https://github.com/web3j/web3j you can create JSON wallet file in your android external directory.

Android code to create a wallet JSON file in Downloads directory.

        public class Wallet {

// Create new wallet
public String createWallet() throws Exception {
    String path = Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS).getPath();
    String fileName = WalletUtils.generateLightNewWalletFile("password", new File(path));
    return path + fileName;
}

/* Load the new wallet file once it is created
*  Replace the File path with newly created wallet file path 
*/
public Credentials loadCredentials(String password) throws Exception {
    Credentials credentials = WalletUtils.loadCredentials(
            password,
            "/storage/emulated/0/Download/UTC--2018-03-16T19-05-15.125--833e56c5df2a654372a252658006af4d3158e9f3.json");
    Log.i("Loading credentials", "Credentials loaded");
    return credentials;
    }
}

Check https://github.com/subhodi/android-web3-lightwallet repo for creating a wallet, loading wallet, sending raw transaction, Deploy, write, query smart contract.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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