UtxoSpend

data class UtxoSpend(val intentHash: String, val outputNo: Int, val value: BigInteger, val owner: String, val ownerPublicKey: String, val tokenType: String)

Represents a UTXO being spent (input) in an unshielded transaction.

Source: Based on midnight-ledger UtxoSpend structure File: midnight-ledger/ledger/src/structure.rs

Purpose:

  • References an existing UTXO by intentHash and outputNo

  • Specifies the owner address (for signature verification)

  • Includes value and token type for balancing

CRITICAL: The blockchain identifies UTXOs by intentHash + outputNo.

Usage in Transaction:

val input = UtxoSpend(
intentHash = "87eb8bd03bfb2cd7...", // Intent hash from indexer
outputNo = 0,
value = BigInteger("1000000"), // 1.0 NIGHT
owner = "mn_addr_undeployed1...",
tokenType = "0000...000" // NIGHT token
)

Constructors

Link copied to clipboard
constructor(intentHash: String, outputNo: Int, value: BigInteger, owner: String, ownerPublicKey: String, tokenType: String)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Intent hash that identifies this UTXO on chain (hex string, 64 chars)

Link copied to clipboard

Output index in the creating transaction (0-based)

Link copied to clipboard

Owner's unshielded address (Bech32m format, for display)

Link copied to clipboard

Owner's BIP-340 x-only public key (hex-encoded, 32 bytes, for signing)

Link copied to clipboard

Token type identifier (hex string, 64 chars)

Link copied to clipboard

Amount being spent (in smallest units)

Functions

Link copied to clipboard

Unique identifier for this UTXO.