As there are some bitcoin address types of one privatekey or publickey. I can get the balance of one address, but how can I get the whole balance of the privatekey or publickey. How can list all the address from one privatekey or publickey. What's more how to process multisig address which generated from not the same privatekey of publickey.
You will have to generate all the addresses corresponding to the public or private key you want to check, and then look for them all in the UTXO set. For example you might want to look for P2PK, P2PKH, P2WPKH, 1-of-1 multisig address with just that public key, etc. There is no "one search fits all"
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...