Skip to Content
Scalus Club is now open! Join us to get an early access to new features 🎉
DocumentationGetting Started

Getting Started with Scalus

This guide will help you set up your Scalus development environment and create your first Cardano validator in minutes. You’ll install Scala 3, generate a starter project, and run your first smart contract tests.

Install Scala 3 Development Environment

We recommend using Coursier , the official Scala installer that sets up your complete development environment including JVM, Scala compiler, build tools, and code formatters.

Homebrew based installation:

brew install coursier && coursier setup

Coursier will install Scala compiler, Command line tool: Scala CLI , Build tool: sbt , REPL: Ammonite  and Code formatter: Scalafmt .

Get Your First Cardano Validator

sbt new scalus3/hello.g8

This ran the template scalus3/hello.g8 using Giter8 . Let’s take a look at what just got generated:

validator/ ├── HelloCardano.scala # Simple validator ├── HelloCardano.test.scala # Simple tests ├── project.scala # Project configuration └── README.md

Run Your First Validator Tests

Run unit tests (MUnit, ScalaTest and ScalaCheck):

scala-cli test hello

All is good if you see the following output:

HelloCardanoTest: - Hello Cardano message is signed by the owner

Set Up Your IDE for Cardano Development

Setting up a productive development environment will significantly improve your Scala/Scalus development experience. Scala offers wide range of IDE support, the most popular are IntelliJ and VSCode.

  1. Install IntelliJ IDEA (Community or Ultimate edition) from the JetBrains website 
  2. Install the Scala plugin:
    • Go to Settings/Preferences → Plugins → Marketplace
    • Search for “Scala” and install the plugin
    • Restart IntelliJ IDEA when prompted
  1. Open your Scalus project:
    • Select File → Open and navigate to your project directory
    • Choose Import as sbt project when prompted

You are good to go! Start exploring.

HelloCardano.scala
import scalus.* import scalus.builtin.Data import scalus.ledger.api.v3.{PubKeyHash, TxInfo, TxOutRef} import scalus.prelude.* /** This validator demonstrates two key validation checks: * 1. It verifies that the transaction is signed by the owner's public key hash (stored in the datum) * 2. It confirms that the redeemer contains the exact string "Hello, Cardano!" * * Both conditions must be met for the validator to approve spending the UTxO. */ @Compile object HelloCardano extends Validator: inline override def spend( datum: Option[Data], redeemer: Data, tx: TxInfo, outRef: TxOutRef ): Unit = val owner = datum.getOrFail("Datum not found").to[PubKeyHash] val signed = tx.signatories.contains(owner) require(signed, "Must be signed") val saysHello = redeemer.to[String] == "Hello, Cardano!" require(saysHello, "Invalid redeemer")

Next Steps

Now that you have your development environment set up and a working validator, continue your Scalus journey:

  • Learn Smart Contract Development - Deep dive into writing Cardano validators with Scala 3, understanding the compilation process, and leveraging the Scalus type system
  • Build and Submit Transactions - Use TxBuilder to construct transactions, evaluate scripts off-chain, and submit them to the Cardano network

New to Cardano or Scala? Check out our onboarding guides for developers coming from either ecosystem.

Last updated on