How does PlutusTx target plutus core?

The compile function produces CompiledCode.

Plutus Core can be extracted from that using getPlc.

Trying it out

  1. Clone plutus-starter
  2. We are going to compile Plutus.Contracts.Game. You can find it in examples/src/Plutus/Contract/Game.hs.
  3. Since it is available as a library we can import it. The on-chain parts are indicated by PlutusTx.compile. These are the validateGuess, wrap. For now we will try validateGuess.