<p>In simple terms, redeemer is the data that the user of the smart contract provides to the smart contract.</p>
<p>In the simple UTxO model, redeemer is your signature. By providing your signature, you prove that you own the UTxO and in return you are allowed to spend that UTxO.</p>
<p>EUTxO takes this one step further. How are you going to spend an EUTxO? You have to provide all the data that EUTxO needs and depending on the data you provide, you are allowed to spend it or not.</p>

CC BY-SA 4.0
2021-05-16T02:12:04.207Z
2021-05-16T02:12:04.207Z
Jelil Akjaly
<p><strong>Before (E)UTxO - There Was UTxO</strong></p>
<p><em>Understanding how a UTxO model works (such as BTC) may help you understand the implementation of (E)UTxO in Cardano.</em></p>
<p><strong>The UTxO Model</strong></p>
<p>A UTxO model, meaning: unspent transaction outputs from previous transactions<sup>1</sup> will typically implement a validator and a redeemer for any given new transaction (at least, this is the case in BTC).</p>
<p><strong>Validators and Redeemers</strong></p>
<p>The validators job is to return a boolean value as to whether the UTxO can be spent or not. In BTC the validator is implemented in BitCoin Script and is about as simple as it could be. It does, however, take a redeemer (which in the case of BTC is a representation of transactional digital signatures); and the validator uses the redeemer to either allow the UTxO to be spent or not.</p>
<p><strong>Cardano | The (E)UTxO Model</strong></p>
<p>Within Cardano we use scripts to evaluate whether or not a given (E)UTxO may or may not be spent. An address in Cardano points to a script - the script contains arbitrary logic and takes a redeemer as its input/parameter(s) - which are now also more general in nature, as they need to satisfy the constraints provided by the arbitrary logic within the script.</p>
<p>By triggering the script (attempting to create a new transaction), the redeemer will be passed to the script, the script will be executed and will determine whether or not the (E)UTxO can be spent or not.</p>
<p><strong>Summary</strong></p>
<p>A redeemer is used as input to an (E)UTxO script in order to determine whether or not the extended unspent transaction output may or may not be consumed, given the arbitrary logic provided within the script.</p>
<p><em>FYI: Cardano addresses point to scripts, the script may be simple or extremely complex.</em></p>
<p>I found this video by Michael Peyton Jones to be pretty informative and perhaps a little more intuitive than the first lecture presented within the Plutus Pioneer Program:</p>
<p><a href="https://youtu.be/usMPt8KpBeI" rel="noreferrer">https://youtu.be/usMPt8KpBeI</a></p>
<p><em>However, it may be a little outdated? I'm still working my way through the second cohort.</em></p>
<hr />
<p><strong>Footnotes:</strong></p>
<ol>
<li>Think of an unspent transaction as the change you're given in a shop when you hand a $20 bill for a $5 item, the $15 change is <strong>YOUR</strong> UTxO and is secured using public-private key cryptography.</li>
</ol>

CC BY-SA 4.0
2021-11-09T13:31:49.170Z
In Bitcoin, both the "validator" and "redeemer" is Bitcoin Script. The output of the redeemer is given as input to the validator. In Bitcoin's implementation this amounts to the validator script being executed against the stack produced by the redeemer script. The validator script will then determine if the redeemer is valid based on the stack it leaves behind.
runeks
CC BY-SA 4.0
2021-07-20T00:56:32.310Z
2021-07-20T01:02:06.533Z
2021-07-20T01:02:06.533Z
Dilworth
<p>From <a href="https://iohk.io/en/blog/posts/2021/04/13/plutus-what-you-need-to-know/" rel="noreferrer">https://iohk.io/en/blog/posts/2021/04/13/plutus-what-you-need-to-know/</a>:</p>
<blockquote>
<p>When validating an address, the script will access the data being
carried by the output, the transaction being validated, and some
additional pieces of data called <strong>redeemers</strong>, which the transaction
provides for every input. By looking up all this information, the
script has enough context to give a ‘yes’ or ‘no’ answer in what can
be highly complex situations and use cases.</p>
</blockquote>
<p>In lecture 1 of the current plutus pioneers program, you find a <a href="https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week01/src/Week01/EnglishAuction.hs#L77" rel="noreferrer">redeemer</a> on the <a href="https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week01/src/Week01/EnglishAuction.hs#L103" rel="noreferrer">auction validation script</a>. When making a bid, there are essentially five cases to check. All these five cases need to pass or the transaction will not be even committed to the blockchain (which is good, because you're saving on fees for something that won't succeed anyway):</p>
<ol>
<li>Is the bid sufficient (the bid is &gt;= the minimum valid bid)</li>
<li>The auction hasn't closed</li>
</ol>
<p>The three other cases also do data checks (output datum/value, bid refund).</p>
<p>The redeemer (in the auction example) itself is a simple data type that we can define (AuctionAction) to do data validation (particularly on inputs).</p>

CC BY-SA 4.0
2021-05-16T00:22:26.257Z
That was a great explanation.Thanks.
szhang9921
CC BY-SA 4.0
2021-05-16T03:53:36.840Z
Thank you. If you're happy with the explanation, make sure to mark the answer as a solution to your question as it helps other StackExchange users to see what questions have/haven't been answered sufficiently.
Matthias Sieber
CC BY-SA 4.0
2021-05-15T22:09:03.643Z
2021-07-20T02:24:15.493Z
2021-07-20T02:24:15.493Z
Matthias Sieber
<p>There is an interesting example in one of the Pioneer lectures which implements Uniswap on Cardano.</p>
<p>A redeemer is not only used to justify that a UTxO can be spent, but also the manner in which it will be spent. The validation script will then place the necessary constraints on the creation of the transaciton based on who is trying to spend it and how they are trying to spend it.</p>
<p>In the screenshot attached from lecture 10 of the first iteration of the Plutus Pioneer Program, the blue lines represent the redeemer as an input to the UTxO's validation script (represented by the blue and red circles) which, in this case, is validating the consumption of  a UTxO which represents a liquidity pool.</p>
<p>You can see four different labels on four of the blue lines - Create, Swap, Add and Remove. These represent different constructors for the redeemer data type being used and tell the script what action the user is trying to take.</p>
<p>For further details of exactly what each redeemer does, you can read more and find a link to the video <a href="https://plutus-pioneer-program.readthedocs.io/en/latest/week10.html" rel="nofollow noreferrer">here</a>.</p>
<p><a href="https://i.sstatic.net/uGnsf.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uGnsf.jpg" alt="Uniswap on Cardano Example" /></a></p>

CC BY-SA 4.0
2021-07-20T10:31:58.130Z
2021-07-20T10:37:05.803Z
2021-07-20T10:37:05.803Z
Chrismo
<p>So I am currently on lecture 1 on the Plutus Pioneer Program. In the lecture they said the redeemer is the input information that the script uses to decide if a specific UTxO can be spent. I watched a video that was made two years ago that said the redeemer is used to decide if a wallet can receive Ada from a smart contract. The person in that video did say that these things might change because things are still under development. Can someone clear this up for me? What exactly is a redeemer as of right now? What is a redeemer's role in sending transaction and in smart contracts?</p>

<smart-contract><utxo><script><redeemer>
What is a Redeemer?
# What is a Redeemer?

(Asked by: username_0 on 2021-05-15)

So I am currently on lecture 1 on the Plutus Pioneer Program. In the lecture they said the redeemer is the input information that the script uses to decide if a specific UTxO can be spent. I watched a video that was made two years ago that said the redeemer is used to decide if a wallet can receive Ada from a smart contract. The person in that video did say that these things might change because things are still under development. Can someone clear this up for me? What exactly is a redeemer as of right now? What is a redeemer's role in sending transaction and in smart contracts?

**Tags:** smart-contract, utxo, script, redeemer

---

## 4 answers

### Answer by username_4 on 2021-05-15. Score: 15 | Accepted answer

From <https://iohk.io/en/blog/posts/2021/04/13/plutus-what-you-need-to-know/>:

> When validating an address, the script will access the data being
> carried by the output, the transaction being validated, and some
> additional pieces of data called **redeemers**, which the transaction
> provides for every input. By looking up all this information, the
> script has enough context to give a ‘yes’ or ‘no’ answer in what can
> be highly complex situations and use cases.

In lecture 1 of the current plutus pioneers program, you find a [redeemer](https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week01/src/Week01/EnglishAuction.hs#L77) on the [auction validation script](https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week01/src/Week01/EnglishAuction.hs#L103). When making a bid, there are essentially five cases to check. All these five cases need to pass or the transaction will not be even committed to the blockchain (which is good, because you're saving on fees for something that won't succeed anyway):

1. Is the bid sufficient (the bid is >= the minimum valid bid)
2. The auction hasn't closed

The three other cases also do data checks (output datum/value, bid refund).

The redeemer (in the auction example) itself is a simple data type that we can define (AuctionAction) to do data validation (particularly on inputs).

> **Comments:**
> **username_0**: That was a great explanation.Thanks.  
> **username_4**: Thank you. If you're happy with the explanation, make sure to mark the answer as a solution to your question as it helps other StackExchange users to see what questions have/haven't been answered sufficiently.  

---

### Answer by username_1 on 2021-05-16. Score: 11

In simple terms, redeemer is the data that the user of the smart contract provides to the smart contract.

In the simple UTxO model, redeemer is your signature. By providing your signature, you prove that you own the UTxO and in return you are allowed to spend that UTxO.

EUTxO takes this one step further. How are you going to spend an EUTxO? You have to provide all the data that EUTxO needs and depending on the data you provide, you are allowed to spend it or not.


---

### Answer by username_2 on 2021-07-20. Score: 6

**Before (E)UTxO - There Was UTxO**

*Understanding how a UTxO model works (such as BTC) may help you understand the implementation of (E)UTxO in Cardano.*

**The UTxO Model**

A UTxO model, meaning: unspent transaction outputs from previous transactions1 will typically implement a validator and a redeemer for any given new transaction (at least, this is the case in BTC).

**Validators and Redeemers**

The validators job is to return a boolean value as to whether the UTxO can be spent or not. In BTC the validator is implemented in BitCoin Script and is about as simple as it could be. It does, however, take a redeemer (which in the case of BTC is a representation of transactional digital signatures); and the validator uses the redeemer to either allow the UTxO to be spent or not.

**Cardano | The (E)UTxO Model**

Within Cardano we use scripts to evaluate whether or not a given (E)UTxO may or may not be spent. An address in Cardano points to a script - the script contains arbitrary logic and takes a redeemer as its input/parameter(s) - which are now also more general in nature, as they need to satisfy the constraints provided by the arbitrary logic within the script.

By triggering the script (attempting to create a new transaction), the redeemer will be passed to the script, the script will be executed and will determine whether or not the (E)UTxO can be spent or not.

**Summary**

A redeemer is used as input to an (E)UTxO script in order to determine whether or not the extended unspent transaction output may or may not be consumed, given the arbitrary logic provided within the script.

*FYI: Cardano addresses point to scripts, the script may be simple or extremely complex.*

I found this video by Michael Peyton Jones to be pretty informative and perhaps a little more intuitive than the first lecture presented within the Plutus Pioneer Program:

<https://youtu.be/usMPt8KpBeI>

*However, it may be a little outdated? I'm still working my way through the second cohort.*

---

**Footnotes:**

1. Think of an unspent transaction as the change you're given in a shop when you hand a $20 bill for a $5 item, the $15 change is **YOUR** UTxO and is secured using public-private key cryptography.

> **Comments:**
> **username_3**: In Bitcoin, both the "validator" and "redeemer" is Bitcoin Script. The output of the redeemer is given as input to the validator. In Bitcoin's implementation this amounts to the validator script being executed against the stack produced by the redeemer script. The validator script will then determine if the redeemer is valid based on the stack it leaves behind.  

---

### Answer by username_5 on 2021-07-20. Score: 1

There is an interesting example in one of the Pioneer lectures which implements Uniswap on Cardano.

A redeemer is not only used to justify that a UTxO can be spent, but also the manner in which it will be spent. The validation script will then place the necessary constraints on the creation of the transaciton based on who is trying to spend it and how they are trying to spend it.

In the screenshot attached from lecture 10 of the first iteration of the Plutus Pioneer Program, the blue lines represent the redeemer as an input to the UTxO's validation script (represented by the blue and red circles) which, in this case, is validating the consumption of a UTxO which represents a liquidity pool.

You can see four different labels on four of the blue lines - Create, Swap, Add and Remove. These represent different constructors for the redeemer data type being used and tell the script what action the user is trying to take.

For further details of exactly what each redeemer does, you can read more and find a link to the video [here](https://plutus-pioneer-program.readthedocs.io/en/latest/week10.html).

[![Uniswap on Cardano Example](https://i.sstatic.net/uGnsf.jpg)](https://i.sstatic.net/uGnsf.jpg)


---

