Module M000
Duration: 2 hours
Format: 1 hour lecture + 1 hour hands-on
DirectEd x CATS Hackathon Aiken Development Workshop
Duration: 2 hours
Format: 1 hour lecture + 1 hour hands-on
DirectEd x CATS Hackathon Aiken Development Workshop
Cardano blockchain developer and educator specializing in Aiken smart contract development.
Welcome to your first step in Cardano blockchain development!
â Basic programming knowledge
â Computer with internet access
â Willingness to learn!
Blockchains track ownership using two main models:
Used by: Ethereum
đŗ Like a bank account
đ Tracks account balances
đ Modifies balances directly
Used by: Bitcoin, Cardano
đĩ Like physical cash
đ Tracks unspent outputs
đ Consumes inputs, creates outputs
Unspent Output
Processing
New UTxOs
đ¯ Deterministic
Know exactly which UTxOs you're spending before submitting
⥠Parallel Processing
Different UTxOs can be processed simultaneously
đž Local State
Each UTxO carries its own data (datum)
In Cardano smart contracts, you validate whether specific UTxOs can be spent, rather than modifying account balances.
"Can this UTxO be spent given these conditions?"
â Valid â Transaction proceeds
â Invalid â Transaction rejected
Cardano enhances Bitcoin's UTxO model with powerful smart contract capabilities
Enhancements:
âĸ Datums
âĸ Redeemers
âĸ Script Context
Each UTxO can carry custom data
đĄ Think of it as attaching a note to a dollar bill
Example: An NFT UTxO carries metadata about the artwork
Arguments provided when spending a UTxO
đ Like showing proof you're allowed to spend
Example: Providing a password or proof of ownership
Validators can see the entire transaction
đī¸ Includes inputs, outputs, signatories, time ranges
Enables: Complex validation based on transaction structure
Check if transaction will succeed BEFORE submitting
â
Reduces failed transactions and wasted fees
Benefit: More predictable dApp development
Sending cash in an envelope
Sending cash in a smart safe
On Cardano, smart contracts involve three key components:
The data locked at the script address
Example: "Auction ends at 5pm"
The argument provided when spending
Example: "I'm bidding 100 ADA"
The transaction information
Time, signers, inputs, outputs
In Aiken: You'll write validators that receive datums, redeemers, and script context as parameters, and return True (valid) or False (invalid)
On Cardano, tokens are "native assets" - handled directly by the blockchain ledger, not by smart contracts.
| Feature | Cardano (Native) | Ethereum (ERC-20) |
|---|---|---|
| Implementation | Built into ledger â | Requires smart contract |
| Complexity | Simple â | More complex |
| Security | High (ledger-level) â | Depends on contract code |
| Transaction Cost | Lower â | Higher (gas for contract) |
| Ownership | Direct ledger entry â | Contract manages ownership |
Each unit is identical
Examples:
ADA (Cardano's native currency)
USD coins
Loyalty points
1 token = 1 token
Interchangeable
Each token is unique
Examples:
Digital artwork
Collectibles
Property deeds
Each token is different
Not interchangeable
CIPs are formal design documents that propose changes or standards for Cardano
đ Standards Track CIPs
Core protocol changes
âī¸ Process CIPs
Community practices
âšī¸ Informational CIPs
Guidelines & recommendations
â Community-driven evolution
â Standardized approaches
â Reference for developers
â Transparent process
đ Find CIPs at:
cips.cardano.org
A Cardano wallet is software that helps you:
đī¸ Build transactions
âī¸ Sign transactions with private keys
đ¤ Submit transactions to blockchain
Think of using Cardano like online shopping:
User selects items
(Decides what to do)
Items added to cart
(Transaction being built)
Payment with Cardano
(Wallet signs and submits)
Order confirmed
(Transaction on blockchain)
Cardano smart contracts use functional programming because it naturally matches the eUTxO model
Simple Function:
Multiple Inputs:
Function Composition:
Every Cardano transaction is like a mathematical function:
Where:
âĸ inputs = UTxOs to spend (each with datum)
âĸ redeemers = arguments proving right to spend
âĸ context = full transaction information
âĸ outputs = new UTxOs to create
âĸ Fee = sum(inputs) - sum(outputs)
Same input always gives same output
đ¯ Predictable and testable
Data doesn't change, new data is created
đ No unexpected modifications
Functions don't modify external state
⨠Everything is explicit
You'll write validators as pure functions that:
Now let's get your development environment ready!
Aiken is the programming language and toolchain for Cardano smart contracts
â Node.js and npm (v16+ and 8+)
â Git (v2+)
â Visual Studio Code
1. Install aikup
2. Install Aiken
3. Verify
đ Detailed instructions: aiken-lang.org/installation-instructions
Look for the official Aiken extension with the Aiken logo
â Syntax highlighting for .ak files
â Code completion and IntelliSense
â Real-time error checking
â Inline documentation
â Automatic formatting on save
This opens the entire project with syntax highlighting ready!
aiken.toml
Project configuration, dependencies, compiler settings
validators/
Smart contract validators - controls how UTxOs can be spent
lib/
Reusable code, helper functions, type definitions
README.md
Project documentation
You should see all tests pass with memory and CPU usage!
mem: Memory units used
cpu: CPU steps consumed
These affect transaction costs on-chain
Congratulations! You've just run your first Aiken tests!
Trace messages help you debug and understand your code's execution
You'll see your trace messages in the output!
Time to practice what you've learned!
Environment Verification
Verify all tools are installed correctly
Create First Project
Build workshop-m000 project with tests
Experiment with Tests
Test different data types and operators
Working with Traces
Add trace messages for debugging
Project Organization
Create multiple validator files and organize code
Set up your Aiken development environment, create your first project, and demonstrate understanding of Cardano fundamentals
Add Aiken to your PATH:
Use sudo for npm install:
Need help? Check the Troubleshooting Guide in the module document or ask in the workshop Discord!
By completing this module, you should now:
â Understand why Cardano uses the UTxO model
â Know how eUTxO extends UTxO with datums, redeemers, and script context
â Know what makes native assets special on Cardano
â Recognize how CIPs drive Cardano's evolution
â Have a working Aiken development environment
â Be able to run and modify Aiken tests
â Understand basic Aiken project structure
â Be ready to write your first smart contract in M001
In the next module, you'll write your first Aiken validator - a smart contract that controls how funds can be spent on Cardano.
You'll learn about:
Questions?
Ask in the workshop chat, visit office hours, or post in the workshop Discord server!
Module M000 Complete
DirectEd x CATS Hackathon
Aiken Development Workshop
See you in Module M001! đ