syntax = "proto3";
package transaction;

import "types/account.proto";
import "types/note.proto";
import "types/primitives.proto";

// TRANSACTION
// ================================================================================================

// Submits proven transaction to the Miden network.
message ProvenTransaction {
    // Transaction encoded using [winter_utils::Serializable] implementation for
    // [miden_protocol::transaction::proven_tx::ProvenTransaction].
    bytes transaction = 1;
    // Transaction inputs encoded using [winter_utils::Serializable] implementation for
    // [miden_protocol::transaction::TransactionInputs].
    optional bytes transaction_inputs = 2;
}

message ProvenTransactionBatch {
    // Encoded using [winter_utils::Serializable] implementation for
    // [miden_protocol::transaction::proven_tx::ProvenTransaction].
    bytes encoded = 1;
}

// Represents a transaction ID.
message TransactionId {
    // The transaction ID.
    primitives.Digest id = 1;
}

// Represents a transaction summary.
message TransactionSummary {
    // A unique 32-byte identifier of a transaction.
    TransactionId transaction_id = 1;

    // The block number in which the transaction was executed.
    fixed32 block_num = 2;

    // The ID of the account affected by the transaction.
    account.AccountId account_id = 3;
}

// Represents a transaction header.
message TransactionHeader {
    // ID of the account against which the transaction was executed.
    account.AccountId account_id = 1;

    // State commitment of the account before the transaction was executed.
    primitives.Digest initial_state_commitment = 2;

    // State commitment of the account after the transaction was executed.
    primitives.Digest final_state_commitment = 3;

    // Nullifiers of the input notes of the transaction.
    repeated primitives.Digest nullifiers = 4;

    // Output notes of the transaction.
    repeated note.NoteSyncRecord output_notes = 5;
}
