Retrieving an addresses' public key from Pkscript/sigscript/witness Let's use this transaction as an example. In the transcation, address 3GGoy8NoCF62TCAPGidWMU3u1ZrgwmasFt has a pkscript, a sigscript and a witness. It is possible to use any one of these, or some combination of them to retrieve that address' public key?
The output script (typically referred to as the scriptPubKey, but for some reason blockchain.com is calling it pkscript) tells you where to find the public key(s). It depends on the output script used. The public key(s) could be found in any of the three places.
In your example, the output script is a Pay to Script Hash (P2SH) script. This tells us that the script that is actually being executed is found in the input script (typically referred to as the scriptSIg, but for some reason blockchain.com is calling it sigscript). P2SH stipulates that the first item in the scriptSig is another script. In this example, there is only one item in the scriptSig, and that item is a script. This script is a Pay to Witness Pubkey Hash script (P2WPKH). This tells us that in the witness for this input, we should find a signature, followed by the public key. If you look at the witness section, you will see two items, the first is the signature, the second is the public key.
So in your example, the public key is found in the witness. However this is not always the case. It all depends on the various script types. If the output script were a Pay to Pubkey (P2PK) script, then the public key would be found in the output script. If it were a Pay to Public Key Hash (P2PKH) script, it would be found scriptSig. The address could also refer to a more complicated script that has multiple public keys, or no public keys at all. It all depends on the scripts.