Private key dump and import do not result in the same address

I am trying to dump and import a private key but I am having strange problems.

I must be making some really silly mistake here:

nud listaccounts
ADDR=`nud getaccountaddress ""`
WIF_KEY=`nud dumpprivkey "$ADDR"`
#Then you stop nud, delete walletB.data and walletS.dat so new ones are created (you can also use another nud instance with a diferent wallet)

nud importprivkey "$WIF_KEY" "imported1"
nud getaccountaddress "imported1" #You get a new, diferent address
echo $ADDR                      #Check the address for which you exported the WIF private key
#They do not match?

Do they match to you? Here they don’t.

UPDATE:
I ran nud validateaddress $ADDR and it shows that it is valid and that is also in the “imported1” account, but nud getaccountaddress "imported1" only show the new, different address created when importing the WIF key.
So it is somewhere in the wallet but you can not see it in any account. Is this the expected behavior?

you have to use -unit=B as additional parameter when importing NBT addresses, otherwise they are considered as NSR addresses and your wallet is messed up (not broken, but it may display misleading data).

I know, I am working with NSR addresses here. Wallet is always NSR mode, -unit parameter not touched.

Can you reproduce the problem on your wallet?

Ah ok, sorry I didn’t read that you also posted how you dumped the key.

However, note that the second parameter of importprivkey is the label of this address, not the account. getaccountaddress asks for an account and you provide the label of this address, which will return an empty account I guess.

If the NSR is not empty then it should show up when you type listreceivedbyaddress.

I am also confused by the difference in arguments with “label” and “account”, but as far as I understand you can have multiple accounts, each one with a name, and inside each account multiple address. But individual address do not have a “label” so it should be the same as the account name.

Also when I execute importprivkey with a new account name in the “label” argument, a new account with the label name is created, and inside that account the address is added.

OK maybe I am understanding this wrong. I’m afraid I cannot test it right now because my wallet is in continuous action.

Paging @CoinGame @desrever

Please also post your operating system and wallet software version.

I am using v0.5.4-beta on windows 8.1 64 and in linux arm on a raspberry pi.

Sorry. I haven’t had a chance to look at this yet. I’ll talk with @sigmike about it and run through some tests if need be.