Skip to content

Instantly share code, notes, and snippets.

@stevenroose
Created December 6, 2024 00:02
Show Gist options
  • Save stevenroose/a7b2b0aab4b80af08a935cf6cbf32d29 to your computer and use it in GitHub Desktop.
Save stevenroose/a7b2b0aab4b80af08a935cf6cbf32d29 to your computer and use it in GitHub Desktop.
Slow bitcoin core sqlite wallet

system info

➜  bark git:(master) ✗ which bitcoind
/nix/store/42mvg2m90wn7pn4z2wb80q189j0340a5-bitcoin-28.0/bin/bitcoind
➜  bark git:(master) ✗ bitcoind -version
Bitcoin Core version v28.0.0
Copyright (C) 2009-2024 The Bitcoin Core developers

Please contribute if you find Bitcoin Core useful. Visit
<https://bitcoincore.org/> for further information about the software.
The source code is available from <https://github.com/bitcoin/bitcoin>.

This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <https://opensource.org/licenses/MIT>
➜  bark git:(master) ✗ which sqlite3
/nix/store/qdnnfnxzg70yavi08jw0z4s9skjrwhn9-sqlite-3.45.3-bin/bin/sqlite3
➜  bark git:(master) ✗ sqlite3 --version
3.45.3 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355 (64-bit)
➜  bark git:(master) ✗ bitcoind -regtest
➜  bark git:(master) ✗ time bitcoin-cli -regtest generatetoaddress 100 $(hal address create --regtest --pubkey $(hal key generate | jq -r '.public_key') | jq -r '.p2pkh')
...
bitcoin-cli -regtest generatetoaddress 100   0.01s user 0.01s system 4% cpu 0.322 total
➜  bark git:(master) ✗ time bitcoin-cli -regtest generatetoaddress 100 $(bitcoin-cli -regtest getnewaddress)
...
bitcoin-cli -regtest generatetoaddress 100   0.01s user 0.00s system 0% cpu 5.413 total

It's solved when I run bitcoind with

➜  bark git:(master) ✗ bitcoind -regtest -unsafesqlitesync
➜  bark git:(master) ✗ time bitcoin-cli -regtest generatetoaddress 100 $(bitcoin-cli -regtest getnewaddress)
...
bitcoin-cli -regtest generatetoaddress 100   0.01s user 0.00s system 3% cpu 0.313 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment