Skip to content

Conversation

@kallewoof
Copy link
Contributor

@kallewoof kallewoof commented Jan 26, 2022

This is a simple command for listing out all the address variants given a privkey, a feature which seems obvious but missing (unless I'm not finding the command!).

$ ./bitcoin-cli -regtest getnewaddress
bcrt1qss60qxqt3vk6kxm4j6ufwp725f89esvm8lhvf6
$ ./bitcoin-cli -regtest dumpprivkey bcrt1qss60qxqt3vk6kxm4j6ufwp725f89esvm8lhvf6
cPsQTSmMZ8e3AEUWGjS73f5R364yJxH6RxcgnwbHjbKbFPUP2Dtu
$ ./bitcoin-cli -regtest deriveaddressesfromprivkey cPsQTSmMZ8e3AEUWGjS73f5R364yJxH6RxcgnwbHjbKbFPUP2Dtu
{
  "p2pkh": "msZzuZcZUYP8pdLZ3BktxFNZJQNR8ZBQjd",
  "segwit": "bcrt1qss60qxqt3vk6kxm4j6ufwp725f89esvm8lhvf6",
  "p2sh": "2N6EW9Va47woKmpzUmkqhpzemabnJAZudWW"
}

@sipa
Copy link
Member

sipa commented Jan 26, 2022

I think that deriveaddresses with a "combo(privkey)" descriptor will do this.

@kallewoof
Copy link
Contributor Author

Interesting. I'm getting 'missing checksum', though. Syntax?

$ ./bitcoin-cli -regtest deriveaddresses "combo(cPsQTSmMZ8e3AEUWGjS73f5R364yJxH6RxcgnwbHjbKbFPUP2Dtu)"
error code: -5
error message:
Missing checksum

@sipa
Copy link
Member

sipa commented Jan 26, 2022

@kallewoof
Copy link
Contributor Author

kallewoof commented Jan 26, 2022

That worked. Nobody is going to realize that though, so I'm going to propose a change to the deriveaddresses RPC that walks through this example.

@kallewoof kallewoof closed this Jan 26, 2022
@kallewoof kallewoof deleted the 202201-deriveaddressesfromprivkey branch January 26, 2022 05:36
@bitcoin bitcoin locked and limited conversation to collaborators Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants