Error at Block #481815 Reading the blockchain from Block #1 to the end

36 views
Skip to first unread message

Olivér Zsámár

unread,
Mar 19, 2018, 5:38:14 PM3/19/18
to bitcoinj
Hello!

I'm new to bitcoinj, and before doing anything, I just want to try some easy stuff.
I want to read the whole blockchain from Block #1, and doing some statistics.

I have this program:
https://pastebin.com/avszTeAK

It doesn't suppose to do anything. The only thing it should do: just count all the blocks!

When I compile my code, I always get this warning:

mar. 19, 2018 10:00:04 DU org.bitcoinj.core.Context getOrCreate
WARNING: Implicitly creating context. This is a migration step and this message will eventually go away.
mar. 19, 2018 10:00:04 DU org.bitcoinj.core.Context <init>
INFO: Creating bitcoinj 0.14.6 context.

After this, it starts counting the blocks.

But at Block #481815 there is always an exception.

Block #481814
Block #481815
Debugging
java.lang.NegativeArraySizeException
    at org.bitcoinj.core.Message.readBytes(Message.java:334)
    at org.bitcoinj.core.TransactionInput.parse(TransactionInput.java:143)
    at org.bitcoinj.core.Message.<init>(Message.java:96)
    at org.bitcoinj.core.Message.<init>(Message.java:128)
    at org.bitcoinj.core.ChildMessage.<init>(ChildMessage.java:57)
    at org.bitcoinj.core.TransactionInput.<init>(TransactionInput.java:133)
    at org.bitcoinj.core.Transaction.parse(Transaction.java:564)
    at org.bitcoinj.core.Message.<init>(Message.java:96)
    at org.bitcoinj.core.Message.<init>(Message.java:128)
    at org.bitcoinj.core.ChildMessage.<init>(ChildMessage.java:57)
    at org.bitcoinj.core.Transaction.<init>(Transaction.java:232)
    at org.bitcoinj.core.Block.parseTransactions(Block.java:242)
    at org.bitcoinj.core.Block.parse(Block.java:266)
    at org.bitcoinj.core.Message.<init>(Message.java:96)
    at org.bitcoinj.core.Message.<init>(Message.java:128)
    at org.bitcoinj.core.Block.<init>(Block.java:162)
    at org.bitcoinj.core.BitcoinSerializer.makeBlock(BitcoinSerializer.java:270)
    at org.bitcoinj.core.MessageSerializer.makeBlock(MessageSerializer.java:72)
    at org.bitcoinj.utils.BlockFileLoader.loadNextBlock(BlockFileLoader.java:154)
    at org.bitcoinj.utils.BlockFileLoader.hasNext(BlockFileLoader.java:87)
    at com.company.BitcoinReader.read(BitcoinReader.java:33)
    at com.company.BitcoinReader.main(BitcoinReader.java:68)


First I downloaded the Bitcoin blockchain from here: https://getbitcoinblockchain.com/
Then I tried to solve my problem after a few failed attempts by downloading the blockchain using BitcoinCore: https://bitcoin.org/en/download
Sadly it didn't solve the problem.

Please help.
:)

Jameson Lopp

unread,
Mar 19, 2018, 5:45:34 PM3/19/18
to bitc...@googlegroups.com
20 millibits says that the block parser is choking on a transaction that spends a SegWit UTXO.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Andreas Schildbach

unread,
Mar 21, 2018, 9:03:34 AM3/21/18
to bitc...@googlegroups.com
Something has changed in the format Bitcoin Core uses for persistence to
disk. Either use an old version of Bitcoin Core (0.13?) for creating the
files or you will need to investigate into the changes and adapt
bitcoinj to it.
> https://getbitcoinblockchain.com/ <https://getbitcoinblockchain.com/>
> Then I tried to solve my problem after a few failed attempts by
> downloading the blockchain using BitcoinCore:
> https://bitcoin.org/en/download <https://bitcoin.org/en/download>
> Sadly it didn't solve the problem.
>
> Please help.
> :)
>
> --
> 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+u...@googlegroups.com
> <mailto:bitcoinj+u...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout
> <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+u...@googlegroups.com
> <mailto:bitcoinj+u...@googlegroups.com>.

chenp...@gmail.com

unread,
Apr 2, 2018, 9:35:29 AM4/2/18
to bitcoinj
The program works.

在 2018年3月20日星期二 UTC+8上午5:38:14,Olivér Zsámár写道:

chenp...@gmail.com

unread,
Apr 3, 2018, 5:47:04 AM4/3/18
to bitcoinj
Hi, do you solve this problem? I get the same one.


在 2018年3月20日星期二 UTC+8上午5:38:14,Olivér Zsámár写道:
Hello!

Olivér Zsámár

unread,
Apr 3, 2018, 5:54:55 AM4/3/18
to bitc...@googlegroups.com
Hi!

I couldn't solve this using bitcoinj.
Maybe you could use Blockchain Data Api at blockchain.info for the SegWit blocks.

Its very slow for that and you have to download the segwit blocks by using that api. But at least it works.


--
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/fGWBPbTORAg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bitcoinj+u...@googlegroups.com.

chenp...@gmail.com

unread,
Apr 3, 2018, 8:44:44 PM4/3/18
to bitcoinj
Okay, at least it works. If you get some other solutions, please let me know, thank you.

在 2018年4月3日星期二 UTC+8下午5:54:55,Olivér Zsámár写道:

Andreas Schildbach

unread,
Apr 7, 2018, 4:52:18 AM4/7/18
to bitc...@googlegroups.com
Just to let you know: the issue is fixed with PR
https://github.com/bitcoinj/bitcoinj/pull/1552.


On 04/04/2018 02:44 AM, chenp...@gmail.com wrote:
> Okay, at least it works. If you get some other solutions, please let me
> know, thank you.
>
> 在 2018年4月3日星期二 UTC+8下午5:54:55,Olivér Zsámár写道:
>
> Hi!
>
> I couldn't solve this using bitcoinj.
> Maybe you could use Blockchain Data Api at blockchain.info
> <http://blockchain.info> for the SegWit blocks.
> <https://groups.google.com/d/topic/bitcoinj/fGWBPbTORAg/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email
> to bitcoinj+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout
> <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+u...@googlegroups.com
> <mailto:bitcoinj+u...@googlegroups.com>.
Reply all
Reply to author
Forward
0 new messages