next to the answer from MeshCollider, I would like to outline a bit more, what can/cannot be done...
- How can I get the whole balance of the privatekey or publickey?
a priv/pubkey pair can generate several addresses. A privkey is the most standard used for P2PKH addresses (beginning with "1" on bitcoin network). They can be derived from a compressed or an uncompressed pubkey. A good playground is here. Then you can create P2SH addresses, of all kind with this key. They would start with a "3". And yes, multisig addresses would just be one of the possibilities. There are many combinations possible (1-of-1, 1-of-2, 1-of-3, 2-of-3, 2-of-4 ...), each resulting in a different "type 3" address. So if you have created the addresses within bitcoin client, you can use the command "getbalance". This command is linked to accounts, and once the addresses are grouped in accounts, one can display total balance in wallet or particular accounts. Addresses used in accounts can be seen with "getaddressesbyaccount", and then the addresses can be evaluated with "listunspent", gripping for the address you need. There is also the command to see the total amount received per address (getreceivedbyaddress).
In summary: you may want to create some coding logic to use the API calls. The API calls list is available in the source code, or in the wiki.
- How can list all the address from one privatekey or publickey?
as MeshCollider explained, this needs some manual setup, nothing in bitcoin client that fits the request.
- What's more how to process multisig address which generated from not
the same privatekey of publickey?
When you created the multisig address with bitcoin core client ("addmultisigaddress"), then the client should display the values on this address. When the multisig was created "outsides" of the client, it will not display values for the account, even if you add the address as a "watch only" address (setaccount is now deprecated, and impogrtaddress is obviously the way to go). Anyhow I couldn't make my wallet see a balance on these imported addresses (though I am on regtest, and used txindex=1 in bitcoin.conf).
Even more, if the address is "only" known, and hasn't been used on the blockchain, then the P2SH multisig addresses are covered behind a hash, which is a one-way function. So you never know the details of keys or logic used inside...
do you want to know how to do this for bitcoins with the bitcoin client, or any other wallet, or are you looking for a program (in which language) to extract this data for you? A general guideline is here: https://bitcoin.stackexchange.com/questions/10090/how-to-get-an-addresss-balance-with-the-bitcoin-client
– pebwindkraft – 2018-04-08T05:14:34.570@pebwindkraft In my question I said, I know how to get the balance of one address. Here I want to get the whole balance from the addresses generated from one public key or privatekey. – Kris Roofe – 2018-04-08T05:23:31.673
@pebwindkraft any language is ok. I just want to know the idea to make it. – Kris Roofe – 2018-04-08T05:25:56.897