Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: rc333 on April 16, 2021, 03:23:47 PM



Title: BTc Core- new wallet getting public address on CLI?
Post by: rc333 on April 16, 2021, 03:23:47 PM
How would I get the Public address for the new wallet I created?
tried dumpwallet but the text outputted is not showing it (hdkeypath=m/0'/0'/0')

opened it with the walletpassphrase  "seed words" 99999
prior.

thanks!


Title: Re: BTc Core- new wallet getting public address on CLI?
Post by: ranochigo on April 16, 2021, 04:03:19 PM
I think you meant passphrase?

How did you use dumpwallet *DIRECTORY* in that format? It will not output any text in the cli pertaining to the dump but will create a file in the defined directory. The following syntax works for me.

Code:
dumpwallet E:/Walletdat1.txt


Title: Re: BTc Core- new wallet getting public address on CLI?
Post by: rc333 on April 16, 2021, 05:02:16 PM
"How would I get the Public address for the new wallet I created?"

I am looking for the address that starts with bc1


Title: Re: BTc Core- new wallet getting public address on CLI?
Post by: ranochigo on April 16, 2021, 05:07:23 PM
"How would I get the Public address for the new wallet I created?"

I am looking for the address that starts with bc1
Is there a specific reason why you need to get the address of the first index?

If you've already called getnewaddress, try using listaddressgroupings.


Title: Re: BTc Core- new wallet getting public address on CLI?
Post by: HCP on April 17, 2021, 04:08:09 AM
How would I get the Public address for the new wallet I created?
Bitcoin Core is an "HD" Wallet (hierarchal determinisic) wallet... it doesn't have "a" Public address... it has many public addresses (theoretically an unlimited number).

Do you specifically need the "first" address? or will any address do?

If you have used the getnewaddress command ONCE, it should return the first address from the keypool, which should be the address at hdkeypath=m/0'/0'/0' NOTE: if you use it again, it'll return the m/0'/0'/1' address, then m/0'/0'/2' etc

If you didn't explicitly provide a "label" when using the getnewaddress... you can get it to display by using getaddressbylabel command and passing an empty string:
Code:
getaddressbylabel ""

It should return something like:
Code:
{
  "bc1_your_address_here": {
    "purpose": "receive"
  }
}

Note... if you have generated multiple addresses, there is no guarantee that the getaddressbylabel command will return them "in order".



tried dumpwallet but the text outputted is not showing it (hdkeypath=m/0'/0'/0')
Did you search for the m/0'/0'/0' in the output text using dumpwallet... the address (and all 1000 keypool addresses) should be displayed in the dump file? ???


Title: Re: BTc Core- new wallet getting public address on CLI?
Post by: nc50lc on April 17, 2021, 12:48:16 PM
tried dumpwallet but the text outputted is not showing it (hdkeypath=m/0'/0'/0')
I am looking for the address that starts with bc1
You might have dumped the wrong wallet, in CLI, you'll have to specifically load and indicate a wallet together with your commands.
Without loading other wallets, it will select the default wallet when using wallet commands.

Use this to load a wallet:
Code:
bitcoin-cli loadwallet "wallet_name/path"
Use this to issue commands for that wallet:
Code:
bitcoin-cli -rpcwallet="wallet_name" <command>

Also, do you have any configurations in your bitcoin.conf file?