Codex-coded CLI app to interact with Kaspa testnets. Supports covenants. Ideally used for quick actions, spending, payloads, and compiling/deploying covenants.
Warning: Do not use or modify for use on mainnet or real funds.
From kascov/:
cargo runDependencies are pulled via Cargo from git (including silverscript-lang), so cloning kascov/ alone is enough.
Create kascov/.env:
KASPA_RPC=XXX.XXX.XXX.XXX:PORT
KASPA_AMOUNT_UNIT=SOMPIKASPA_AMOUNT_UNIT controls how CLI/submission amount inputs are interpreted:
SOMPI(default if unset)KAS(accepts decimals up to 8 places, e.g.1.25)
Safety: only kaspatest: addresses are allowed. kaspa: (mainnet) and other prefixes are rejected.
On boot, you get wallet selection:
- wallet index to select saved wallet
ggenerate wallet (last option)- after selection, console clears and shows selected wallet before prompt
Inside console input, ↑ and ↓ navigate previous/next command history.
Inside console, run help and use:
clear(clear terminal)config/config showconfig rpc <host:port|grpc://host:port>wallet/wallet listwallet use <index>(wallet indexes start at1)wallet gen [name](generate and select a new wallet, no prompt)wallet delete <index> --yes(non-interactive delete in arg mode)wallet pk(shows currently selected private key)wallet delete <index>(asks foryesconfirmation; wallet indexes start at1)fees(show current RPC fee estimate buckets)balanceutxos [-h](summary count + totals;detailvariant documented inutxos -h)utxos detail(full list)pending-txstx-status [-h]contracts(interactive.silcontract browser and source viewer)contracts <path.sil>(print one contract source file)compile <source.sil> [out.json] [constructor_args.json](default output goes to current compiled dir)compile -i(fully guided compile flow: pick contract, optional output path, typed constructor args)compile -i <source.sil> [out.json](interactive constructor args prompt; no args JSON file needed)compile all [contracts_dir] [compiled_dir](defaults:contracts/silverscript->contracts/compiled; auto-loads constructor args fromcontracts/params/<name>_ctor.jsonorcontracts/params/<name>.jsonwhen present)deploy(interactive picker from compiled dir + amount prompt)deploy -i(same asdeploy; explicit interactive mode)deploy <compiled.json> <amount>spend-contract <compiled.json> <txid:vout> <input_amount> <function> <args.json|-> <outputs.json>spend-contract -i(fully guided spend flow: contract selection, outpoint, amount, function, args, outputs; supportsselfaddress alias and oneallamount)spend-contract -i <compiled.json> <txid:vout> <input_amount> <function> <outputs.json>(interactive ABI-typed function args prompt)spend-contract-signed <compiled.json> <txid:vout> <input_amount> <function> <args.json> <outputs.json>send -h(show send options)send <to_address> <amount>send -p [to_address] <amount> <payload_text...>(UTF-8 payload, auto-hex encoded into tx payload; defaults to self whento_addressis omitted)send -p <payload_text...>(shortcut: no address/amount means send all available balance to self with payload)send -p -h [to_address] <amount> <payload_hex...>(raw hex payload bytes, no UTF-8 conversion; invalid/malformed payload may fail downstream)send -p -h <payload_hex...>(shortcut: no address/amount means send all available balance to self with raw payload)send -s <amount>(self-send)send -c [max_inputs](compound UTXOs)history [limit]back(return to wallet selection)exit
Arg mode:
- no startup command args: opens interactive console flow (wallet picker + prompt), unchanged
- startup command args present: executes command(s) directly, then exits
- run one command directly:
kascov helporkascov config show - run multiple commands in one process:
kascov --exec "help" --exec "config show" --exec "history 10" - combine both forms:
kascov --exec "config rpc 66.23.234.250:16210" send -s 1 - quoted args are supported in command input (e.g.
send -p "hello world")
Per-command help:
config -hwallet -hutxos -htx-status -hcompile -hcontracts -hdeploy -hspend-contract -hsend -h
tx-status shortcuts:
tx-status bopens a picker from saved tx history entriestx-status lastchecks the most recently saved txidtx-statusis mempool-only (no chain confirmation lookup)
spend-contract file formats:
args.jsonisVec<Expr>in SilverScript AST JSON format (use-for no args).outputs.jsonis an array like:
[
{ "address": "kaspatest:...", "amount_sompi": 99000000 }
]- For covenant/stateful outputs, you can use raw locking script destination instead of address:
[
{ "locking_bytecode_hex": "20...ac", "amount_sompi": 99000000 }
]- Each output row must provide exactly one destination:
addressorlocking_bytecode_hex. - You can also use
{ "address": "...", "amount": "..." };amountis parsed usingKASPA_AMOUNT_UNIT(SOMPIdefault, orKAS). input_amount_sompi - sum(outputs.amount_sompi)becomes tx fee.spend-contract-signedsupports placeholders inargs.json:{ "kind": "identifier", "data": "$pubkey" }{ "kind": "identifier", "data": "$sig" }- These are replaced with signer wallet pubkey/signature before script build.
Use the same model for every covenant spend:
- Compile contract (
compiled.json). - Deploy contract with amount (
deploy ... <amount>), which creates a locked contract UTXO. - Copy deploy output
contract_output_outpoint(txid:vout). - Spend that exact outpoint with a contract function call and outputs.
spend-contract argument mapping:
<compiled.json>: contract bytecode + ABI metadata.<txid:vout>: deployed contract UTXO to spend.<input_amount>: amount of that UTXO (parsed viaKASPA_AMOUNT_UNIT).<function>: entrypoint to execute.<args.json|->: function arguments used to satisfy lock conditions.<outputs.json>: transaction outputs (where unlocked funds go).
Minimal lifecycle example:
compile ../silverscript/silverscript-lang/tests/examples/simple_if_statement.sil
deploy contracts/compiled/simple_if_statement.json 100000000
spend-contract contracts/compiled/simple_if_statement.json <DEPLOY_TXID:0> 100000000 hello contracts/params/simple_if_statement_hello_else_args.json contracts/params/spend_outputs_template.json
Interactive (no args JSON) example:
compile -i contracts/silverscript/openhashlock.sil
deploy contracts/compiled/openhashlock.json 1000000000
spend-contract -i contracts/compiled/openhashlock.json <DEPLOY_TXID:0> 1000000000 claim contracts/params/openhashlock_outputs.json
Guided interactive spend (no args/outputs files) example:
spend-contract -i
Guided spend shortcuts:
- In output address prompts, type
selfto use the currently selected wallet address. - In exactly one output amount prompt, type
allormaxto send the remaining input amount after subtracting fastest-fee and other explicit outputs. - For outpoint fields, type
lastto use the most recentdeploy-covenantoutpoint from history. - In guided spend, if entered outputs leave fee below fastest recommendation, the shortfall is auto-deducted from the last output.
Default workspace under kascov/contracts/:
contracts/silverscript/contract sources (.sil)contracts/compiled/compiled artifacts (.json)contracts/params/constructor/function/output parameter files
- Wallets file:
wallets.json(override withKASPA_WALLETS_FILE) - Tx history file:
tx-history.jsonl(override withKASPA_HISTORY_FILE); includes successful tx submissions and failed deploy/spend/send attempts with error details - Console command history file:
.kascov-console-history(override withKASPA_CONSOLE_HISTORY_FILE)
- Transaction-building commands use RPC fee estimate
priority_bucket(fastest inclusion target):send,send -p,send -s,send -c,deploy,spend-contract, andspend-contract-signed. feesprints current priority/normal/low feerate buckets from RPC.spend-contract/spend-contract-signedenforce a minimum recommended fee for fastest policy; if outputs imply a lower fee, command returns an error and asks you to lower outputs total..envcontrols RPC and amount input unit (KASPA_AMOUNT_UNIT); wallet keys/addresses are selected in-console or via CLI flags.--rpcacceptshost:portorgrpc://host:port.deployoutput includescontract_address(derived P2SH testnet address) andcontract_output_outpoint.- On startup,
kascovensurescontracts/silverscript/,contracts/compiled/, andcontracts/params/exist (or custom--contracts-dir/--out-dirfor source/compiled paths).