1

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?

  • 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. – lastcanal Feb 15 '17 at 15:57
  • 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 Feb 15 '17 at 19:06
3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.