<p>To make the sync faster and the wallet creation you can do by setting the checkpoints and later at the time of calling the create wallet method you can set the checkpoints for faster sync. Like I am using walletKit method of bitcoinj for wallet creation find the below code for example</p>

<pre><code>WalletAppKit kit = new WalletAppKit(params, new File(walletPath), filePrefix);
kit.setCheckpoints( ReadProperties.class.getClassLoader().getResourceAsStream("checkpoints-bitcoin"));
kit.startAsync();
kit.awaitRunning();
</code></pre>

CC BY-SA 4.0
2020-05-03T21:31:01.780Z
What is ReadProperties?
BST Kaal
CC BY-SA 3.0
2017-12-16T07:25:08.507Z
2017-12-16T07:25:08.507Z
Aman Vyas
<p>Your bitcoin node only needs to download the blockchain once, so if you leave it running in the background your website can ask it to generate a new address very quickly.</p>

CC BY-SA 3.0
2017-09-07T23:34:03.463Z
2017-09-07T23:34:03.463Z
meshcollider
<p>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. </p>

<p>Could anyone please advice what should i do to optimize the sync time?</p>

<pre><code>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(); 
</code></pre>

<bitcoin-core><bitcoind><bitcoinj><bitcoin-core-development>
Sync too low when using BitCoinJ to create and host own wallet
vaj oja
# Sync too low when using BitCoinJ to create and host own wallet

(Asked by: username_0 on 2017-08-26)

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(); 

```

**Tags:** bitcoin-core, bitcoind, bitcoinj, bitcoin-core-development


---

## 2 answers

### Answer by username_1 on 2017-12-16. Score: 2

To make the sync faster and the wallet creation you can do by setting the checkpoints and later at the time of calling the create wallet method you can set the checkpoints for faster sync. Like I am using walletKit method of bitcoinj for wallet creation find the below code for example

```
WalletAppKit kit = new WalletAppKit(params, new File(walletPath), filePrefix);
kit.setCheckpoints( ReadProperties.class.getClassLoader().getResourceAsStream("checkpoints-bitcoin"));
kit.startAsync();
kit.awaitRunning();

```

> **Comments:**
> **username_2**: What is ReadProperties?  

---

### Answer by username_3 on 2017-09-07. Score: 0

Your bitcoin node only needs to download the blockchain once, so if you leave it running in the background your website can ask it to generate a new address very quickly.


---

