2

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.

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.