public class WalletUtils
extends java.lang.Object
| Constructor and Description |
|---|
WalletUtils() |
| Modifier and Type | Method and Description |
|---|---|
static org.web3j.crypto.Bip39Wallet |
generateBip39Wallet(java.lang.String password,
java.io.File destinationDirectory)
Generates a BIP-39 compatible Ethereum wallet.
|
static org.web3j.crypto.Bip39Wallet |
generateBip39WalletFromMnemonic(java.lang.String password,
java.lang.String mnemonic,
java.io.File destinationDirectory)
Generates a BIP-39 compatible Ethereum wallet using a mnemonic passed as argument.
|
static java.lang.String |
generateFullNewWalletFile(java.lang.String password,
java.io.File destinationDirectory) |
static java.lang.String |
generateLightNewWalletFile(java.lang.String password,
java.io.File destinationDirectory) |
static java.lang.String |
generateNewWalletFile(java.lang.String password,
java.io.File destinationDirectory) |
static java.lang.String |
generateNewWalletFile(java.lang.String password,
java.io.File destinationDirectory,
boolean useFullScrypt) |
static java.lang.String |
generateWalletFile(java.lang.String password,
org.web3j.crypto.ECKeyPair ecKeyPair,
java.io.File destinationDirectory,
boolean useFullScrypt) |
static java.lang.String |
getDefaultKeyDirectory() |
static java.lang.String |
getMainnetKeyDirectory() |
static java.lang.String |
getRinkebyKeyDirectory()
Get keystore destination directory for a Rinkeby network.
|
static java.lang.String |
getTestnetKeyDirectory() |
static boolean |
isValidAddress(java.lang.String input) |
static boolean |
isValidAddress(java.lang.String input,
int addressLength) |
static boolean |
isValidPrivateKey(java.lang.String privateKey) |
static org.web3j.crypto.Credentials |
loadBip39Credentials(java.lang.String password,
java.lang.String mnemonic) |
static org.web3j.crypto.Credentials |
loadCredentials(java.lang.String password,
java.io.File source) |
static org.web3j.crypto.Credentials |
loadCredentials(java.lang.String password,
java.lang.String source) |
static org.web3j.crypto.Credentials |
loadJsonCredentials(java.lang.String password,
java.lang.String content)
Load credentials from JSON wallet string.
|
public static java.lang.String generateFullNewWalletFile(java.lang.String password,
java.io.File destinationDirectory)
throws java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException,
java.security.InvalidAlgorithmParameterException,
org.web3j.crypto.CipherException,
java.io.IOException
java.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionjava.security.InvalidAlgorithmParameterExceptionorg.web3j.crypto.CipherExceptionjava.io.IOExceptionpublic static java.lang.String generateLightNewWalletFile(java.lang.String password,
java.io.File destinationDirectory)
throws java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException,
java.security.InvalidAlgorithmParameterException,
org.web3j.crypto.CipherException,
java.io.IOException
java.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionjava.security.InvalidAlgorithmParameterExceptionorg.web3j.crypto.CipherExceptionjava.io.IOExceptionpublic static java.lang.String generateNewWalletFile(java.lang.String password,
java.io.File destinationDirectory)
throws org.web3j.crypto.CipherException,
java.security.InvalidAlgorithmParameterException,
java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException,
java.io.IOException
org.web3j.crypto.CipherExceptionjava.security.InvalidAlgorithmParameterExceptionjava.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionjava.io.IOExceptionpublic static java.lang.String generateNewWalletFile(java.lang.String password,
java.io.File destinationDirectory,
boolean useFullScrypt)
throws org.web3j.crypto.CipherException,
java.io.IOException,
java.security.InvalidAlgorithmParameterException,
java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException
org.web3j.crypto.CipherExceptionjava.io.IOExceptionjava.security.InvalidAlgorithmParameterExceptionjava.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionpublic static java.lang.String generateWalletFile(java.lang.String password,
org.web3j.crypto.ECKeyPair ecKeyPair,
java.io.File destinationDirectory,
boolean useFullScrypt)
throws org.web3j.crypto.CipherException,
java.io.IOException
org.web3j.crypto.CipherExceptionjava.io.IOExceptionpublic static org.web3j.crypto.Bip39Wallet generateBip39Wallet(java.lang.String password,
java.io.File destinationDirectory)
throws org.web3j.crypto.CipherException,
java.io.IOException
Key = SHA-256(BIP_39_SEED(mnemonic, password))
password - Will be used for both wallet encryption and passphrase for BIP-39 seeddestinationDirectory - The directory containing the walletCipherException - if the underlying cipher is not availablejava.io.IOException - if the destination cannot be written topublic static org.web3j.crypto.Bip39Wallet generateBip39WalletFromMnemonic(java.lang.String password,
java.lang.String mnemonic,
java.io.File destinationDirectory)
throws org.web3j.crypto.CipherException,
java.io.IOException
password - Will be used for both wallet encryption and passphrase for BIP-39 seedmnemonic - The mnemonic that will be used to generate the seeddestinationDirectory - The directory containing the walletCipherException - if the underlying cipher is not availablejava.io.IOException - if the destination cannot be written topublic static org.web3j.crypto.Credentials loadCredentials(java.lang.String password,
java.lang.String source)
throws java.io.IOException,
org.web3j.crypto.CipherException
java.io.IOExceptionorg.web3j.crypto.CipherExceptionpublic static org.web3j.crypto.Credentials loadCredentials(java.lang.String password,
java.io.File source)
throws java.io.IOException,
org.web3j.crypto.CipherException
java.io.IOExceptionorg.web3j.crypto.CipherExceptionpublic static org.web3j.crypto.Credentials loadBip39Credentials(java.lang.String password,
java.lang.String mnemonic)
public static org.web3j.crypto.Credentials loadJsonCredentials(java.lang.String password,
java.lang.String content)
throws java.io.IOException,
org.web3j.crypto.CipherException
password - - password to decrypt JSON wallet stringcontent - - JSON wallet content stringCipherException - if the underlying cipher is not availablejava.io.IOException - if a low-level I/O problem (unexpected end-of-input, network error)
occurspublic static java.lang.String getDefaultKeyDirectory()
public static java.lang.String getTestnetKeyDirectory()
public static java.lang.String getMainnetKeyDirectory()
public static java.lang.String getRinkebyKeyDirectory()
public static boolean isValidPrivateKey(java.lang.String privateKey)
public static boolean isValidAddress(java.lang.String input)
public static boolean isValidAddress(java.lang.String input,
int addressLength)