<p>From my experience the process of syncing the blockchain is CPU bound, not IO bound (You can check this on Linux by running the <code>top</code> command). <code>bitcoinj</code> has two ways of verifying signatures, either using native code based on the <code>secp256k1</code> library, or using java code based on the <code>spongycastle</code> library. Your last error message indicates your are not using <code>secp256k1</code> which is most likely a source of performance degradation and a cause of slow syncing process.</p>

<p>In order for java to use the <code>secp256k1</code> library, you need to set the environment variable <code>LD_LIBRARY_PATH</code> to a path where the file <code>libsecp256k1.so</code> is located (I am on Debian, this file may have different names on various systems). For example, you could use the command:</p>

<pre><code>$ env LD_LIBRARY_PATH=&lt;path-to-directory&gt; java -cp &lt;classpath&gt; MyJavaClass
</code></pre>

<p>However, even if you happen to already have the library <code>libsecp256k1.so</code> on your system (because you installed some other piece of software which relies on it), the above command will not work unless the library was built with the <code>--enable-jni</code> option so as to enable java to interface with it.</p>

<p>In order to build a java-enabled <code>libsecp256k1.so</code>, you can do as follows:</p>

<pre><code>$ git clone https://github.com/bitcoin-core/secp256k1
$ cd secp256k1
$ ./autogen.sh
$ ./configure --enable-jni \
              --enable-module-ecdh \
              --enable-experimental
$ make
$ make check
</code></pre>

<p>The library file will then be located in the <code>.libs</code> directory. You can decide to overwrite your existing system file with this new version (but you take the risk of messing up something), or you can simply put this file anywhere you want (or a symbolic link to it) and make sure the <code>LD_LIBRARY_PATH</code> environment variable is properly set to the directory in which it (or a symbolic link) is present. </p>

CC BY-SA 3.0
2017-02-15T16:47:15.390Z
2017-02-15T16:47:15.390Z
Sven Williamson
<p>I've found serious problem with bitcoinj's fullnode. I started downloading blockchain two days ago with bitcoin-qt and today it's complete. With bitcoinj I started downloading block chain about 4 months ago and now it's still downloading it. I've figured out that it's a problem with downloading speed because of these informations:</p>

<pre><code>[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 2.81/0.00 kilobytes per sec (stall threshold &lt;1.56 KB/sec for 10 seconds)
[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 2.50/0.00 kilobytes per sec (stall threshold &lt;1.56 KB/sec for 10 seconds)
[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 2.19/0.00 kilobytes per sec (stall threshold &lt;1.56 KB/sec for 10 seconds)
[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 1.88/0.00 kilobytes per sec (stall threshold &lt;1.56 KB/sec for 10 seconds)
[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 1.56/0.00 kilobytes per sec (stall threshold &lt;1.56 KB/sec for 10 seconds)
[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 1.25/0.00 kilobytes per sec (stall threshold &lt;1.56 KB/sec for 10 seconds)
[PeerGroup Thread] WARN org.bitcoinj.core.PeerGroup - Chain download stalled: received 1.25 KB/sec for 10 seconds, require average of 1.56 KB/sec, disconnecting [127.0.0.1]:8333
</code></pre>

<p>Even when my node is connected with loclahost bitcoin-qt only, it takes about 5-7 minutes to download one block (I've also checked bitcoin-qt logs and depending on the statistics, 1MB has been send to my bitcoinj node). After this, downloading peer is closing and bitcoinj is searching for new downloading peer. Also there is a problem with this:</p>

<pre><code>[Script verification] INFO org.bitcoin.Secp256k1Context - java.lang.UnsatisfiedLinkError: no secp256k1 in java.library.path
</code></pre>

<p>Is it a serious issue or should I forget about this information?</p>

CC BY-SA 3.0
2017-02-15T15:57:00.873Z
I don'y know many specifics of bitcoinj, but are you using bitcoin-core's whitebind feature? bitcoinj may be getting DoS banned; connecting to the whitebind port will prevent that.
lastcanal
CC BY-SA 3.0
2017-02-15T19:06:12.143Z
What do you need the fullnode functionality for? The bitfoinj full validation feature was incomplete at the time it was written, and AFAIK has not been maintained for several years.
Pieter Wuille
<bitcoin-core><bitcoinj>
Problem with full node
Dragomirus
# Problem with full node

(Asked by: username_0 on 2017-02-15)

I've found serious problem with bitcoinj's fullnode. I started downloading blockchain two days ago with bitcoin-qt and today it's complete. With bitcoinj I started downloading block chain about 4 months ago and now it's still downloading it. I've figured out that it's a problem with downloading speed because of these informations:

```
[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 2.81/0.00 kilobytes per sec (stall threshold <1.56 KB/sec for 10 seconds)
[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 2.50/0.00 kilobytes per sec (stall threshold <1.56 KB/sec for 10 seconds)
[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 2.19/0.00 kilobytes per sec (stall threshold <1.56 KB/sec for 10 seconds)
[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 1.88/0.00 kilobytes per sec (stall threshold <1.56 KB/sec for 10 seconds)
[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 1.56/0.00 kilobytes per sec (stall threshold <1.56 KB/sec for 10 seconds)
[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 1.25/0.00 kilobytes per sec (stall threshold <1.56 KB/sec for 10 seconds)
[PeerGroup Thread] WARN org.bitcoinj.core.PeerGroup - Chain download stalled: received 1.25 KB/sec for 10 seconds, require average of 1.56 KB/sec, disconnecting [127.0.0.1]:8333

```

Even when my node is connected with loclahost bitcoin-qt only, it takes about 5-7 minutes to download one block (I've also checked bitcoin-qt logs and depending on the statistics, 1MB has been send to my bitcoinj node). After this, downloading peer is closing and bitcoinj is searching for new downloading peer. Also there is a problem with this:

```
[Script verification] INFO org.bitcoin.Secp256k1Context - java.lang.UnsatisfiedLinkError: no secp256k1 in java.library.path

```

Is it a serious issue or should I forget about this information?

**Tags:** bitcoin-core, bitcoinj

> **Comments:**
> **username_1**: I don'y know many specifics of bitcoinj, but are you using bitcoin-core's whitebind feature? bitcoinj may be getting DoS banned; connecting to the whitebind port will prevent that.  
> **username_2**: What do you need the fullnode functionality for? The bitfoinj full validation feature was incomplete at the time it was written, and AFAIK has not been maintained for several years.  

---

## 1 answers

### Answer by username_3 on 2017-02-15. Score: 4

From my experience the process of syncing the blockchain is CPU bound, not IO bound (You can check this on Linux by running the `top` command). `bitcoinj` has two ways of verifying signatures, either using native code based on the `secp256k1` library, or using java code based on the `spongycastle` library. Your last error message indicates your are not using `secp256k1` which is most likely a source of performance degradation and a cause of slow syncing process.

In order for java to use the `secp256k1` library, you need to set the environment variable `LD_LIBRARY_PATH` to a path where the file `libsecp256k1.so` is located (I am on Debian, this file may have different names on various systems). For example, you could use the command:

```
$ env LD_LIBRARY_PATH=<path-to-directory> java -cp <classpath> MyJavaClass

```

However, even if you happen to already have the library `libsecp256k1.so` on your system (because you installed some other piece of software which relies on it), the above command will not work unless the library was built with the `--enable-jni` option so as to enable java to interface with it.

In order to build a java-enabled `libsecp256k1.so`, you can do as follows:

```
$ git clone https://github.com/bitcoin-core/secp256k1
$ cd secp256k1
$ ./autogen.sh
$ ./configure --enable-jni \
              --enable-module-ecdh \
              --enable-experimental
$ make
$ make check

```

The library file will then be located in the `.libs` directory. You can decide to overwrite your existing system file with this new version (but you take the risk of messing up something), or you can simply put this file anywhere you want (or a symbolic link to it) and make sure the `LD_LIBRARY_PATH` environment variable is properly set to the directory in which it (or a symbolic link) is present.


---

