<p>The best resources I can recommend are the following in regards to StakeValidators:</p>
<p><a href="https://www.youtube.com/playlist?list=PLK8ah7DzglhhM57VKQTMIGDZj5OnmfgOX" rel="nofollow noreferrer">Plutus Pioneer Program Lecture #10 Cohort 3</a></p>
<p><a href="https://github.com/input-output-hk/plutus-apps/blob/main/plutus-ledger/src/Ledger/Typed/Scripts/StakeValidators.hs" rel="nofollow noreferrer">Example Implementation StakeValidator</a></p>
<p><a href="https://github.com/Plutonomicon/plutonomicon/blob/main/stake-scripts.md" rel="nofollow noreferrer">Plutonomicon StakeValidator Intro</a></p>
<p><em><strong>How do Rewarding scripts differ from Spending scripts?</strong></em></p>
<p>Rewarding scripts can only make assertions in regards to the registration/ deregistration of delegation certificates for some provided payment keys. In addition, they can also implement logic that validates withdrawals of staking rewards from a given address as well as ensure delegations to a new pool.</p>
<p><em><strong>How to use Rewarding script, how are Rewarding scripts interacted with?</strong></em></p>
<p>This was part of the PPP lecture 10 (see link above). Whenever someone creates a transaction trying to withdraw from an address that is managed by a StakeValidator then the rewarding purpose is used that provides the corresponding StakingCredentials in the ScriptContext. These StakeValidators are implicitly run whenever someone tries to withdraw rewards from an address that was created with a script StakeValidator.</p>
<p><em><strong>Can Rewarding scripts be used with native tokens?</strong></em></p>
<p>Could I for example create smartcontract for staking KUGIS native tokens and getting KUGIS coins as a reward?
The rewarding mechanism through staking is as far as I know only done for Cardano's native currency ADA. If you wanted to create your mechanism you could use a minting policy instead for your custom token. So your smart contract/ minting policy would have to validate under what conditions new KUGIS coins can be minted. You could also airdrop coins for participants acting a certain way - such as delegating to a pool etc.</p>

CC BY-SA 4.0
2022-05-26T17:56:49.223Z
Not sure if I understand, can you clarify? It would be possible to build a reward system of a native token, but not through scripts having Rewarding ScriptContext purpose param. Instead one should use normal minting transactions and smart contracts addresses? How it would work?
Walker Leite
CC BY-SA 4.0
2022-05-26T18:31:02.230Z
StakeValidators are definitely not possible to use for native asset rewards, as they are strictly triggered only for actions involving the (de)registration of DCerts/ delegation to a new pool or withdrawal of rewards.

So the only way to create a rewards scheme for native assets is via a minting policy or a combination of spending validator + minting policy.
Will
CC BY-SA 4.0
2022-05-26T18:34:00.963Z
You could for instance let users create an output at a script address for a specific rewards scheme (storing the datetime they joined in the output datum) and then allow them to consume it in the future. Based on the amount of time they waited until they consume their output at the script address, they are eligible to mint a specific amount of your native tokens. Your spending validator script can check for the specific output and amount of the native tokens minted.
Will
CC BY-SA 4.0
2022-04-08T11:02:52.150Z
2022-04-12T08:35:00.550Z
2022-04-12T08:35:00.550Z
Will
<p>To me, rewarding refers to Staking Pools Rewards (anybody can correct me on this), which for that, it is also my understanding that it uses a wallet address (rewarding wallet address) different of the payment wallet address (anybody can correct me on this too).
For more information I'd invite to take a look at the documentation for apps related to staking.</p>
<p>On a tangent from this topic:
Less than a week ago, Charles twitted that Cardano may be able to pay transaction fees in custom currencies (first blockchain to be capable of this):
<a href="https://twitter.com/IOHK_Charles/status/1484193096178946048?cxt=HHwWgMCqvbzw9JgpAAAA" rel="nofollow noreferrer">https://twitter.com/IOHK_Charles/status/1484193096178946048?cxt=HHwWgMCqvbzw9JgpAAAA</a></p>
<p>Paper title: Babel Fees via Limited Liabilities
<a href="https://arxiv.org/pdf/2106.01161.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/2106.01161.pdf</a></p>
<p>I have not read the details of the paper but possibly then the rewards (your topic) will also be in those custom currencies.</p>

CC BY-SA 4.0
2022-01-30T16:10:25.080Z
2022-01-30T16:10:25.080Z
LexTRX
<p>When I was exploring haddock of Plutus I have found that Plutus script can have Rewarding ScriptPurpose:</p>
<pre><code>data ScriptPurpose
    = Minting CurrencySymbol
    | Spending TxOutRef
    | Rewarding StakingCredential
    | Certifying DCert
    deriving stock (Generic, Haskell.Show, Haskell.Eq)
</code></pre>
<p>This raised me a lot of questions like:</p>
<ul>
<li>How do <strong>Rewarding</strong> scripts differ from <strong>Spending</strong> scripts?</li>
<li>How to use <strong>Rewarding</strong> script, how are <strong>Rewarding</strong> scripts interacted with?</li>
<li>Can <strong>Rewarding</strong> scripts be used with native tokens? Could I for example create smartcontract for staking <em>KUGIS</em> native tokens and getting <em>KUGIS</em> coins as a reward?</li>
</ul>
<p>I have tried searching for resources but couldn't find a single resource on this except one example of the adafinance cardano staking contract on github.</p>

CC BY-SA 4.0
2022-04-28T05:26:16.743Z
Should one of the answers be marked as accepted?
gRebel
<plutus-pioneer-program><smart-contract><native-assets><staking><documentation>
Where can I find design and documentation resources on Plutus Staking smartcontracts?
# Where can I find design and documentation resources on Plutus Staking smartcontracts?

(Asked by: username_0 on 2022-01-19)

When I was exploring haddock of Plutus I have found that Plutus script can have Rewarding ScriptPurpose:
data ScriptPurpose
    = Minting CurrencySymbol
    | Spending TxOutRef
    | Rewarding StakingCredential
    | Certifying DCert
    deriving stock (Generic, Haskell.Show, Haskell.Eq)

This raised me a lot of questions like:

How do Rewarding scripts differ from Spending scripts?
How to use Rewarding script, how are Rewarding scripts interacted with?
Can Rewarding scripts be used with native tokens? Could I for example create smartcontract for staking KUGIS native tokens and getting KUGIS coins as a reward?

I have tried searching for resources but couldn't find a single resource on this except one example of the adafinance cardano staking contract on github.

**Tags:** plutus-pioneer-program, smart-contract, native-assets, staking, documentation
> **Comments:**
> **username_1**: Should one of the answers be marked as accepted?  

---

## 2 answers

### Answer by username_2 on 2022-04-08. Score: 3 | Accepted answer

The best resources I can recommend are the following in regards to StakeValidators:

[Plutus Pioneer Program Lecture #10 Cohort 3](https://www.youtube.com/playlist?list=PLK8ah7DzglhhM57VKQTMIGDZj5OnmfgOX)

[Example Implementation StakeValidator](https://github.com/input-output-hk/plutus-apps/blob/main/plutus-ledger/src/Ledger/Typed/Scripts/StakeValidators.hs)

[Plutonomicon StakeValidator Intro](https://github.com/Plutonomicon/plutonomicon/blob/main/stake-scripts.md)

***How do Rewarding scripts differ from Spending scripts?***

Rewarding scripts can only make assertions in regards to the registration/ deregistration of delegation certificates for some provided payment keys. In addition, they can also implement logic that validates withdrawals of staking rewards from a given address as well as ensure delegations to a new pool.

***How to use Rewarding script, how are Rewarding scripts interacted with?***

This was part of the PPP lecture 10 (see link above). Whenever someone creates a transaction trying to withdraw from an address that is managed by a StakeValidator then the rewarding purpose is used that provides the corresponding StakingCredentials in the ScriptContext. These StakeValidators are implicitly run whenever someone tries to withdraw rewards from an address that was created with a script StakeValidator.

***Can Rewarding scripts be used with native tokens?***

Could I for example create smartcontract for staking KUGIS native tokens and getting KUGIS coins as a reward?
The rewarding mechanism through staking is as far as I know only done for Cardano's native currency ADA. If you wanted to create your mechanism you could use a minting policy instead for your custom token. So your smart contract/ minting policy would have to validate under what conditions new KUGIS coins can be minted. You could also airdrop coins for participants acting a certain way - such as delegating to a pool etc.

> **Comments:**
> **username_3**: Not sure if I understand, can you clarify? It would be possible to build a reward system of a native token, but not through scripts having Rewarding ScriptContext purpose param. Instead one should use normal minting transactions and smart contracts addresses? How it would work?  
> **username_2**: StakeValidators are definitely not possible to use for native asset rewards, as they are strictly triggered only for actions involving the (de)registration of DCerts/ delegation to a new pool or withdrawal of rewards.  So the only way to create a rewards scheme for native assets is via a minting policy or a combination of spending validator + minting policy.  
> **username_2**: You could for instance let users create an output at a script address for a specific rewards scheme (storing the datetime they joined in the output datum) and then allow them to consume it in the future. Based on the amount of time they waited until they consume their output at the script address, they are eligible to mint a specific amount of your native tokens. Your spending validator script can check for the specific output and amount of the native tokens minted.  

---

### Answer by username_4 on 2022-01-30. Score: 3

To me, rewarding refers to Staking Pools Rewards (anybody can correct me on this), which for that, it is also my understanding that it uses a wallet address (rewarding wallet address) different of the payment wallet address (anybody can correct me on this too).
For more information I'd invite to take a look at the documentation for apps related to staking.

On a tangent from this topic:
Less than a week ago, Charles twitted that Cardano may be able to pay transaction fees in custom currencies (first blockchain to be capable of this):
<https://twitter.com/IOHK_Charles/status/1484193096178946048?cxt=HHwWgMCqvbzw9JgpAAAA>

Paper title: Babel Fees via Limited Liabilities
<https://arxiv.org/pdf/2106.01161.pdf>

I have not read the details of the paper but possibly then the rewards (your topic) will also be in those custom currencies.


---

