Memory-only wallet (for faucets) #31816

issue jsarenik openend this issue on February 7, 2025
  1. jsarenik commented at 12:21 pm on February 7, 2025: none

    Please describe the feature you’d like to see added.

    Currently I do following regularly every couple of days in order to refresh faucet wallets and reclaim megabytes of disk space:

    0cd ~/.bitcoin/signet/wallets
    1bitcoin-cli -signet createwallet name false true
    2# blank with private-keys enabled
    3cd name
    4dt=../listdescriptors-true.txt
    5A=$(sed 's/"timestamp".*$/"timestamp":"now",/' $dt | jq -rc .descriptors)
    6bitcoin-cli importdescriptors $A
    

    It works well for me (in connection with another readlink hack allowing me to use symlinks for wallet entry path) but I am wondering about a feature, a new option to createwallet RPC that would create a wallet which does not keep track of spent transacrions, only what is now in blocks (chainstate) and mempool.

    When writing a faucet I first realized there is no point in playing privacy here since the amount of wallet data tracking all the new addresses (incl. random new “change” addresses) can grow huge and soon make the faucet unusable.

    Describe the solution you’d like

    I would like wallet.dat sqlite in this mode to not track the historical transactions other thatn confirmed unspent ones, everything else would stay as normal wallet with or without private keys.

    Describe any alternatives you’ve considered

    Before I was doing also scantxoutset without any wallet. It actually provided me with unspent outputs that were confirmed in blocks and then I could just signrawtransactionwithkey. But using a wallet has many advantages, I just imagine this new memory-only (“light mode”) would be helpful.

    Please leave any additional context

    Currently there are following HTTP-served faucets I know of:

    Ignoring the dying Testnet3 now.

    On Signet:

    On Testnet4:

    * Testnet4 faucet on anyone.eu.org is generally the same as alt.signetfaucet.com but not kept in a lockstep so it does not do Cloudflare Turnstile or TRUC replacements yet.

  2. jsarenik added the label Feature on Feb 7, 2025
  3. jsarenik referenced this in commit 106dd4ccbe on Feb 8, 2025
  4. maflcko added the label Wallet on Feb 13, 2025
  5. maflcko commented at 7:32 am on February 13, 2025: member

    Before I was doing also scantxoutset without any wallet. It actually provided me with unspent outputs that were confirmed in blocks and then I could just signrawtransactionwithkey. But using a wallet has many advantages

    This would have been my suggestion as a workaround. Is there something that would be missing? I haven’t tried, but removeprunedfunds could be another alternative to reduce the wallet file size?

  6. jsarenik commented at 2:55 pm on February 13, 2025: none

    @maflcko thanks for the idea with removeprunedfunds but I just tried it and it did not change the size of the dat file even after removing almost all of the already-mined transactions (the list I got from listtransactions RPC with some postprocessing).

    I think the database file would need to be vacuumed.

  7. jsarenik commented at 3:04 pm on February 13, 2025: none

    Yes, @maflcko , it works well, I just need to unload the wallet, echo 'VACUUM;' | sqlite3 wallet.dat and load it back.

    I think the feature suggestion in this issue still makes sense though.

  8. jsarenik closed this on Feb 13, 2025

  9. jsarenik commented at 1:08 pm on February 18, 2025: none

    @maflcko just for the record, the current wallet of alt.signetfaucet.com is running in Linux’ tmpfs (i.e. in RAM) and is being atomically refreshed by cron every hour. No leftovers. Actually I think there is no need for the proposed feature.

    Thank you! I like Bitcoin Core!


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-02-22 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me