[PoC] Add wallet inspection and modification tool “bitcoin-wallet-tool” #8745

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2016/09/wallet-tool changing 10 files +350 −8
  1. jonasschnelli commented at 2:48 pm on September 16, 2016: contributor

    WORK IN PROGRESS Add another bitcoin-tool called bitcoin-wallet-tool. Currently it supports creation of wallets (with optional encryption before creating keys), encryption and some info-dumping.

    If we agree on this concept, it could be use for creating a HD wallet with a given xpriv. Also, a such tool would probably be required to properly restore a hd wallet. If we once migrate away from BerkleyDB, this could also be helpful.

  2. jonasschnelli added the label Wallet on Sep 16, 2016
  3. jonasschnelli force-pushed on Sep 16, 2016
  4. jonasschnelli force-pushed on Sep 16, 2016
  5. paveljanik commented at 8:15 am on September 17, 2016: contributor

    I like the concept of an external app working on wallet.dat files. I know several use cases where you have many wallet.dat files and with this, you can remove all the notes around the files you have to select between them.

    I can even imagine removing/deprecating encryptwallet, walletpassphrasechange and such from bitcoind afterwards.

    We have to take care of proper file locking when working on the file when bitcoind is running at the same time.

    Some travis’ hosts do not build (wallet/nowallet configs?).

  6. laanwj commented at 1:25 pm on September 19, 2016: member

    Yeah, why not. Concept ACK. This is conceptually similar to SQL database’s external utilities for repair, management, etc. Also I suppose when there needs to be a conversion tool between old and new formats, it would be part of this utility?

    From a deployment point of view I think we should keep this command-line only. Two Qt-using statically linked monster executables in the distribution is a bit too much, because of size concerns but also because e.g. MacOSX assumes a one-to-one mapping of GUI executables to applications.

    We have to take care of proper file locking when working on the file when bitcoind is running at the same time.

    This is indeed very important, it needs to be prevented (and tested) that it is impossible to fudge a database with this utility while bitcoind is running.

  7. jonasschnelli commented at 7:34 am on September 20, 2016: contributor

    Also I suppose when there needs to be a conversion tool between old and new formats, it would be part of this utility?

    Yes. The whole -walletupgare (as well as salvage) could go into this tool.

    From a deployment point of view I think we should keep this command-line only. Two Qt-using statically linked monster executables in the distribution is a bit too much, because of size concerns but also because e.g. MacOSX assumes a one-to-one mapping of GUI executables to applications.

    Yes. The current Qt app could support similar functions, It doesn’t need to be a separate App. Multiwallet support would help in this case.

  8. laanwj commented at 6:07 am on September 21, 2016: member

    Another operation that would be useful here: rewriting the wallet. This does the CDB::rewrite step as done after encryption, but is meant to get rid of no-longer-used ‘junk’ blocks in the wallet. Either to make the file smaller or permanently rid of sensitive metadata that has been removed.

    This cannot be conveniently done from the context of bitcoind (needs restart) but ideally in an external tool.

  9. jonasschnelli force-pushed on Sep 22, 2016
  10. luke-jr commented at 9:23 am on September 22, 2016: member
    I think if we’re going to keep adding more binaries like this, we really ought to stop using static linking for the gitian bins sooner rather than later… :/
  11. jonasschnelli force-pushed on Sep 22, 2016
  12. jonasschnelli commented at 2:12 pm on September 23, 2016: contributor
    Can’t figure out how to solve the gcc linking circular dependencies issue. Maybe @theuni know a way to solve this.
  13. laanwj commented at 12:24 pm on September 26, 2016: member

    I think if we’re going to keep adding more binaries like this, we really ought to stop using static linking for the gitian bins sooner rather than later… :/

    On windows that’s easy: package the DLLs with the binary, ship them in the same directory. Many software does this. On Linux less so, unfortunately. It’s possible to ship .so files but it needs a special script to invoke then, as they won’t get picked up automatically if they’re in the directory of the executable.

    Anyhow this is a tangent: our non-GUI dependencies are really small. E.g. boost is mostly header-only with some small library files, libevent is tiny, berkeleydb is relatively small, etc. It isn’t too problematic to link them to each executable. Also this tool doesn’t even need libevent.

  14. jonasschnelli commented at 12:26 pm on September 26, 2016: contributor
    Agree with @laanwj. The non QT static linked tools should be relatively small, compared to the disk space required by the blocks/index.
  15. luke-jr commented at 8:54 pm on September 26, 2016: member

    It’s possible to ship .so files but it needs a special script to invoke then, as they won’t get picked up automatically if they’re in the directory of the executable.

    Hmm, what about RPATH?

  16. theuni commented at 9:15 pm on September 26, 2016: member
    Agree with @laanwj/@jonasschnelli above. @luke-jr rpath would work (for linux, you can use a relative path). There are lots of reasons not to do that though, and unless there’s a better reason than filesize, it doesn’t seem justifiable.
  17. jonasschnelli commented at 1:12 pm on January 24, 2017: contributor
    Closing for now. Requires some steps in between until this can be revitalized
  18. jonasschnelli closed this on Jan 24, 2017

  19. jonasschnelli reopened this on May 26, 2017

  20. jonasschnelli commented at 8:09 am on May 26, 2017: contributor
    Reopening. A such tool would make much sense for zapwallet, salvage, wallet-creation with an xpriv (especially with multiwallet).
  21. jonasschnelli force-pushed on May 26, 2017
  22. [PoC] Add wallet inspection and modification tool "bitcoin-wallet-tool" f76ed9ca1e
  23. jonasschnelli force-pushed on May 26, 2017
  24. ryanofsky commented at 12:49 pm on May 26, 2017: member
    Not sure if you are still seeing issues with circular dependencies, but a simple way to allow building with circular dependencies during development is to add -Wl,--start-group to LDFLAGS before the relevant libraries like I did here: #8873#pullrequestreview-2650430
  25. jnewbery commented at 9:58 pm on May 31, 2017: member

    doesn’t build for me. Fails at linking:

    0libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): In function `CWallet::AddCScript(CScript const&)':
    1/home/ubuntu/bitcoin/src/wallet/wallet.cpp:238: undefined reference to `CBasicKeyStore::AddCScript(CScript const&)'
    2libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): In function `COutput::ToString[abi:cxx11]() const':
    3/home/ubuntu/bitcoin/src/wallet/wallet.cpp:78: undefined reference to `FormatMoney[abi:cxx11](long const&)'
    4libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): In function `CWallet::IsMine(CTxOut const&) const':
    5/home/ubuntu/bitcoin/src/wallet/wallet.cpp:1192: undefined reference to `IsMine(CKeyStore const&, CScript const&, SigVersion)'
    6...
    

    Travis seems to have the same build failures.

    Concept ACK. Once you’ve fixed the build failures, I’m very keen to test and review this. As you say, this will be especially useful for multi-wallet.

  26. jnewbery commented at 5:12 pm on June 7, 2017: member
    I can get this to build using the -Wl,--start-group flag as suggested by ryanofsky above. If anyone wants to test/review this, then the branch here: https://github.com/jnewbery/bitcoin/tree/pr8745.1 builds
  27. jnewbery commented at 9:20 pm on February 20, 2018: member

    I have a branch of this rebased on #10762 and #12490 (which remove the wallet <-> server circular dependencies and allow this to build)

    here: https://github.com/jnewbery/bitcoin/tree/pr8745_rebased if anyone wants to play around with it.

  28. jnewbery commented at 7:28 pm on April 3, 2018: member
    I’ve rebased https://github.com/jnewbery/bitcoin/tree/pr8745_rebased and pushed it (there were lots of silent conflicts with wallet refactors).
  29. MarcoFalke added the label Needs rebase on Jun 6, 2018
  30. jnewbery commented at 5:26 pm on August 6, 2018: member
    I’ve rebased https://github.com/jnewbery/bitcoin/tree/pr8745_rebased on top of #12490 (which removed the circular dependency that prevents this branch from building). @jonasschnelli - feel free to take that branch and push it to this PR. Otherwise, I’m happy to open my own PR and continue maintaining this feature.
  31. jonasschnelli commented at 3:56 pm on August 9, 2018: contributor
    Closing in the hope @jnewbery takes this over
  32. jonasschnelli closed this on Aug 9, 2018

  33. laanwj removed the label Needs rebase on Oct 24, 2019
  34. DrahtBot locked this on Dec 16, 2021

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: 2024-12-18 15:12 UTC

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