1.) We have already used some commands in previous lectures, let’s find them in the list and verify how they are described. Can you find getnewaddress and getbalance in the list? Does the description match what the commands do?
a.) getnewaddress: Produced and return a new Bitcoin address when commanded.
b.) getbalance: Returns balance of specific account.
2.) Try to execute dumpwallet in order to store keys in a file.
">./bitcoin-cli -regtest dumpwallet "C:\Users\Hector Martinez\Desktop\Wallet02.txt
3.) Try to execute dumpprivkey on an address you generated with getnewaddress.
">./bitcoin-cli -regtest dumpwallet “wallet address”
We have already used some commands in previous lectures, let’s find them in the list and verify how they are described. Can you find getnewaddress and getbalance in the list? Does the description fir what the commands do?
getnewaddress- yes, with the addition that you can specify the account to create the new address
getbalance-yes, additionally you could query an account’s balance [account]
Try to execute dumpwallet in order to store keys in a file.
Error- it requires a ‘filename’ argument
Try to execute dumpprivkey on an address you generated with getnewaddress.
-generates a lengthy hash
1. We have already used some commands in previous lectures, let’s find them in the list and verify how they are described. Can you find getnewaddress and getbalance in the list? Does the description fit what the commands do? Yes, apart from the extra parameters we can use. 2. Try to execute dumpwallet in order to store keys in a file. .\bitcoin-cli.exe -regtest dumpwallet “path/filename” 3. Try to execute dumpprivkey on an address you generated with getnewaddress. .\bitcoin-cli.exe -regtest dumpprivkey 2ND5bFcqYn9newZCBy9CRvthTmAz7pQFh6c
Dumps all wallet keys in a human-readable format to a server-side file. This does not allow overwriting existing files.
Imported scripts are included in the dumpfile, but corresponding BIP173 addresses, etc. may not be added automatically by importwallet.
Note that if your wallet contains keys which are not derived from your HD seed (e.g. imported keys), these are not covered by
only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).
Arguments:
“filename” (string, required) The filename with path (either absolute or relative to bitcoind)
Result:
{ (json object)
“filename” : { (string) The filename with full absolute path
}
PS C:\Program Files\Bitcoin\daemon> ./bitcoin-cli -regtest dumpwallet “C:\Users\Owner\Desktop\Dumpwallet file”
error code: -8
error message:
C:\Users\Owner\Desktop\Dumpwallet file already exists. If you are sure this is what you want, move it out of the way first
PS C:\Program Files\Bitcoin\daemon>
I have no idea what to do here. How do I move it out of the way?
You know what’s funny. I actually did this right after about the 3rd try but I didn’t realize when it said filename that it created a file. At least until reading many posts. I now have about 10 dump files. Yep, I’m the new guy. Thanks.
We have already used some commands in previous lectures, let’s find them in the list and verify how they are described. Can you find getnewaddress and getbalance in the list? Does the description fir what the commands do?
getnewaddress:
returns a new bitcoin address for receiving payments. If [account] is specified payments received with the address will be credited to [account].
getbalance:
If [account] is not specified, returns the server’s total available balance.
If [account] is specified, returns the balance in the account.
Try to execute dumpwallet in order to store keys in a file.
We have already used some commands in previous lectures, let’s find them in the list and verify how they are described. Can you find getnewaddress and getbalance in the list? Does the description for what the commands do?
Getnewaddress ./bitcoin-cli -regtest getnewaddress
Returns a new Bitcoin address for receiving payments. Getbalance./bitcoin-cli -regtest getbalance
Returns the total available balance.
Try to execute dumpwallet in order to store keys in a file.
Yes the description fits with what the commands do, plus an additional function for specified accounts.
getnewaddress [account] Returns a new bitcoin address for receiving payments. If [account] is specified payments received with the address will be credited to [account].
getbalance [account] [minconf=1] If [account] is not specified, returns the server’s total available balance.
If [account] is specified, returns the balance in the account.
1. We have already used some commands in previous lectures, let’s find them in the list and verify how they are described. Can you find getnewaddress and getbalance in the list? Does the description for what the commands do?
Yes, the description for getnewaddress and getbalance fit exactly what the commands do.
2. Try to execute dumpwallet in order to store keys in a file.
Step 1. We export all the private keys to a file by using the following commands.
Yes, the descriptions of both getbalance and getnewaddress fit what the commands do.
They also tell you what will happen if an account is specified vs. unspecified
getbalance -
If [account] is not specified, returns the server’s total available balance. If [account] is
specified, returns the balance in the account.
getnewaddress -
Returns a new bitcoin address for receiving payments. If [account] is specified payments
received with the address will be credited to [account].
I didn’t realize you had to create the name of the file you were dumping to in the powershell command line. I thought you were dumping to a pre-existing file. I tried doing it without creating a file name, just going straight to the desktop and got an error. Then I created a .txt file on the desktop and tried dumping it to that file and got an error. If anyone is struggling with this you just specify the directory that you want it to go to in bitcoin-cli and add \walletname at the end. It will create the file for you in the directory you specified.
They do exactly as the description hints. getnewaddress creates a new address that is assigned to the currently loaded wallet, and getbalance returns the total balance of either a specific wallet or (if not specified) the total balance of all the local wallets.
dumpwallet doesn’t execute, if a filepath is not specified. Note that in order to dump the information in a file, the file must not exist (cannot override an existing file) and the shell user must have write access to the directory of writing.
Hint: Logging private keys in the stdout might not be a good idea security-wise. Consider redirecting the key in a file: .\bitcoin-cli.exe dumpprivkey address > test.log
Yes, the commands are on the API calls list. The description match the command functionality and also describe some extra features that can be accomplished with the commands with extra input parameters.
The keys are properly dumped into the specified file.