Skip to main content
Version: 0.2.38

sdk.txbuilder.addreferenceinput

Home > @blaze-cardano/sdk > TxBuilder > addReferenceInput

TxBuilder.addReferenceInput() method

Adds a reference input to the transaction. Reference inputs are used to refer to outputs from previous transactions without spending them, allowing scripts to read their data. This can be useful for various contract logic, such as checking the state of a datum without consuming the UTxO that holds it.

Signature:

addReferenceInput(utxo: TransactionUnspentOutput): TxBuilder;

Parameters

Parameter

Type

Description

utxo

TransactionUnspentOutput

The unspent transaction output to add as a reference input.

Returns:

TxBuilder

{TxBuilder} The same transaction builder

Exceptions

{Error} If the input to be added is already present in the list of reference inputs, to prevent duplicates.