Issues with the Bitcoin Core block minting (basic_bitcoin example)

Hi all,

I’m experimenting with the (Rust) basic_bitcoin example project, but have an issue with Bitcoin Core.

Everything seems to be running fine, but I can’t mine/generate blocks. I run this command:

./bin/bitcoin-cli -conf=$(pwd)/bitcoin.conf generatetoaddress 1 bc1q0ravk9wecxynsze55rq0jk5jv9hnncz5kfe3yk

The address is one I created using the CLI. Instead of the expected array with a hash of a generated block I just get an empty array [ ] and the balance is still 0.

I’ve read docs and searched for answers, but haven’t been succesful at generating blocks. I use Bitcoin Core v25.0 if that makes a difference.

Hi @Carsten :wave:

You probably need to mine a few blocks more. Coinbase UTXOs are only spendable after 100 blocks. So the first coins can be spent in block 101.

For local Bitcoin development, you can use these scripts.
regtest_wallet.sh will help you set up a Bitcoin wallet locally.

1 Like

Hey @domwoe

The problem is that I can’t even mine 1, or 101. I’m running Bitcoin Core locally and using regtest mode. When I use the generatetoaddress command, the response is [ ].

I’m expecting something like this:

generatetoaddress 101 bcrt1qgwev460zqprwlvnv45nq3tyuwgj4t8ukx8qs53
[
  "724e85de66945bb2bb3de206e73b2016bd40f43822281c7b8ffa05e1d52641a9",
  "68a1bcc819e8fcb571014f65ab21dcfb2ccda7deda941660b3dd85b55623c82d",
  ...
  "1fb51410422b2bb7482db31beefc7508bcd66b3c22be88508616602658e65cb0"
]

But I get this:

generatetoaddress 11 bcrt1qgwev460zqprwlvnv45nq3tyuwgj4t8ukx8qs53
[
]

I read something about that response is expected when you use the generatetoaddress on testnet, but I have set the network to regtest in the bitcoin.cont file…

Hey @zohaib29
That’s a really nice collection of scripts!
Unfortunately I’m still struggling with this issue. It might be a config thing since everything else seems to be working.

You can have a look at this repo: GitHub - domwoe/inscription_canister: Ordinal Inscription Testbed on ICP.
It includes running a bitcoind regtest instance inside a Docker container, and I’d be interested if it works for others :slight_smile:

Thanks, I’ll try it out.
So far I’ve just been deploying the code to the IC instead of locally, but it would be nice with a local version too.

hm, then I don’t understand your setup. How would you connect to your local Bitcoin node if you are working with IC mainnet?