TrustlessTask now integrates real Cardano blockchain transactions for critical operations:
- Project Creation - Locks funds in escrow smart contract
- Milestone Completion - Records completion on-chain (freelancer action)
- Milestone Approval - Releases funds from escrow to freelancer (client action)
When a client creates a project:
Client → Frontend → Backend → Cardano Blockchain
Steps:
- Client fills project form with milestones
- Frontend validates and sends to backend
- Backend creates project record
- Future: Backend builds transaction to lock total amount in escrow smart contract
- Client signs transaction with their wallet
- Transaction submitted to Cardano blockchain
- Project marked as "Funded" with transaction hash
Current Status: Simulated (returns mock tx hash)
When a freelancer marks a milestone as complete:
Freelancer → Frontend → Backend → Cardano Blockchain
Steps:
- Freelancer clicks "Mark Complete" button
- Frontend builds completion transaction
- Future: Transaction records completion on-chain with timestamp
- Freelancer signs transaction
- Backend submits to blockchain
- Milestone marked as completed with transaction hash
Current Status: Simulated (returns mock tx hash)
When a client approves a completed milestone:
Client → Frontend → Backend → Smart Contract → Freelancer
Steps:
- Client reviews completed work
- Client clicks "Approve & Release Funds"
- Frontend builds release transaction from escrow
- Transaction includes:
- Script UTxO reference (locked funds)
- Redeemer (approval proof)
- Recipient address (freelancer)
- Amount to release
- Client signs transaction with their wallet
- Backend submits to blockchain
- Smart contract validates and releases funds
- Freelancer receives payment
- Milestone marked as approved with transaction hash
Current Status: Simulated (returns mock tx hash)
The Plutus smart contract (contracts/src/TrustlessTask/Escrow.hs) handles:
- Locking: Client locks funds with project datum
- Validation: Ensures only authorized releases
- Release: Transfers funds to freelancer on approval
- Refund: Returns funds to client on cancellation
data EscrowDatum = EscrowDatum
{ projectId :: ByteString
, clientAddress :: Address
, freelancerAddress :: Address
, milestones :: [Milestone]
, currentMilestone :: Integer
}data EscrowRedeemer
= ReleaseFunds Integer -- Milestone ID
| RefundClient
| RaiseDispute ByteStringPOST /api/v1/projects/:projectId/milestone/:milestoneId/complete
Body: { signedTx?: string }
Response:
{
"txHash": "abc123...",
"status": "Completed",
"milestone": { ... }
}POST /api/v1/projects/:projectId/milestone/:milestoneId/approve
Body: { signedTx: string } // Required!
Response:
{
"txHash": "def456...",
"status": "Approved",
"milestone": { ... },
"projectCompleted": false
}The frontend uses the Cardano wallet API to:
- Connect Wallet - Get user's address
- Sign Transactions - User approves blockchain actions
- Submit Transactions - Send to backend for blockchain submission
// 1. Build transaction
const milestone = project.milestones.find(m => m.id === milestoneId);
const txData = {
recipient: project.freelancerAddress,
amount: milestone.amount,
scriptUtxo: project.escrowUtxo,
redeemer: { ReleaseFunds: milestoneId }
};
// 2. Get signed transaction from wallet
const signedTx = await wallet.signTx(txData);
// 3. Submit to backend
const result = await projectsApi.approveMilestone(
projectId,
milestoneId,
signedTx
);
// 4. Show transaction hash
console.log('Funds released:', result.txHash);All transactions can be verified on Cardano blockchain explorers:
- Preprod Testnet: https://preprod.cardanoscan.io/
- Mainnet: https://cardanoscan.io/
Search by transaction hash to see:
- Block confirmation
- Input/output addresses
- Amount transferred
- Script execution details
- Datum and redeemer data
- Smart Contract Validation - Only authorized parties can release funds
- On-Chain Verification - All actions recorded immutably
- Wallet Signatures - User must approve all transactions
- Escrow Protection - Funds locked until conditions met
- Dispute Resolution - Arbiter can intervene if needed
| Feature | Status | Notes |
|---|---|---|
| Project Creation | ✅ Working | Simulated tx hash |
| Fund Locking | 🚧 Planned | Needs smart contract deployment |
| Milestone Completion | ✅ Working | Simulated tx hash |
| Fund Release | ✅ Working | Simulated tx hash |
| Transaction Verification | 🚧 Planned | Blockfrost integration ready |
| Smart Contract Deployment | ✅ Complete | Contracts compiled and tested |
To enable real blockchain transactions:
- Deploy Smart Contracts to Cardano testnet
- Get Script Address from deployed contract
- Update Backend with real transaction building
- Test with Real Wallets on preprod testnet
- Add Transaction Monitoring for confirmations
- Deploy to Mainnet after thorough testing
- Get testnet ADA from faucet: https://docs.cardano.org/cardano-testnet/tools/faucet/
- Create test project with small amounts
- Complete and approve milestones
- Verify transactions on explorer
- Check wallet balances
Currently using simulated transactions for development:
- No real ADA required
- Instant "confirmations"
- Full UI/UX testing
- Database integration verified