Evolution SDK
Smart Contracts

Smart Contracts

Working with Plutus scripts in Evolution SDK

Smart Contracts

Evolution SDK provides full support for Cardano smart contracts — Plutus V1, V2, and V3. Lock funds to script addresses with datums, spend from scripts with redeemers, mint tokens with minting policies, and reference on-chain scripts to reduce transaction size.

The transaction builder handles script evaluation, redeemer indexing, and collateral selection automatically. You focus on your contract logic.

How It Works

Smart contract interaction in Cardano involves three concepts:

ConceptPurposeWhen Used
DatumData attached to a UTxO at a script addressWhen locking funds to a script
RedeemerData provided to unlock a script UTxOWhen spending from a script
ScriptThe validator logic (Plutus or Native)Attached to transactions or referenced on-chain

Typical Workflow

Locking (sending funds to a script):

import { , , , ,  } from "@evolution-sdk/evolution"

const  = ({
  : "preprod",
  : { : "blockfrost", : "https://cardano-preprod.blockfrost.io/api/v0", : ..! },
  : { : "seed", : ..!, : 0 }
})

// Lock 10 ADA to a script address with an inline datum
const  = await 
  .()
  .({
    : .("addr_test1wrm9x2dgvdau8vckj4duc89m638t8djmluqw5pdrFollw8qnmqsyu"),
    : .(10_000_000n),
    : new .({ : .(0n, []) })
  })
  .()

const  = await .()
const  = await .()

Spending (unlocking funds from a script):

import { , , , , type  } from "@evolution-sdk/evolution"

const  = ({
  : "preprod",
  : { : "blockfrost", : "https://cardano-preprod.blockfrost.io/api/v0", : ..! },
  : { : "seed", : ..!, : 0 }
})

declare const : .[]
declare const : any

// Spend from script with a redeemer
const  = await 
  .()
  .({
    : ,
    : .(0n, []) // "Claim" action
  })
  .({ :  })
  .()

const  = await .()
const  = await .()

Supported Script Types

TypeDescriptionUse Case
PlutusV1First-generation Plutus scriptsLegacy contracts
PlutusV2Reference scripts, inline datumsMost current contracts
PlutusV3Conway-era features, governanceLatest contracts
NativeScriptTime-locks, multi-sigSimple policies without Plutus

What the Builder Handles

When you build a transaction with scripts, Evolution SDK automatically:

  • Evaluates scripts — Computes execution units (memory + CPU) for each script
  • Indexes redeemers — Assigns correct indices after coin selection changes input order
  • Selects collateral — Sets aside collateral UTxOs required for script transactions
  • Calculates fees — Includes script execution costs in fee computation
  • Attaches cost models — Includes protocol cost models in the script data hash

Next Steps