user5844: I am trying to implement so logic to ensure smart contract (SC) validation upon certain conditions - which are derived from the end-users transaction history.
If I parameterise the SC and take the users address or public key hash (pkh) how can I look up the last N transactions to/sent from that address.
I need to be able to do this within the mkValidator logic.
Example:
mkValidator :: pkh -> () -> () -> () -> Bool
mkValidator pkh _ _ _ 
| pkh last transaction was to the specified user = True
| otherwise = False
I am attempting to make some free and opensource code for the community that tackle a fundamental problem in the Cardano protocol (i.e. it scales with the number of users) so I am attempting to stay away from blockfrost and other paid API services.

user5844: The current state of Plutus makes this impossible to do. Instead, you have to try and use a custom DB-sync server, and then construct the off-chain code in such a way that it passes the looked-up values to the Haskell program.
Note that you will have to use lifting to ensure that the values passed by the Haskell code, can configure the Plutus app.
The state of Plutus mentioned here is everything available on and before  Feb 22 2022.

5844: <p>I am trying to implement so logic to ensure smart contract (SC) validation upon certain conditions - which are derived from the end-users transaction history.</p>
<p>If I parameterise the SC and take the users address or public key hash (pkh) how can I look up the last N transactions to/sent from that address.</p>
<p>I need to be able to do this within the mkValidator logic.</p>
<p>Example:</p>
<p><code>mkValidator :: pkh -&gt; () -&gt; () -&gt; () -&gt; Bool</code></p>
<p><code>mkValidator pkh _ _ _ </code></p>
<p><code>| pkh last transaction was to the specified user = True</code></p>
<p><code>| otherwise = False</code></p>
<p>I am attempting to make some free and opensource code for the community that tackle a fundamental problem in the Cardano protocol (i.e. it scales with the number of users) so I am attempting to stay away from blockfrost and other paid API services.</p>
 5844: <p>The current state of Plutus makes this impossible to do. Instead, you have to try and use a custom DB-sync server, and then construct the off-chain code in such a way that it passes the looked-up values to the Haskell program.</p>
<p>Note that you will have to use lifting to ensure that the values passed by the Haskell code, can configure the Plutus app.</p>
<p>The state of Plutus mentioned here is everything available on and before  Feb 22 2022.</p>
