-
Notifications
You must be signed in to change notification settings - Fork 38.7k
util: Add "importfromcoldcard" command to bitcoin-wallet tool #23362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Coldcard firmware v4.1.3+ supports wallet export via descriptors.
|
|
@hebasto thanks for this, nice to see HW <=> Core getting easier. |
|
Concept ACK |
mjdietzx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool
|
|
||
| std::string line; | ||
| while (std::getline(file, line)) { | ||
| if (line.substr(0, 22) == "importdescriptors \'[{\"") break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are your thoughts on using regex from the standard library for this? https://www.cplusplus.com/reference/regex/
As someone not familiar w/ coldcard files, it would be much easier for me to understand this (ie the hardcoded string positions here, and at L138). It could possibly simplify this a bit and make it easier to read if we pulled the descriptor from the file w/ a regex
|
-0 on adding device specific code into Core. |
|
The Coldcard produces a command that the user can copy-paste into the console to perform the import. This PR parses the text file with that command and does the import instead. That seems strange. I would prefer to see something a bit more generic. E.g. ColdCard and other devices could produce a text file with just descriptors in it, and/or some other wallet metadata. And then we could import that. |
I agree. Wouldn't the HWI or a similar project be a better place for this? I don't really think we should be adding vendor specific code/calls into Bitcoin Core utilities. Or, if it is going to be done, it should be done in some very generic way, otherwise we're likely going to just end up with a bunch of |
In hindsight, coldcard fan though I may be, I think @Sjors and @fanquake are right here. Burdening Core with parsing a potentially-unlimited number of vendor-specific data formats doesn't seem right. |
|
Selfishly all I want is easy with my preferred tool. But yes, a more vendor neutral approach makes sense. It seems that supporting core is not priority for most vendors, so I really have no good suggestions. Maybe the patch could be generalized to import a series of any commands and/or we could change CC to export comments (#) on all the other lines in the file, etc... |
No. It's practically infeasible for a non-tech-savvy person to create a safe setup of "Bitcoin Core + python HWI" on a new Windows laptop. I tested this scenario many times IRL with different users (( Also we should not recommend to such a type of users to use Bitcoin Core GUI console at all.
Tend to agree. |
luke-jr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest making a BIP for the format, and renaming this to something vendor-neutral.
|
I agree.
|
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Yes. I'm all for making the flows easy to use with hardware wallets, but supporting specific hardware seems to go a step too far. Also, we don't have the test framework (e.g. device simulation) set up for use-cases like this.
So then we need to make that process easier. We could even ship the distribution with HWI. This cannot be an argument for absorbing HWI's functionality into this repository. |
|
Absolutely agree with the above comments, its definitely an excellent goal to improve integration with hardware wallets but not at the expense of burdening this repository with a bunch of case handling. Look forward to a vendor-independent proposal 👍 |
|
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
|
What's the state of this PR? From the discussion the current approach is not going to be merged, so I think this should either be closed, or at least drafted, until the approach is changed. |
Drafted. |
Coldcard firmware v4.1.3+ supports wallet export via descriptors. Github-Pull: bitcoin#23362 Rebased-From: 8076f8d
Coldcard firmware v4.1.3+ supports wallet export via descriptors:
This PR adds a new command
importfromcoldcardfor thebitcoin-wallettool which creates a new wallet and fills it with the provided descriptors.Usage example:
To point to the "bitcoin-core.txt" file, the
-dumpfileoption is re-used.Also the created wallet is forced for rescanning, to guarantee the access to all transactions even for wallets that were previously used some time before being imported into Bitcoin Core.
TODO (not here):
importfromcoldcardcommand to thetool_wallet.pyfunctional testBased on #23349.