Cardano DevKit
All-in-one development toolkit for Cardano blockchain.
Cardano DevKit provides everything you need to build on Cardano with JavaScript, TypeScript, or React. Simply npm install cardano-devkit and you're ready to go!
Why Cardano DevKit?โ
- ๐ Instant Local Development - Start a local blockchain in seconds with sub-second blocks (100-200ms)
- ๐ Seamless Network Switching - Move from local โ testnet โ mainnet with one method call
- โ๏ธ React Ready - Built-in hooks for modern dApp development
- ๐ ๏ธ CLI Tools - 46+ commands for devnet, transactions, and project scaffolding
- ๐ก Real-time Updates - WebSocket subscriptions for live blockchain events
- ๐งช Built-in Faucet - Get test ADA instantly during development
- ๐พ Production-Grade Indexer - SQLite-backed, Blockfrost-compatible API
- ๐ง Developer Utilities - UTxO manager, transaction history, address book, simulator
- ๐ฆ Project Scaffolding - 7 templates, 8 features for instant project setup
- ๐ป Interactive Console - REPL for quick prototyping and debugging
- ๐๏ธ Namespace Imports - Organized grouped imports for cleaner code
- ๐ Diagnostics & Debug - Runtime diagnostics and transaction tracing
Quick Startโ
# Install
npm install cardano-devkit
# Start local devnet
npx cardano-devkit start
# Fund your wallet
npx cardano-devkit topup addr_test1...
# Create a new project with wizard
npx cardano-devkit init --wizard
import { createDevKit, createDevnetManager, WalletHelper } from 'cardano-devkit';
import { ADA, Transaction, Debug } from 'cardano-devkit/namespaces';
// Enable debug mode for development
Debug.enable({ level: 'debug', timestamps: true });
// Start local devnet with fast blocks
const devnet = createDevnetManager({ blockTimeMs: 200 });
await devnet.start();
// Connect to local network
const devKit = createDevKit({ network: 'LocalDevnet' });
const lucid = await devKit.init();
// Check system health
const status = await devKit.healthCheck();
console.log('System healthy:', status.healthy);
// Generate wallet and build transactions
const seed = WalletHelper.generateSeed();
lucid.selectWallet.fromSeed(seed);
// Use namespace imports for cleaner code
const amount = ADA.toLovelace(10);
const preview = await Transaction.preview(lucid, tx);
// Ready to build your dApp!
Feature Highlightsโ
Namespace Importsโ
Clean, organized imports for better code:
import { ADA, Address, Transaction, NFT, Debug } from 'cardano-devkit/namespaces';
const lovelace = ADA.toLovelace(100); // Clean!
const isValid = Address.validate(addr); // Discoverable!
const preview = await Transaction.preview(lucid, tx);
Debug.enable({ level: 'debug' });
Diagnostics & Health Monitoringโ
Built-in system health checks:
import { diagnose, isHealthy, quickBalance } from 'cardano-devkit';
// Quick health check
if (await isHealthy(devKit)) {
console.log('All systems go!');
}
// Full diagnostics
const diag = await diagnose(devKit);
console.log(diag.network.status); // 'healthy'
console.log(diag.wallet.balanceAda); // 150.5
// Quick balance check
const balance = await quickBalance(devKit);
console.log(`${balance.ada} ADA in ${balance.utxoCount} UTxOs`);
Debug & Transaction Tracingโ
Trace transactions through their lifecycle:
import { traceTransaction, formatTrace, createDebugLogger } from 'cardano-devkit';
const logger = createDebugLogger('MyApp');
const { txHash, trace } = await traceTransaction(lucid, async (l) => {
logger.info('Building transaction...');
const tx = await l.newTx()
.pay.ToAddress(recipient, { lovelace: amount })
.complete();
return await tx.sign.withWallet().complete().then(s => s.submit());
});
console.log(formatTrace(trace));
// Shows timing for build, sign, submit, confirm phases
Developer Utilitiesโ
// Smart coin selection
const manager = createUTxOManager();
manager.setUtxos(utxos);
const selected = manager.select(5_000_000n, 'optimal');
// Transaction history tracking
const history = createTxHistory();
history.add({ txHash, amount, direction: 'sent', status: 'pending' });
// Named addresses
const book = createAddressBook();
book.add({ label: 'treasury', address: 'addr_test1...' });
const addr = resolveAddress('treasury', book);
Enhanced Error Recoveryโ
Errors include recovery suggestions:
try {
await sendAda(lucid, recipient, amount);
} catch (error) {
if (error instanceof CardanoDevKitError) {
console.error(error.message);
// Get recovery suggestions
for (const suggestion of error.suggestions) {
console.log('Try:', suggestion.action);
}
// Code example for fix
if (error.codeExample) {
console.log('Example:', error.codeExample);
}
}
}
Project Scaffoldingโ
# Interactive wizard for new projects
cardano-devkit init --wizard
# Create full dApp with Aiken + React
cardano-devkit new my-marketplace --template nft-marketplace --features aiken,react,testing
# Generate code artifacts
cardano-devkit generate wallet --network Preprod
cardano-devkit generate contract escrow
cardano-devkit generate component WalletButton
Interactive Consoleโ
cardano-devkit console --network Preprod
cardano:preprod> balance addr_test1...
๐ฐ Balance: โณ 1,234.567890
cardano:preprod> convert 100 ada
๐ฑ 100 ADA = 100,000,000 lovelace
Comparison with Yaci DevKitโ
| Feature | Cardano DevKit | Yaci DevKit |
|---|---|---|
| Language | JavaScript/TypeScript | Java |
| Installation | npm install | Docker/ZIP download |
| React Support | โ Built-in hooks | โ N/A |
| Block Time | 100ms minimum | 100ms minimum |
| CLI | โ 46+ commands | โ Full CLI |
| WebSocket | โ Real-time | โ Polling |
| Project Scaffold | โ 7 templates | โ N/A |
| Namespace Imports | โ 15 namespaces | โ N/A |
| Debug/Diagnostics | โ Built-in | โ N/A |
| Target Audience | JS/TS developers | Any language |
Test Coverageโ
- 35+ test suites
- 1,377 passing tests
- 500+ exports (functions, classes, types)