Author

Topic: How to send passphrase to bitcoin core using bitcoin-cli? (Read 1755 times)

legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Is there a safer way to not post the password directly on command line?
This command is also stored on bash history, and it would require removing the history file every time you decrypt your wallet for a short period of time.
Kill Bash, it won't update .bash_history:
Code:
kill -9 $$

Thank you. However, although this won't save the password to history, even with -stdin, the password gets displayed without any encryption on the screen. Is there a workaround to this?
I feel you, when I use walletpassphrase in Debug window Console. I just use it as a reminder to never enter my password with anybody around.
staff
Activity: 3458
Merit: 6793
Just writing some code
Thank you. However, although this won't save the password to history, even with -stdin, the password gets displayed without any encryption on the screen. Is there a workaround to this?
Once you get the data you need, you can do clear a bunch of times.

And one more thing. I noticed that the newest version of bitcoin core has support for multiple wallets. How do I set this up to have for example 5 different wallets but all using the same blockchain, so basically I do not want to download the entire blockchain again and store the blockchain 5 times, I only need the bitcoin-cli or the RPC to view / spend bitcoins from any wallet I want. Are there specific bitcoin-cli commands that are useful for selecting the wallet file I want to use?
Start Bitcoin Core with as many -wallet= arguments (or add them to your bitcoin.conf file) as you want wallets to use. When you use bitcoin-cli with any wallet related command, you will need to use the -rpcwallet= argument to specify the wallet that you want to use. For example, you might do
Code:
$ bitcoind -daemon -wallet=wallet1 -wallet=wallet2
To start Bitcoin Core with two wallets, wallet1 and wallet2. If you want to do stuff with wallet1, you would do
Code:
$ bitcoin-cli -rpcwallet=wallet1 getwalletinfo
jr. member
Activity: 45
Merit: 1
Is there a safer way to not post the password directly on command line?
This command is also stored on bash history, and it would require removing the history file every time you decrypt your wallet for a short period of time.
Use bitcoin-cli with the -stdin parameter. The parameters will then be entered on stdin after you enter the command, one on each line. This keeps it out of the bash history. So you would do something like
Code:
$ bitcoin-cli -stdin walletpassphrase

and complete the command with Ctrl + D to signal EOF. Then the command will be sent and you will get a response.

Thank you. However, although this won't save the password to history, even with -stdin, the password gets displayed without any encryption on the screen. Is there a workaround to this?

And one more thing. I noticed that the newest version of bitcoin core has support for multiple wallets. How do I set this up to have for example 5 different wallets but all using the same blockchain, so basically I do not want to download the entire blockchain again and store the blockchain 5 times, I only need the bitcoin-cli or the RPC to view / spend bitcoins from any wallet I want. Are there specific bitcoin-cli commands that are useful for selecting the wallet file I want to use?
staff
Activity: 3458
Merit: 6793
Just writing some code
Is there a safer way to not post the password directly on command line?
This command is also stored on bash history, and it would require removing the history file every time you decrypt your wallet for a short period of time.
Use bitcoin-cli with the -stdin parameter. The parameters will then be entered on stdin after you enter the command, one on each line. This keeps it out of the bash history. So you would do something like
Code:
$ bitcoin-cli -stdin walletpassphrase

and complete the command with Ctrl + D to signal EOF. Then the command will be sent and you will get a response.
jr. member
Activity: 45
Merit: 1
Is there a safer way to not post the password directly on command line?
This command is also stored on bash history, and it would require removing the history file every time you decrypt your wallet for a short period of time.
newbie
Activity: 5
Merit: 0
Yes, I ment password to unlock the wallet. Achow101 - thanks, it worked!
staff
Activity: 3458
Merit: 6793
Just writing some code
How to send passphrase to bitcoin core using bitcoin-cli in Linux terminal? I've got my decrypted wallet and would like to check which of the passwords is correct by sending passphrases via bitcoin-cli. What commands should I use? Thanks.
Do you mean the password that you use to unlock an encrypted wallet?

If so, you have to use
Code:
walletpassphrase
where is your passphrase and is an amount of time in seconds to keep the wallet unlocked.
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
How to send passphrase to bitcoin core using bitcoin-cli in Linux terminal? I've got my decrypted wallet and would like to check which of the passwords is correct by sending passphrases via bitcoin-cli. What commands should I use? Thanks.

Isn't the password stored in the config file, do you have access to that?
If not, you'll probably have to create one and assign a number to the variable for the password each time based on the command line commands.
Code:
rpcpassword=

Also you should be able to run that as a cli command:
bitcoin-qt -rpcpassword=
and see if it loads.
newbie
Activity: 5
Merit: 0
How to send passphrase to bitcoin core using bitcoin-cli in Linux terminal? I've got my decrypted wallet and would like to check which of the passwords is correct by sending passphrases via bitcoin-cli. What commands should I use? Thanks.
Jump to: