3

I have bitcoind running in regtest mode. I want to connect my bcoin wallet to it and retrieve all UTXOs relevant to the sender's address.

How can I do that?

1 Answer 1

2

To run two full nodes on the same machine, they'll need to be bound to different ports. Luckily, bitcoind and bcoin run regtest on different ports already by default (18444 and 48444 respectively). Just note this wouldn't be the case for testnet or main net.

Launch bitcoind

$ bitcoind -daemon -regtest

Launch bcoin in SPV mode

$ bcoin --spv --daemon --network=regtest

Connect bcoin to bitcoind:

$ bcoin-cli --network=regtest rpc addnode 127.0.0.1:18444 add

Get a wallet address from bcoin:

$ bwallet-cli --network=regtest account get default
{
  ...
  "receiveAddress": "n4C5ikvkn5HUNjqAPrPB1udnZPjm9p6xGY",
  ...
}

Generate a block with bitcoind, sending coinbase subsidy to the wallet address:

$ bitcoin-cli -regtest generatetoaddress 1 n4C5ikvkn5HUNjqAPrPB1udnZPjm9p6xGY

Check bcoin wallet balance:

$ bwallet-cli --network=regtest balance
{
  "account": -1,
  "tx": 1,
  "coin": 1,
  "unconfirmed": 5000000000,
  "confirmed": 5000000000
}

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