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: 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.
Code to execute dumpwallet:
./bitcoin-cli -regtest dumpwallet "C:\Users\Jack\Downloads\dumpfile"
Output:
{
"filename": "C:\\Users\\Jack\\Downloads\\dumpfile"
}
Try to execute dumpprivkey on an address you generated with getnewaddress.
- Code To get New Address:
./bitcoin-cli -regtest getnewaddress
=> Output:2NAqwPpZjRprSZ339Sf2pcWnxsv9NXK9AT7
- Code To Dump Private Key:
./bitcoin-cli -regtest dumpprivkey 2NAqwPpZjRprSZ339Sf2pcWnxsv9NXK9AT7
=> Output:cUjjchWcae4qt9GUFSPRX6mUQx4tSDt8e3HPwtGV82LezYZhXX3C