Basilisk Toolkit — Services, shell, and SFTP for IC Python canisters
Project description
ic-basilisk-toolkit
Basilisk Toolkit — A set of ready-made tools on top of Basilisk CDK for IC Python canisters.
Live demo: https://ic-basilisk.tech/.
Overview
| Task Management | Create, schedule, and run background tasks |
%task create heartbeat every 60s --code "print('alive')"
%task start 1
%task info 1
%task list
t = Task(name="sync")
TaskStep(task=t, code="print('syncing...')")
TaskSchedule(task=t, interval=60)
TaskManager().run()
| |
| Wallet | ICRC-1 token registry, transfers, balance tracking |
%wallet balance
%wallet transfer ckBTC <principal> 1000
w = Wallet()
w.register_token("ckBTC", ledger="mxzaz-...", indexer="n5wcd-...")
yield from w.balance_of("ckBTC")
yield from w.transfer("ckBTC", to_principal, amount=1000)
yield from w.refresh("ckBTC", max_results=50)
w.list_transfers("ckBTC", limit=20)
| |
| Encryption | vetKeys + per-principal envelopes + groups |
%crypto encrypt "secret"
%group create team1
%group add team1 <principal>
cs = CryptoService(vetkey_service)
yield from cs.init_scope("my-scope")
cs.grant_access("my-scope", target_principal)
cs.create_group("team")
cs.add_member("team", principal)
cs.grant_group_access("my-scope", "team")
cs.revoke_access("my-scope", principal)
| |
| FX | Exchange rate queries via the IC XRC canister |
%fx ICP/USD
fx = FXService()
fx.register_pair("ICP", "USD")
yield from fx.refresh() # fetch latest rates from XRC canister
fx.get_rate("ICP", "USD") # cached float
fx.get_rate_info("ICP", "USD") # full info with staleness metadata
| |
| Entities | Persistent ORM via ic-python-db |
%db types
%db list User 10
%db show User 1
%db search User name=alice
%db export User backup.json
%db import backup.json
u = User(name="alice")
u.save()
User.load(1)
User.instances()
User.count()
| |
| Logging | Structured logging via ic-python-logging |
from ic_python_logging import get_logger
logger = get_logger("my_module")
logger.info("processing")
logger.error("failed", exc_info=True)
| |
| HTTP Fetch | Download a URL into the canister filesystem |
%wget https://example.com/data.json /data.json
yield from wget("https://example.com/data.json", "/data.json")
run("/data.json") # execute a downloaded Python script
| |
| File Transfer | Move files between local machine and canister |
%put local_script.py /app/script.py
%get /app/output.json result.json
| |
| Interactive Shell | REPL for live canister interaction |
basilisk-toolkit shell --canister my_app --network ic
basilisk-toolkit exec --canister my_app 'print(ic.time())'
| |
| SFTP | Browse and edit canister filesystem over SSH |
basilisk-toolkit sshd --canister my_app --network ic
sftp -P 2222 localhost
ssh -p 2222 localhost
| |
Type :help inside the shell for full command reference, or see the tip_jar template for a working example project.
Templates
Full-stack example canisters, each deployable as-is:
- Tip Jar — crypto donations in ckBTC / ckETH / ckUSDC / ICP with live exchange rates, encrypted messages, donor leaderboard. Live.
- File Registry — general-purpose on-chain file storage with HTTP serving, CORS, chunked upload for large WASMs, and per-namespace ACLs. Live.
Website
website/ is the static landing page at ic-basilisk.tech — it introduces basilisk and this toolkit and links out to the live template demos. Pure assets canister, no backend.
Installation
pip install ic-basilisk-toolkit
For shell/SFTP support (requires asyncssh):
pip install ic-basilisk-toolkit[shell]
CLI Usage
basilisk-toolkit exec 'print("hello")' # Execute code on canister
basilisk-toolkit shell --canister my_app --network ic # Interactive shell
basilisk-toolkit sshd --canister my_app --network ic # SSH/SFTP server
Data Browsing (read-only)
Canisters with __basilisk_features__ = ["browse"] expose a __browse__ query endpoint for instant, free, read-only data access:
from ic_basilisk_toolkit.shell import canister_browse, canister_schema, canister_keys, canister_get
# Get the canister's data schema
schema = canister_schema("my_canister", network="ic")
# List keys in a stable map (paginated)
keys = canister_keys("my_canister", "users", network="ic")
# Read a single value
value = canister_get("my_canister", "users", "alice", network="ic")
# Generic browse with any action
result = canister_browse("items", "my_canister", network="ic", map="users", limit=50)
Unlike __shell__ (which is an @update call requiring consensus and controller access), __browse__ is a @query — instant response, no cycles cost, and public by default.
Security note: The
sshdcommand starts a local development proxy that accepts any password. It is intended for local use only — do not expose it on a public network without adding proper authentication.
Dependencies
- ic-basilisk — CDK (types, decorators,
ic.*API) - ic-python-db — Persistent entity ORM
- ic-python-logging — Structured logging
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ic_basilisk_toolkit-0.3.0.tar.gz.
File metadata
- Download URL: ic_basilisk_toolkit-0.3.0.tar.gz
- Upload date:
- Size: 154.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
751b577571738d7080cd36693b20db370c1aceef0ec64138028722115df9ed71
|
|
| MD5 |
271ed313265b9c45547890eda8234a9f
|
|
| BLAKE2b-256 |
b3ce2e801230688ff922f82943896b27210f1ef6ecc2c014161fc02e7dfc507e
|
File details
Details for the file ic_basilisk_toolkit-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ic_basilisk_toolkit-0.3.0-py3-none-any.whl
- Upload date:
- Size: 91.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c2c1eaee96e395f3776acc11f7e114267968f4f5a564108afab26b0a860f930
|
|
| MD5 |
9a550b7d30ed2b5d062d5041db2112c2
|
|
| BLAKE2b-256 |
370c92d158b9f75bc96ed107cd91f97d609e34406625de52953531678fd16d59
|