A Scalus smart contract starter generated from the validator.g8 template.
$name;format="Camel"$.scala is a Plutus V3 validator scaffold: every script purpose
(spend, mint, reward, certify, vote, propose) is stubbed and fails until you implement
it. Fill in the bodies you need and remove the rest.
The project works with both Scala CLI and sbt.
With Scala CLI:
scala-cli test .
scala-cli compile .
scala-cli fmt .With sbt:
sbt test
sbt compile$name;format="Camel"$Integration.test.scala runs against a backend selected by the
SCALUS_TEST_ENV environment variable:
sbt test # in-memory emulator (default, fast)
SCALUS_TEST_ENV=yaci sbt test # a local Yaci DevKit node (requires a running Docker daemon)The same works with Scala CLI, e.g. SCALUS_TEST_ENV=yaci scala-cli test ..
Both tools share the same flat source layout: sources live at the project root and test
sources use the .test.scala suffix.
-
$name;format="Camel"$.scala— the on-chain validator -
$name;format="Camel"$.test.scala— unit tests usingscalus-testkit'sScalusTest -
$name;format="Camel"$Integration.test.scala— submit-based tests (emulator / Yaci DevKit) -
$name;format="Camel"$Contract.scala— theContract(compiled script + CIP-57 blueprint) -
project.scala— Scala CLI build configuration (Scala version, Scalus compiler plugin, deps) -
build.sbt— sbt build configuration (same versions and deps)
The sbt build enables the scalus-sbt-plugin, which adds tasks
backed by the Contract in $name;format="Camel"$Contract.scala:
# Generate a CIP-57 blueprint under target/.../META-INF/scalus/blueprints/
sbt blueprint
# Deploy the validator as a reference-script UTxO (needs a Blockfrost key and a funded wallet)
export BLOCKFROST_API_KEY=... # or pass --blockfrost-key
export CARDANO_MNEMONIC="word1 ..." # or pass --mnemonic
sbt "deploy $name;format="Camel"$Contract --network preview"Set SCALUS_PROFILE=1 to run the tests with on-chain execution profiling enabled. It writes an
interactive HTML profile (CPU/memory per source line) to target/profile.html:
SCALUS_PROFILE=1 sbt testThe same works with Scala CLI, e.g. SCALUS_PROFILE=1 scala-cli test ..
- Scalus documentation: https://scalus.org
- Examples: https://github.com/nau/scalus/tree/master/scalus-examples