Is there any way to identify the transaction type using the following data in Bitcoin blockchain:

  • InputCount
  • OutputCount
  • Transaction Version
  • Transaction Size
  • Transaction Weight
  • Transaction Lock Time

I am using https://ide.bitquery.io/ for getting the data

1 Answer 1


How to determine the transaction type using transaction hash?

There is no concept of type in the Bitcoin network. Therefore, neither transactions nor outputs nor inputs have a type. However, the outputs (locking scripts) are most often of a certain standard form, and the inputs then consume those standard outputs. Therefore, some group of output and input types is actually defined from those standard forms of output and input. It is important to understand that these types (P2PKH, P2SH etc.) exist only for end users and not for the Bitcoin network. The type of input or output is not indicated anywhere in the transaction.

Here you can see all types of output: link

Here you can see how to determine the input type: link

Based on everything written, the conclusion is that there is no transaction type, but only input and output type (although this is not part of the network). What we could potentially define as the type of transaction is whether it is a segregated witness (segwit) transaction or not, that is, whether some of the inputs consume a segwit output or such an input does not exist in the transaction. Such a transaction can be recognized very easily when looking at its raw (serialized) form. Namely, the value of the fifth byte is 0x00 and the value of the sixth byte is 0x01. If the fifth and sixth bytes are not set to these values, it is a non-segwit transaction.

Is there any way to identify the transaction type using the following data in Bitcoin blockchain:

No, you cannot determine either the output type, the input type, or the transaction type based on the given fields.

  • I'm in need of a data filtering process to identify anomalies within transactions. Additionally, I'm looking for a method to exclude transactions that don't fit the anomaly criteria. Any recommendations for achieving this? This data will be used to train a machine learning model. Commented Oct 1, 2023 at 14:03
  • 1
    @DevSapariya What type of anomalies are you referring to?
    – dassd
    Commented Oct 1, 2023 at 14:07
  • 1
    Hey @DevSapariya, it sounds like you are trying to do something that you have not explained in your question. Since Filip wrote such a nice comprehensive answer to your question that was asking about your approach to solve your problem, perhaps you should create a new topic to ask about the actual problem you’re trying to solve rather than your approach to solve your problem. :)
    – Murch
    Commented Oct 2, 2023 at 18:03
  • Anomalies indicate whether a specific transaction is involved in any illegal activities. My goal is to employ machine learning to cluster these transactions. Commented Oct 3, 2023 at 6:17
  • I should exclude transactions that are not person-to-person since they cannot be used for illegal activities. Commented Oct 3, 2023 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.