code: def get_public_key_hex_from_tx( inputs, address ):
      
  
      ret = None
      for inp in inputs:
          input_scriptsig = inp['script']
          input_script_code = virtualchain.btc_script_deserialize(input_scriptsig)
          if len(input_script_code) == 2:
              # signature pubkey
              pubkey_candidate = input_script_code[1]
              pubkey = None
              try:
                  pubkey = virtualchain.BitcoinPublicKey(pubkey_candidate)
              except Exception as e:
                  traceback.print_exc()
                  log.warn("Invalid public key {}".format(pubkey_candidate))
                  continue
  
              if address != pubkey.address():
                  continue
  
              # success!
              return pubkey_candidate
  
      return None
docs: Given a list of inputs and the address of one of the inputs,
      find the public key.
  
      This only works for p2pkh scripts.
  
      We only really need this for NAMESPACE_REVEAL, but we included 
      it in other transactions' consensus data for legacy reasons that
      now have to be supported forever :(