mirror of
				https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
				synced 2025-10-31 02:17:24 +00:00 
			
		
		
		
	fixing wallet dumps
CandidateBlock
This commit is contained in:
		
							parent
							
								
									5706618abb
								
							
						
					
					
						commit
						9830de1bbd
					
				| @ -76,17 +76,19 @@ Invalid address | |||||||
| 
 | 
 | ||||||
| ## Optional: Dump Your Wallet | ## Optional: Dump Your Wallet | ||||||
| 
 | 
 | ||||||
| It might seem dangerous having all of your irreplaceable private keys in a single file. That's what `bitcoin-cli backupwallet` is for. It lets you make a copy of your wallet.dat: | It might seem dangerous having all of your irreplaceable private keys in a single file. That's what `bitcoin-cli dumpwallet` is for. It lets you make a copy of your wallet.dat: | ||||||
| ``` | ``` | ||||||
| $ bitcoin-cli backupwallet ~/backup.dat | $ bitcoin-cli dumpwallet ~/mywallet.txt | ||||||
| ``` | ``` | ||||||
|  | The `mywallet.txt` file in your home directory will have a long list of private keys, addresses, and other information. Mind you, you'd never want to put this data out in a plain text file on a Bitcoin setup with real funds! | ||||||
|  | 
 | ||||||
| You can then recover it with `bitcoin-cli importwallet`. | You can then recover it with `bitcoin-cli importwallet`. | ||||||
| ``` | ``` | ||||||
| $ bitcoin-cli importwallet backup.dat | $ bitcoin-cli importwallet ~/mywallet.txt | ||||||
| ``` | ``` | ||||||
| But note this requires an unpruned node! | But note this requires an unpruned node! | ||||||
| ``` | ``` | ||||||
| $ bitcoin-cli importwallet ~/backup.dat | $ bitcoin-cli importwallet ~/mywallet.txt | ||||||
| error code: -4 | error code: -4 | ||||||
| error message: | error message: | ||||||
| Importing wallets is disabled when blocks are pruned | Importing wallets is disabled when blocks are pruned | ||||||
| @ -94,17 +96,13 @@ Importing wallets is disabled when blocks are pruned | |||||||
| 
 | 
 | ||||||
| ## Optional: View Your Private Keys | ## Optional: View Your Private Keys | ||||||
| 
 | 
 | ||||||
| Sometimes, you might want to actually look at the private keys associated with your Bitcoin addresses. Perhaps you want to be able to sign a message or spend bitcoins from a different machine. Perhaps you just want to back up certain important private keys. | Sometimes, you might want to actually look at the private keys associated with your Bitcoin addresses. Perhaps you want to be able to sign a message or spend bitcoins from a different machine. Perhaps you just want to back up certain important private keys. You can also do this with your dump file, since it's human readable. | ||||||
| 
 |  | ||||||
| To look at _all_ the keys in your wallet, type `bitcoin-cli dumpwallet ~/mywallet.txt`. |  | ||||||
| ``` | ``` | ||||||
| $ bitcoin-cli dumpwallet ~/mywallet.txt | $ bitcoin-cli dumpwallet ~/mywallet.txt | ||||||
| { | { | ||||||
|   "filename": "/home/standup/mywallet.txt" |   "filename": "/home/standup/mywallet.txt" | ||||||
| } | } | ||||||
| ``` | ``` | ||||||
| This will create a `mywallet.txt` file in your home directory with a long list of private keys, addresses, and other information. Mind you, you'd never want to put this data out in a plain text file on a Bitcoin setup with real funds! |  | ||||||
| 
 |  | ||||||
| More likely, you just want to look at the private key associated with a specific address. This can be done with the `bitcoin-cli dumpprivkey` command. | More likely, you just want to look at the private key associated with a specific address. This can be done with the `bitcoin-cli dumpprivkey` command. | ||||||
| ``` | ``` | ||||||
| $ bitcoin-cli dumpprivkey "moKVV6XEhfrBCE3QCYq6ppT7AaMF8KsZ1B" | $ bitcoin-cli dumpprivkey "moKVV6XEhfrBCE3QCYq6ppT7AaMF8KsZ1B" | ||||||
| @ -112,7 +110,7 @@ cTv75T4B3NsG92tdSxSfzhuaGrzrmc1rJjLKscoQZXqNRs5tpYhH | |||||||
| ``` | ``` | ||||||
| You can then save that key somewhere safe, preferably somewhere not connected to the internet. | You can then save that key somewhere safe, preferably somewhere not connected to the internet. | ||||||
| 
 | 
 | ||||||
| You can import any private key, from a wallet dump or an individual key dump, as follows: | You can also import any private key, from a wallet dump or an individual key dump, as follows: | ||||||
| ``` | ``` | ||||||
| $ bitcoin-cli importprivkey cW4s4MdW7BkUmqiKgYzSJdmvnzq8QDrf6gszPMC7eLmfcdoRHtHh | $ bitcoin-cli importprivkey cW4s4MdW7BkUmqiKgYzSJdmvnzq8QDrf6gszPMC7eLmfcdoRHtHh | ||||||
| ``` | ``` | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user