This skill provides comprehensive support for Kaspa blockchain development across multiple programming languages and use cases. Whether you're building a simple wallet integration, a full dApp, a block explorer, or working with KRC20 tokens, this skill provides the patterns, SDK references, and boilerplate code you need.
Kaspa provides official SDKs for multiple languages:
kaspa-wasm - WebAssembly-based SDK for browser and Node.jskaspa-rpc-client and kaspa-wallet-core - Native Rust SDKgithub.com/kaspanet/kaspad - Official Go implementationkaspa package on Mops for Internet Computer integrationJavaScript/TypeScript:
import { PrivateKey, NetworkType } from 'kaspa-wasm';
const privateKey = PrivateKey.random(NetworkType.Mainnet);
const publicKey = privateKey.toPublicKey();
const address = publicKey.toAddress(NetworkType.Mainnet);
console.log('Address:', address.toString());
console.log('Private Key:', privateKey.toString());
Rust:
use kaspa_wallet_core::keys::{PrivateKey, PublicKey};
use kaspa_consensus_core::network::NetworkType;
let private_key = PrivateKey::random(NetworkType::Mainnet);
let public_key = private_key.to_public_key();
let address = public_key.to_address(NetworkType::Mainnet);
println!("Address: {}", address.to_string());
Go:
import (
"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
"github.com/kaspanet/kaspad/util"
)
privateKey, _ := util.GeneratePrivateKey()
publicKey := privateKey.PublicKey()
address, _ := util.NewAddressPublicKey(publicKey.Serialize(), util.Bech32PrefixKaspaMain)
fmt.Printf("Address: %s\n", address.String())
JavaScript/TypeScript:
import { Transaction, RpcClient, NetworkType } from 'kaspa-wasm';
const rpc = new RpcClient({
url: 'wss://api.kaspa.org',
network: NetworkType.Mainnet
});
await rpc.connect();
// Get UTXOs for the sender address
const utxos = await rpc.getUtxosByAddresses([senderAddress]);
// Build transaction
const tx = new Transaction({
version: 0,
inputs: utxos.map(utxo => ({
previousOutpoint: utxo.outpoint,
signatureScript: '', // Will be filled after signing
sequence: 0,
sigOpCount: 1
})),
outputs: [{
amount: amount,
scriptPublicKey: recipientScriptPublicKey
}],
lockTime: 0,
subnetworkId: '00000000000000000000000000000000'
});
// Sign transaction
const signedTx = await signTransaction(tx, privateKey);
// Broadcast
const txId = await rpc.submitTransaction(signedTx);
console.log('Transaction ID:', txId);
For detailed SDK documentation and examples:
For integrating Kaspa into wallets like RainbowKit, OisyWallet, or custom wallets:
See references/wallet-integration.md for:
For setting up and operating Kaspa nodes:
See references/node-operations.md for:
When building a Kaspa dApp:
To build a block explorer:
See API reference for available endpoints.
Kaspa supports KRC20 tokens (similar to ERC20 on Ethereum). For token development:
See references/krc20-tokens.md for:
Kaspa has three network types:
kaspa:)kaspatest:)kaspadev:)Always use the correct network type for your use case.
Kaspa uses Bech32 encoding for addresses:
kaspa:qqkqkzjvr7zwxxmjxjkmxx (62 characters total)kaspatest:qqkqkzjvr7zwxxmjxjkmxxkaspadev:qqkqkzjvr7zwxxmjxjkmxxThe scripts/ directory contains utility scripts:
generate-address.py: Generate Kaspa addressesbuild-transaction.py: Build and sign transactionsmonitor-address.py: Monitor address for incoming transactionsThe assets/ directory contains boilerplate templates:
dapp-template/: React/Next.js dApp starterexplorer-template/: Block explorer starterwallet-adapter/: Wallet adapter implementation共 1 个版本