2

I'm developing a simple app to learn how to use the bitcoinj library. I'm using the WalletAppKit object to simplify the process and I'm following the official documentation.

When developing I prefer to use bitcoind regtest mode as it's faster than the testnet3 and I don't need to be connected to the i

if (params == RegTestParams.get()) {
    // Regression test mode is designed for testing and development only, so there's no public network for it.
    // If you pick this mode, you're expected to be running a local "bitcoind -regtest" instance.
    kit.connectToLocalHost();
}

I was playing with the WalletTemplate example desktop app and it works just fine on the regnet. Now I'm trying to do the same on my Android app but I don't know how to connect it to my regnet instance running on my machine.

Does anyone know how can I do that?

Thanks in advance,

Felipe

1 Answer 1

2

If you're connecting to a bitcoind regtest node and you're trying to connect as an RPC client to it via bitcoinj, it's possible.

Figure out what your Android's IP address is, say x.y.z.w and use the -rpcallowip parameter in bitcoind to allow your (remote) Android app to talk to the regtest bitcoind node.

Spawn bitcoind like this, for example:

bitcoind -debug=1 -printtoconsole -server \
    -regtest -listen -rpcport=8332        \
    -rpcuser=yourrpcuser -rpcpassword=yourrpcpass -rpcallowip=18.138.5.97

WARNING: Security-wise, keep in mind that the RPC password is transmitted over the network in plaintext.

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