<p>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).</p>

<p>Is this possible?</p>

<p>Here is my code:</p>

<pre><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
</code></pre>

<p><strong>In both cases the address is the correct one but:</strong></p>

<p>In Regtest network I have <strong>x</strong> bitcoins
In BitcoinJ app I have <strong>0</strong> bitcoins</p>

CC BY-SA 3.0
2017-12-07T10:15:47.733Z
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
CC BY-SA 3.0
2017-12-07T11:03:56.080Z
@MeshCollider How it is possible to synchronise bitcoinJ with the other node? There are no nodes in my network.
gtopal
CC BY-SA 3.0
2017-12-07T18:23:50.160Z
You can use `addnode` in your conf file
meshcollider
CC BY-SA 3.0
2017-12-11T07:33:23.460Z
@MeshCollider I created a node for my network, but the behaviour is the same
gtopal
<transactions><bitcoinj><regtest>
How it is possible to wrap with BitcoinJ a Bitcoin Core RPC interface and drives regtest mode
gtopal
# How it is possible to wrap with BitcoinJ a Bitcoin Core RPC interface and drives regtest mode

(Asked by: username_0 on 2017-12-07)

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

**Tags:** transactions, bitcoinj, regtest

> **Comments:**
> **username_1**: 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?  
> **username_0**: @MeshCollider How it is possible to synchronise bitcoinJ with the other node? There are no nodes in my network.  
> **username_1**: You can use `addnode` in your conf file  
> **username_0**: @MeshCollider I created a node for my network, but the behaviour is the same  

---

## 0 answers

