Java Code Examples for org.web3j.crypto.WalletUtils#generateNewWalletFile()
The following examples show how to use
org.web3j.crypto.WalletUtils#generateNewWalletFile() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Web3Service.java From tutorials with MIT License | 6 votes |
public String fromScratchContractExample() { String contractAddress = ""; try { //Create a wallet WalletUtils.generateNewWalletFile("PASSWORD", new File("/path/to/destination"), true); //Load the credentials from it Credentials credentials = WalletUtils.loadCredentials("PASSWORD", "/path/to/walletfile"); //Deploy contract to address specified by wallet Example contract = Example.deploy(this.web3j, credentials, ManagedTransaction.GAS_PRICE, Contract.GAS_LIMIT).send(); //Het the address contractAddress = contract.getContractAddress(); } catch (Exception ex) { System.out.println(PLEASE_SUPPLY_REAL_DATA); return PLEASE_SUPPLY_REAL_DATA; } return contractAddress; }
Example 2
Source File: Default.java From Android-Wallet-Token-ERC20 with Apache License 2.0 | 5 votes |
public String Generation(File keystoreWallet, String passwordWallet){ try { return WalletUtils.generateNewWalletFile(passwordWallet, keystoreWallet, false); } catch (Exception ex) { System.out.println(ex); } return null; }
Example 3
Source File: PaperWallet.java From ethereum-paper-wallet with Apache License 2.0 | 5 votes |
public PaperWallet(String passPhrase, String pathToFile) throws Exception { this.passPhrase = setPassPhrase(passPhrase); this.pathToFile = setPathToFile(pathToFile); try { fileName = WalletUtils.generateNewWalletFile(this.passPhrase, new File(this.pathToFile)); credentials = getCredentials(this.passPhrase); } catch (Exception e) { throw new Exception("Failed to create account", e); } }