I'm wondering in all the works-around to optimize and reduce the size of the scripts and resources utilization.

I'm working in a big project and I'm struggling with this runtime limitations.

I would love to be able to code the logic of any big idea or project. I believe this must be possible to do it with Cardano.

I'm not Haskell expert, so I might be falling in some beginner mistakes handling data types or code structures.

I read some articles:

1 - https://github.com/Plutonomicon/plutonomicon/blob/main/scriptmem.md https://plutus.readthedocs.io/en/latest/reference/writing-scripts/optimization.html?highlight=profiling

They mention:

  • Avoiding higher-order functions and closures.
  • Adding strictness on accumulators in recursive functions.
  • Common expression elimination.
  • Using error for faster failure.
  • Avoid monad do notation to handle pattern match failure: Can't understand this one clearly.

2 - https://github.com/Plutonomicon/plutarch-plutus

I understand that this is about coding all again, with this language that is more low level and efficient that the Plutus libraries.

3 - https://github.com/CatspersCoffee/contracts/tree/main/dex/src/Minswap

I saw in the code of Minswap, that they convert the Plutus Script with Plutonomy (https://github.com/well-typed/plutonomy)

import qualified Plutonomy

{-# INLINEABLE mkFactoryPolicy #-} mkFactoryPolicy :: MintingPolicy mkFactoryPolicy = Plutonomy.optimizeUPLC $ Plutonomy.mintingPolicyToPlutus originalFactoryPolicy

But im not sure about the final code. How we can be sure that the code is reliable after it is passed trough Plutonomy.optimizeUPLC and also this is only compatible with specific older version of Plutus:

plutus-1efbb276e plutus-4710dff2e plutus-f680ac697 (cardano-node-1.35.1)

4 - Some configuration for the compiler, like:


I saw that many projects use this ones in the cabal file:


-Wall -fobject-code -fno-ignore-interface-pragmas -fno-omit-interface-pragmas -fno-strictness -fno-spec-constr -fno-specialise

I would appreciate any help in this matter.

If you can share your experience codding big projects and solutions you fount that will mean a lot for me.

Thank you so much.

Regards, Manu


Your Answer

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