How it is possible to wrap with BitcoinJ a Bitcoin Core RPC interface and drives regtest mode

0

Despite the fact that I have already create an address in regtest network which has Bitcoins I can not import correctly this address to my BitcoinJ app in order to execute certain functions(OP_CODE tx, send tx.. etc).

Is this possible?

Here is my code:

//create my ECKey
    DumpedPrivateKey dumpPrKey=new DumpedPrivateKey(params,"My private key");
    ECKey ecKey =dumpPrKey.getKey();
    wallet.importKey(ecKey);
    bitcoinAddress = ecKey.toAddress(params).toString();
    System.out.println("My bitcoin address is : " +bitcoinAddress); // the regtest address
    System.out.println("My bitcoin balance is: " +wallet.getBalance()); //the balance

In both cases the address is the correct one but:

In Regtest network I have x bitcoins In BitcoinJ app I have 0 bitcoins

gtopal

Posted 2017-12-07T09:43:35.717

Reputation: 341

The key to the regtest network is that you make your own network, it's not globally connected like testnet3. Have you synchronised bitcoinJ with your other node so they share the same blockchain?MeshCollider 2017-12-07T10:15:47.733

@MeshCollider How it is possible to synchronise bitcoinJ with the other node? There are no nodes in my network.gtopal 2017-12-07T11:03:56.080

You can use addnode in your conf fileMeshCollider 2017-12-07T18:23:50.160

@MeshCollider I created a node for my network, but the behaviour is the samegtopal 2017-12-11T07:33:23.460

No answers