Try this one to create wallet :
public class WalletCreation { public static void main(String[] args) throws IOException{ int bits = 128; SecureRandom random = new SecureRandom(); DeterministicKeyChain determinstickeychain = new DeterministicKeyChain(random, bits); DeterministicSeed seed = determinstickeychain.getSeed(); System.out.println("seed " + seed.getSeedBytes()); Wallet wallet = Wallet.fromSeed(TestNet3Params.get(), seed); ECKey eckey = new ECKey(); wallet.importKey(eckey); wallet.saveToFile(new File(UUID.randomUUID().toString()+".dat")); System.out.println("Wallet has been created"); System.out.println("wallet address--->"+wallet.currentReceiveAddress()); System.out.println("wallet balance -->"+wallet.getBalance().toFriendlyString()); } } On Monday, November 13, 2017 at 11:40:19 PM UTC+5:30, v e wrote: > > Thanks ajit, > > I am trying to create a new Wallet by giving something like: > > Wallet wallet = new Wallet(params); > > wallet.autosaveToFile(new File("app.wallet"), 1000, > TimeUnit.MILLISECONDS,null); > peerGrp.addWallet(wallet); > > > If i create a new wallet how do i initialize the balance instead of using the > existing ones? > > > On Mon, Nov 13, 2017 at 9:08 AM, Ajit Soman <ajitd...@gmail.com > <javascript:>> wrote: > >> use testnet faucet to send test bitcoin to your wallet address. link: >> https://testnet.manu.backend.hamburg/faucet. >> >> Use below code to load wallet file and get balance: >> >> File file = new File("195da336-a311-4f69-8707-fcfb5f61dd5a.dat"); >> Wallet wallet = Wallet.loadFromFile(file); >> System.out.println(wallet.getBalance().toFriendlyString()); >> >> // Set up the components and link them together. >> final NetworkParameters params = TestNet3Params.get(); >> BlockStore blockStore = new MemoryBlockStore(params); >> BlockChain chain = new BlockChain(params, wallet, blockStore); >> >> >> final PeerGroup peerGroup = new PeerGroup(params, chain); >> peerGroup.setFastCatchupTimeSecs(wallet.getEarliestKeyCreationTime()); >> peerGroup.startAsync(); >> // Now download and process the block chain. >> peerGroup.downloadBlockChain(); >> peerGroup.stopAsync(); >> wallet.saveToFile(file); >> >> System.out.println("Synchronization completed"); >> System.out.println(wallet.getBalance().toFriendlyString()); >> >> >> On Saturday, November 11, 2017 at 4:04:09 AM UTC+5:30, v e wrote: >>> >>> Hi, >>> >>> This is my first time coding using this library and looking at the >>> documentation i could able to create a wallet. >>> Now I am trying to send some coins in test3network, how do load my >>> wallet with some coins programmatically? >>> >>> thanks >>> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "bitcoinj" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/bitcoinj/tujoTbBy4j4/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> bitcoinj+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "bitcoinj" group. To unsubscribe from this group and stop receiving emails from it, send an email to bitcoinj+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.