See this document on how set up checkpointing: https://bitcoinj.github.io/speeding-up-chain-sync
On 08/27/2017 07:22 PM, Alex Yang wrote: > I need to use BitcoinJ to create and host wallet on my own website. > However, it keeps downloading blocks and the sync seems taking forever. > I need to be able to create a wallet within a few seconds. > > Could anyone please advice what should i do to optimize the sync time? > > |ECKey key = new ECKey(); Address addressFromKey = key.toAddress(params); > Wallet wallet = new Wallet(params); wallet.importKey(key); File > blockFile = new File(“/tmp/bitcoinblocks”); BlockStore blockStore = new > MemoryBlockStore(params); BlockChain chain = new > BlockChain(params,blockStore); PeerGroup peerGroup = new > PeerGroup(params, chain); peerGroup.addPeerDiscovery(new > DnsDiscovery(params)); peerGroup.addWallet(wallet); peerGroup.start(); > peerGroup.downloadedBlockChain(); | > > -- > 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 [email protected] > <mailto:[email protected]>. > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
