Metadata-Version: 2.4
Name: xian-tech-abci
Version: 0.10.0
Summary: Python-based ABCI server for CometBFT
Author: Xian Core Team
License-Expression: MIT AND Apache-2.0 AND BSD-3-Clause
Project-URL: Repository, https://github.com/xian-technology/xian-abci
Keywords: blockchain,cometbft,abci,xian,python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.14
Requires-Python: <3.15,>=3.14
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES.md
License-File: protos/tendermint/LICENSE
License-File: protos/gogoproto/gogo.proto
Requires-Dist: aiohttp<4,>=3.14.5
Requires-Dist: asyncpg<0.33,>=0.31.0
Requires-Dist: loguru<0.9,>=0.8.0
Requires-Dist: prometheus-client<0.27,>=0.25.0
Requires-Dist: protobuf==7.36.2
Requires-Dist: pynacl<2,>=1.6.2
Requires-Dist: xian-tech-accounts<0.2,>=0.1.4
Requires-Dist: xian-tech-contracting<2,>=1.1.4
Requires-Dist: xian-tech-runtime-types<0.2,>=0.1.6
Requires-Dist: xian-tech-vm-core<0.2,>=0.1.4
Provides-Extra: zk
Requires-Dist: xian-tech-contracting[zk]<2,>=1.1.4; extra == "zk"
Dynamic: license-file

# xian-abci

`xian-abci` is the CometBFT-facing Xian node runtime. It owns deterministic
chain execution, ABCI request handling, state export and snapshot flows, and
the node-adjacent services (BDS indexing, metrics, the optional dashboard) that
run alongside a Xian validator or full node.

The published PyPI package is `xian-tech-abci`. Console entrypoints
(`xian-abci`, `xian-dashboard`, `xian-configure-node`, and the BDS / state
helpers) are installed by the package and used both directly and from the
operator-facing `xian-cli`.

## Runtime Shape

```mermaid
flowchart LR
  CometBFT["CometBFT"] --> ABCI["ABCI handlers"]
  ABCI --> Executor["Transaction processor"]
  Executor --> VM["Rust xian-vm-core: execution, fees and rewards"]
  Executor --> State["Chain state"]
  ABCI -->|receipts and state patches| BDS["Asynchronous BDS indexer"]
  State --> Snapshots["Export and snapshot tools"]
  ABCI --> Metrics["Metrics"]
  Dashboard["Optional dashboard"] --> RPC["CometBFT RPC and application queries"]
  CLI["xian-cli and xian-stack"] --> Entrypoints["xian-abci entrypoints"]
```

## Quick Start

Bootstrap the development environment with `uv`:

```bash
UV_CACHE_DIR=/tmp/uv-cache uv sync --group dev
```

Inspect the available command surface:

```bash
uv run xian-abci --help
uv run xian-dashboard --help
uv run xian-configure-node --help
uv run xian-export-state --help
uv run xian-state-snapshot --help
uv run xian-bds-reindex --help
uv run xian-bds-snapshot --help
uv run xian-bds-spool --help
```

The native VM (`xian-tech-vm-core`) is a required dependency: it executes
blocks and is the one transaction admission implementation (CheckTx,
PrepareProposal, ProcessProposal and FinalizeBlock). Optional extra:

- `zk` — installs the off-chain Python proving toolkit. The VM already links
  the native verifier; enabling the chain's `zk` feature is a genesis or
  governed state decision, not a package-extra switch.

Fresh chains use unmodified upstream CometBFT 0.40.0 with the flood mempool
and Ed25519 validators. Other mempool modes are rejected at startup. Keep
rechecks enabled so the mempool removes
transactions invalidated by a committed nonce, balance, or fee policy change.
For each sender, a committed nonce makes every lower nonce unusable.
Bootstrap uses ordinary replay
or a [verified full-node-store backup](docs/SNAPSHOTS_AND_PRUNING.md); P2P
application state sync is disabled. Offline application exports remain available.

For a ready-made local network instead of wiring the node yourself, use
[`xian-stack`](../xian-stack). This repo focuses on the runtime and backend
tooling, not the full localnet UX.

## Principles

- **Deterministic chain execution.** The ABCI handlers, transaction execution,
  rewards, validators, and query behavior live here and must be deterministic
  across nodes.
- **Backend, not UX.** Operator-facing lifecycle commands belong in
  [`xian-cli`](../xian-cli). This repo exposes importable helpers and
  backend-oriented CLIs only.
- **Universal node runtime.** No network-specific genesis files, seeds, or
  snapshots. Committed chain assets live in
  [`xian-configs`](../xian-configs).
- **Contract semantics live elsewhere.** Changes to contract execution
  semantics belong in [`xian-contracting`](../xian-contracting), not here.
- **No Compose / orchestration.** Container lifecycle and local-stack
  orchestration belong in [`xian-stack`](../xian-stack).

Local `uv` development requires a sibling checkout of
`../xian-contracting`. Full validation also uses sibling checkouts of
`../xian-contracts`, `../xian-configs`, and `../xian-stack`.

## Key Directories

- `src/xian/` — repo-owned node runtime: ABCI handlers, services, utilities,
  and CLI entrypoints.
  - `methods/` — ABCI request handlers (CheckTx, proposal checks, FinalizeBlock,
    Commit, Query).
  - `services/` — background services such as the simulator and BDS support.
  - `cli/` — backend and developer entrypoints (configure-node, export-state,
    BDS helpers, …) wrapping importable helpers.
  - `tools/` — one-off upgrade data and state-patch payloads. Treated as a
    transition area; new code should live as importable helpers under
    `src/xian/`.
  - `dashboard/` — the optional operator dashboard.
- `src/abci/` — lower-level ABCI server and protocol glue.
- `protos/` — exact CometBFT 0.40.0 `tendermint.*` schemas and their protobuf dependencies.
- `build_proto.py` — regenerates checked-in protobuf Python stubs under `src/`.
- `scripts/` — repo-level validation and manual benchmark entrypoints.
- `tests/` — unit, ABCI-method, integration, governance, tools, and system
  coverage.
- `docs/` — architecture notes, API surface, safety invariants, snapshots /
  pruning model, governance, and backlog.

## Validation

Preferred full validation entrypoint, used for releases:

```bash
./scripts/validate-release.sh
```

It defaults to Python `3.14` (override with `XIAN_ABCI_VALIDATE_PYTHON`) and
runs:

- `./scripts/validate-repo.sh`, including protobuf regeneration and stale-stub
  checks, lint, formatting, and the full node test suite (with the transaction
  admission parity corpus, `tests/unit/test_admission_parity.py`)

Faster local loops:

```bash
UV_CACHE_DIR=/tmp/uv-cache uv run ruff check .
UV_CACHE_DIR=/tmp/uv-cache uv run ruff format --check .
UV_CACHE_DIR=/tmp/uv-cache uv run pytest
UV_CACHE_DIR=/tmp/uv-cache uv run pytest tests/unit/test_node_setup.py
```

CI provisions PostgreSQL 18.7 for the BDS-backed paths. To mirror that locally, expose
Postgres at `postgres://postgres:1234@localhost:5432/xian`.
CI also runs admission and block replay against a fresh, non-editable install
from `uv.lock`, alongside the editable development build.

## Related Docs

- [AGENTS.md](AGENTS.md) — repo-specific guidance for AI agents and contributors
- [docs/README.md](docs/README.md) — index of internal design notes
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) — major components and dependency direction
- [docs/BACKLOG.md](docs/BACKLOG.md) — open work and follow-ups
- [docs/API.md](docs/API.md) — ABCI and helper API surface
- [docs/SAFETY_INVARIANTS.md](docs/SAFETY_INVARIANTS.md) — invariants the runtime must preserve
- [docs/SNAPSHOTS_AND_PRUNING.md](docs/SNAPSHOTS_AND_PRUNING.md) — snapshot, pruning, and BDS retention model
- [docs/CHAIN_ASSETS.md](docs/CHAIN_ASSETS.md) — split between this repo and `xian-configs`
- [docs/TIME_SEMANTICS.md](docs/TIME_SEMANTICS.md) — block-time and timestamp rules
- [docs/Governance.md](docs/Governance.md) — on-chain governance behavior
