Bitcoind and bitcoin-cli Assignment

  1. Yes, they also have each have 1 parameter that can be specified. The parameter refers to what account is to be specified

  2. ./bitcoin-cli -regtest dumpwallet “C:\Users\windowsaccount\desktop\regtest_wallet_dump.txt”

  3. ./bitcoin-cli -regtest dumpprivkey $(./bitcoin-cli -regtest getnewaddress)

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?

Both are listed.

The descriptions fit what they do well.

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

Dumpwallet asks for a file name after the command to store the private keys in a readable format for later import.

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

This command displays the private key for the address used

  • Yes, they both can be found in the API list for the bitcoin command line interface(bitcoin-cli).
    2- dumpwallet exports all private keys to a file
    3- dumpprivkey It prints the private key of a particular address that was generated using getnewaddress
  1. yes
    getnewaddress returns an address
    getbalance returns the all your balance or from a single account

  2. .\bitcoin-cli.exe -regtest dumpwallet “D:\mykeys.txt”
    {
    “filename”: “D:\mykeys.txt”
    }

  3. .\bitcoin-cli.exe -regtest dumpprivkey 2NB7avEnkTTkL1p47y4LHX41bB8vMUykaa7
    cPKqmRrRTNB6KhoWFfPdbVpRtsoLX4WrZWKV7jjtJdY8yhvkuTv8

commands the wallet address and balance with the dump privkey and other getwalletaddress command

  1. Description is matching with what the commands do.
  2. ./bitcoin-cli -regtest dumpwallet “filename”`
  3. ./bitcoin-cli -regtest dumpprivkey [bitcoinaddress]

1.as commands of bitcoin-cli
getnewaddress returns new wallet address
getbalance returns total balance of wallet, if account is specified then the balance of the account

  1. didnt work with ./bitcon-cli -regtest dumpwallet “text.txt”, will figure out later.
  2. ./bitcoin-cli -regtest dumpprikey “mykey”

Try to add the path name as well, like ‘c:\keys.txt’

Thanks Ziomanzo

Yeah tried absolute path too but it didn’t work out.
And tried adding bitcoin.conf file…

Let me try a couple of more things later

Thanks again!

  1. I was able to find the commands. Yes the commands fit, just that the parameters need to be followed- Inserting details as required- <> “contents” and [] contents.
  2. Yes that worked fine once I used -regtest dumpwallet “File Path/ NewNameForFile.txt”
  3. I did that and it returned the following: “cP2iQY4ryctpzWkL1duoWGmvxUFxiZpYpQmKJTjzTg4dEtQD9e9g”
  1. -getnewaddress = new address is generated
    getbalance = show the current balance

  2. dumpwallet -> ./bitcoin-cli -regtest dumpwallet “D:\test.txt” = exports all private keys into "test.txt

  3. dumpprivkey-> ./bitcoin-cli -regtest dumpprivkey “address” -> shows the private key to this wallet address

[quote=“ivan, post:1, topic:7920”]
Welcome to this assignment. Try to complete the tasks below. Feel free to discuss and ask questions in this thread.

  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 fir what the commands do?

The description confirms what the commands do but also specify extra parameters to use with the commands.also with the following line you can get info about any command:
./bitcoin-cli -regtest help <command>
for ex: ./bitcoin-cli -regtest help getbalance

  1. Try to execute dumpwallet in order to store keys in a file.
    ./bitcoin-cli -regtest dumpwallet “”

  2. Try to execute dumpprivkey on an address you generated with getnewaddress.
    ./bitcoin-cli -regtest dumpprivkey

  1. Yes, the descriptions fit.
    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.

  2. Tried over and over, then finally used @cata’s suggestion for windows and it worked! Thanks @cata!!!

  3. Worked perfectly first try!

Thanks for the tip! Finally worked for me when I used your suggestion!

Bitcoind and bitcoin-cli Assignment

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

  1. getnewaddress Returns a new address to recieve payments to and if an actual account is specified a new address will be generated for that account to recieve payments to. (it doesn’t actually specify how to use account and I can generate account with account option but returning info about the account name im having trouble with. although account and label seem to be the same.)
    2, getbalance Returns the balance of the servers wallet if the account is not specified but again not been able to get account part working.

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

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

  1. getnewaddress creates a new bitcoin address for receiving payments. getbalance gives the total amount of funds available and returns the balance of a specific account if that is specified. Both commands fit their descriptions.

  2. bitcoin-cli -regtest dumpwallet “”

  3. bitcoin-cli -regtest getnewaddress

    bitcoin-cli -regtest dumpprivkey

  1. Yes, it’s possible to find those 2 commands in the list. The description generally fits and has some more information about the use of [account].
  2. ./bitcoin-cli -regtest dumpwallet “file name”
  3. ./bitcoin-cli -regtest dumpprivkey “address”

1.getnewaddress: “Returns a new bitcoin address for receiving payments. If [account] is specified payments received with the address will be credited to [account].” So it’s the information we wanted + plus some extra specific parameter.
getbalance: “If [account] is not specified, returns the server’s total available balance.
If [account] is specified, returns the balance in the account.” Same as above, plus you can get the total balance available on the server.

  1. bitcoin-cli - regtest dumpwallet

  2. bitcoin-cli - regtest dumpprivkey

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?
14|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.|N|
Once I get a better understanding of account and its specification I’ll be able to cover description’s accuracy, yet it sure does recieve the server’s total available. balance.
| — | — |
27 getnewaddress [account] Returns a new bitcoin address for receiving payments. If [account] is specified payments received with the address will be credited to [account]. N.
It does look like description serves well.
2.Try to execute dumpwallet in order to store keys in a file.
That one was one goood lesson…I was locked in the misunderstanding state were I thought there is a file in bitcoind which dumpwallet is supposed to open and store PvK in bitcoin-cli just like an address. Now I know better-
./bitcoin-cli -regtest dumpwallet “C:\Users…mysername…\Desktop\PRVK”
3. Try to execute dumpprivkey on an address you generated with getnewaddress.
./bitcoin-cli -regtest dumpprivkey 2N7y5yJ8TqgY5MbPYbvTrP67hKSSkvwv4yg

cVQopEVkHp4MYBKQPYnNPRSFGrfWNBoP1gRUpBcGnXk5YvxTED8k

1 Like
  1. Yes I can find them and the description describes what each command does.

2.PS C:\Program Files\Bitcoin\daemon> ./bitcoin-cli -regtest dumpwallet C:\Users\diogo
error code: -8
error message:
C:\Users\diogo already exists. If you are sure this is what you want, move it out of the way first
PS C:\Program Files\Bitcoin\daemon>

Need help with this one, Could you please help Fabrice?

  1. PS C:\Program Files\Bitcoin\daemon> ./bitcoin-cli -regtest dumpprivkey 2NBYdaSxbuZ7V9kv5ZvQpKTJusfn6QFHtes
    cPxf5cc1XCLVbZWxUm2bbbDtXhf5FuaYnC6DWhc3tMW9H673CZgh
1 Like