syntax = 'proto3';

package utxo_messages;

import "../utxo/block_message.proto";

message ParsedBlockMessage {
  BlockHeader Header = 1;
  repeated ParsedTransaction Transactions = 2;
}

message ParsedTransaction {
  TransactionHeader Header = 1;
  repeated ParsedTransactionInput Inputs = 2;
  repeated ParsedTransactionOutput Outputs = 3;
  uint64 Fee = 4;
}

message ParsedTransactionInput {
  TransactionInput Input = 2;
  ParsedTransactionOutput SpentOutput = 3;
}

message MinBlockHeader {
  bytes Hash = 1;
  int64 Height = 2;
  int64 Time = 3;
}

message ParsedTransactionOutput {
  TransactionOutput Output = 1;
  string Address = 2;
  ScriptType ScriptType = 3;
  bytes Script = 4;
  uint32 ReqSigs = 5;
  uint64 Value = 6;
  MinBlockHeader Block = 7;
}

enum ScriptType {
  UNKNOWN = 0;
  PUBKEY = 1;
  PUBKEYHASH = 2;
  SCRIPTHASH = 3;
  MULTISIG = 4;
  NULLDATA = 5;
  WITNESS_V0_KEYHASH = 6;
  WITNESS_V0_SCRIPTHASH = 7;
  WITNESS_UNKNOWN = 8;
}