Module M002
Duration: 2 hours
Format: 30 min lecture + 1.5 hours hands-on
DirectEd x CATS Hackathon Aiken Development Workshop
Duration: 2 hours
Format: 30 min lecture + 1.5 hours hands-on
DirectEd x CATS Hackathon Aiken Development Workshop
Cardano blockchain developer and educator specializing in Aiken smart contract development.
Build realistic transactions to test your validators!
โ Test validators thoroughly
โ Understand transaction context
โ Simulate real scenarios
โ Catch bugs before deployment
โ Build confidence in code
4 parameters โ Script Address
3 parameters โ Policy ID
We tested with placeholder transactions.
Now we'll build realistic transactions!
Points to a UTxO from a previous transaction
Creates a new UTxO on the blockchain
โ Wallet Address
โ Controlled by private key
โ Regular user addresses
โ Validator Address
โ Controlled by smart contract
โ Script addresses
The Pipe Operator |> chains functions together
Minting: Positive quantity
Burning: Negative quantity
Note: Validator receives redeemer separately when testing
| Aspect | Locking | Unlocking |
|---|---|---|
| Direction | Wallet โ Script | Script โ Wallet |
| Output Address | Script address | Wallet address (usually) |
| Datum | Must attach datum | Datum must be available |
| Redeemer | NOT needed | Must provide redeemer |
| Validation | No validator runs | Validator MUST return True |
| Use Case | Deposit funds | Withdraw funds |
Time to build mock transactions!
Build transaction with 2 inputs, 2 outputs
Mint multiple NFTs in one transaction
Send funds to script with inline datum
Spend from script with redeemer
Use mock transactions to test real validator
Check: Sum(inputs) = Sum(outputs) + fee
Remember: 1 ADA = 1,000,000 lovelace
Ensure datum type matches between locking and unlocking
Use mock_script_address, not mock_pub_key_address
You can now:
โ Understand complete Cardano transaction structure
โ Build mock spending transactions with inputs/outputs
โ Create mock minting transactions with tokens
โ Write mock locking transactions to script addresses
โ Create mock unlocking transactions with redeemers
โ Test validators with realistic transaction contexts
Module M002 Complete
You can now build realistic test transactions!
Practice building complex scenarios ๐งช
See you in M003! ๐