Bitcoin Forum
November 17, 2024, 04:44:32 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [PULL REQUEST SUBMITTED] Creating an "imported private keys" wallet from cli  (Read 183 times)
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1792
Merit: 7388


Top Crypto Casino


View Profile WWW
November 27, 2021, 06:11:22 AM
Last edit: March 14, 2022, 12:38:58 PM by NotATether
Merited by hugeblack (4), o_e_l_e_o (4), ABCbits (1)
 #1

I'm not sure how to create a wallet (from the Electrum command line) without the seed phrase argument.

The problem is that the "create" command always creates a wallet that has a seed phrase in it, and I can't seem to change that behavior from parameters. This causes "imporprivkey" command to refuse to import any private keys inside the wallet, because it already has a seed phrase, as I demonstrate below:

Code:
$ electrum --testnet create
{
    "msg": "Please keep your seed in a safe place; if you lose it, you will not be able to restore your wallet.",
    "path": "<redacted>",
    "seed": "<redacted>" # <---- Need to get rid of this return value
}
$  electrum --testnet  importprivkey  "p2wpkh:<redacted -  private key text goes here>"
Error: This type of wallet cannot import private keys. Try to create a new wallet with that key.

There doesn't seem to be any other command for creating wallets though and this is another stumbling block.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
nc50lc
Legendary
*
Offline Offline

Activity: 2604
Merit: 6416


Self-proclaimed Genius


View Profile
November 27, 2021, 09:19:18 AM
Merited by LoyceV (6), hugeblack (4), o_e_l_e_o (4), Abdussamad (2), pooya87 (2), ABCbits (2), DireWolfM14 (2), NotATether (1)
 #2

Use restore instead of create.
Example:
Code:
electrum --testnet -w test_wallet1 restore "p2wpkh:cToWRvSSzMJn87KJc7y66c9YfLuPWQf8uBrYvj5pdsa8h1v5NL6Q p2wpkh-p2sh:cMiHrQ32jiRmTzMKXi6NT9RR2m6SUgNzC36ghTf1Z2JAbhBJncji"
Enter the wallet name after the "-w" argument, and the private key(s) (with script type) after "restore".

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1792
Merit: 7388


Top Crypto Casino


View Profile WWW
November 30, 2021, 12:18:35 PM
Last edit: December 05, 2021, 07:08:25 AM by NotATether
Merited by HCP (10), hugeblack (6)
 #3

Use restore instead of create.
Example:
Code:
electrum --testnet -w test_wallet1 restore "p2wpkh:cToWRvSSzMJn87KJc7y66c9YfLuPWQf8uBrYvj5pdsa8h1v5NL6Q p2wpkh-p2sh:cMiHrQ32jiRmTzMKXi6NT9RR2m6SUgNzC36ghTf1Z2JAbhBJncji"
Enter the wallet name after the "-w" argument, and the private key(s) (with script type) after "restore".

(the whitespace in between is important, apparently, and can't just be any separator)

I noticed that when I used the restore command, the wallet doesn't automatically get synced, yet the call returns instantly.

Among other things, this causes the balance to be reported as zero for an indefinite amount of time, because the network part of the wallet is never started (there's a reason why the return JSON says: "This wallet has been restored offline").

I made a new command restore_sync that fixes this (apparently it was a TODO in the code as well) and some other commands I found convenient to make. I will make a PR for those shortly.



EDIT: The request has been made: https://github.com/spesmilo/electrum/pull/7584 and I want to merge a few other commands I added (among others, I also have a delete command that deletes wallet files but I don't think that this will make it - it does not tell the difference between wallet files and other random files).

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1792
Merit: 7388


Top Crypto Casino


View Profile WWW
March 14, 2022, 12:35:15 PM
Last edit: March 14, 2022, 12:51:13 PM by NotATether
 #4

OK, it's been 3 months now and I admit that I'm quite upset that I'm not even getting feedback on Github from the Electrum maintainers about my PR - as far as I can tell, this is the case for most of the other recent PRs.

This is despite the fact that the maintainers have made several other commits to the codebase since then.

Does anyone know of a way for me to get he attention of the Electrum devs?

Edit: I can't even send a message to their IRC channel, it appears to be offline.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Abdussamad
Legendary
*
Offline Offline

Activity: 3696
Merit: 1580



View Profile
March 14, 2022, 06:14:19 PM
 #5

freenode has been having some problems so they created a chat room #electrum on liberachat.  you should try that.
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1792
Merit: 7388


Top Crypto Casino


View Profile WWW
March 15, 2022, 05:59:12 PM
 #6

freenode has been having some problems so they created a chat room #electrum on liberachat.  you should try that.

Didn't know about freenode having problems as I haven't used it for a while. But I had already attempted to connect my IRC client to liberachat and registered an account there but it's giving me messages that look like "#electrum server is offline" so no luck there unfortunately. I will try firing up Hexchat and see if it goes through.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!