Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to open the bitcoin-qt wallet with bitcoinj, I write this code:

private static final File WALLET_FILE = new File("C:\\Users\\Bapt\\AppData\\Roaming\\Bitcoin\\wallet.dat");

public static void main(String[] args) {
    NetworkParameters networkParameters = NetworkParameters.prodNet();

    Wallet wallet;
    try {
        wallet = Wallet.loadFromFile(WALLET_FILE);
    } catch (IOException e) {
        System.out.println("Couldn't open wallet: " + e);

    System.out.println("Balance: " + wallet.getBalance());

But I have an error:

Couldn't open wallet: Protocol message contained an invalid tag (zero).

So I have two questions:

  • Is is possible to do what I want ?
  • If yes, what do you think could happen here ?

Thanks for your answer.

share|improve this question
up vote 1 down vote accepted

BitcoinJ has its own wallet format, and official bitcoin client its own.

share|improve this answer
Ok, thank you for your answer. Is it the same for the block chain ? Could I use the block chain downloaded by bitcoin-qt in bitcoinj ? – Baptiste Pernet Mar 18 '13 at 13:16
The blockchains are different too. – jim618 Mar 18 '13 at 20:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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