Bitcoind and bitcoin-cli Assignment

Can you find getnewaddress and getbalance in the list? Does the description fit what the commands do?

getnewaddress

Returns a new bitcoin address for receiving payments.

If [account] is specified, payments received with the address will go to [account]

getbalance

Returns the server’s total available balance if no [account] is specified

Returns the balance in the account if [account] is specified.

Try to execute dumpwallet in order to store keys in a file.

./bitcoin-cli -regtest dumpwallet “filename”

Dumps all wallet keys in a human-readable format to a server-side file.

Try to execute dumpprivkey on an address you generated with getnewaddress.

./bitcoin-cli -regtest dumpprivkey “bitcoinaddress”

Reveals the private key corresponding to the bitcoin address specified.

1. Can you find getnewaddress and getbalance in the list? Does the description fir what the commands do?

  • Getnewaddress ``

PS D:\Bitcoin\daemon> ./bitcoin-cli -regtest getnewaddress

2NAVuu8czLuMhTzipsb5aJyQJXiuBA3RrzQ

Returns a new bitcoin address for receiving payments. If [account] is specified payments received with the address will be credited to [account].

Getbalance ``

PS D:\Bitcoin\daemon> ./bitcoin-cli -regtest getbalance

8824.99528020 ``

If [account] is not specified, returns the server’s total available balance.
If [account] is specified, returns the balance in the account.

2.Try to execute dumpwallet in order to store keys in a file.

NB; for reference if you have already dumped the wallet and get this error message it’s because you already have the file name for the dump (correct example below)

PS D:\Bitcoin\daemon> ./bitcoin-cli -regtest dumpwallet “test”

error code: -8

error message:

D:\Bitcoin\daemon\test already exists. If you are sure this is what you want, move it out of the way first

CORRECT EXAMPLE; PS D:\Bitcoin\daemon> ./bitcoin-cli -regtest dumpwallet “test”

{

“filename”: “D:\Bitcoin\daemon\test”

Which produces a file as above that you go click on the file open it with word pad for instance and you will get something like this:

Wallet dump created by Bitcoin v0.17.1

* Created on 2023-03-01T12:55:55Z

* Best block at time of backup was 304 (741f7a7ab6521f5e31de1cbc1d5552fa44a7cf9ea5d658421df4c2460668d7af),

mined on 2023-02-23T12:24:54Z

extended private masterkey: tprv8ZgxMBicQKsPdovvyC2ZAMpuUb3xufLhTBEBFrY2etkQwG2MUeYzXNknGCorHEhtHsVEpFmUjXVzBTUyyRpuN5ZYcVw92QDDM7TYgoLRxwd

cRktNPomqXhnZzCRJrJojLKJ9ZdKX9m5hTsjMe8muMgvLkPWtvfV 2023-02-23T11:53:42Z reserve=1 # addr=2N1ievcGfs6p97CVkYn4y3oiT6jdtXVmPMA hdkeypath=m/0’/1’/516’

cPTGLsXb3G9rkcFQfGaMpquMXtqWmWqx5xxr13SdTnPYmona4gdZ 2023-02-23T11:53:42Z reserve=1 # addr=2MsrwEqEAPX9Mhw6PR8MF1BuEwekofTggdt hdkeypath=m/0’/1’/434’

cSjHwzmoc4RTWV3sT7d8exg16v8XatJVo2z3ATqXBgCaV7uTDRqY 2023-02-23T11:53:42Z reserve=1 # addr=

And it just continues forever haha

3. try to execute dumpprivkey on an address you generated with **getnewaddress.

PS D:\Bitcoin\daemon> ./bitcoin-cli -regtest getnewaddress

2N2ncyVQXyyfNeQjSKEUgRfuRYSRAz5xPxe

PS D:\Bitcoin\daemon> ./bitcoin-cli -regtest dumpprivkey 2N2ncyVQXyyfNeQjSKEUgRfuRYSRAz5xPxe

cRn5tGwFVqxSsqFYr2NmrnWVQJG7LFtDT2CSpiuXGJ3GoX4S9JY6

1 Like
  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

  2. Try to execute dumpwallet in order to store keys in a file.
    Success

  3. Try to execute dumpprivkey on an address you generated with getnewaddress.
    Sucess

  1. Yes, the description reflects the command function implemented.
  2. Attempts unsuccessful
  3. Attempts unsuccessful
    Time is of the essence: Will study Bitcoin Core tutorial for further information and clarification at later date.