> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blockx.chaintable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 快速开始

> 运行本地任务，再接入计算所需的 EVM 数据。

运行本地任务并检查返回值。此冒烟示例使用进程内示例后端。跑通后，按照[编写 EVM 数据函数](/zh/guides/write-functions)接入真实节点，并传入链与区块上下文。

## 前置条件

* Go `1.26.4`、C 编译器、Make 和 `pkg-config`。
* 带嵌入开发文件的 CPython `3.14` 或更高版本，以及 `uv`。
* BlockX 仓库及其私有依赖的访问权限。

## 准备 checkout

```bash theme={null}
git clone git@github.com:Chaintable/blockx.git
cd blockx
go mod download
uv sync --project python
```

依赖版本由 `python/pyproject.toml` 固定。贡献者流程见[本地开发](/zh/development/getting-started)。

## 构建 Worker 与 Executor 宿主

```bash theme={null}
go build -o /tmp/blockx-worker ./cmd/worker
make -C pyhost PYTHON="$PWD/python/.venv/bin/python"
```

Executor 宿主嵌入 CPython，其模块路径需要同时包含仓库运行时与虚拟环境依赖。

## 启动 Worker

在 BlockX 仓库根目录运行：

```bash theme={null}
BLOCKX_SITE_PACKAGES="$(python/.venv/bin/python -c 'import sysconfig; print(sysconfig.get_path("purelib"))')"
WORKER_LISTEN=127.0.0.1:9221 \
WORKER_ADDR=127.0.0.1:9221 \
EXECUTOR_COUNT=1 \
EXECUTOR_HOST_BIN=$PWD/pyhost/bin/blockx-pyhost \
PYTHON_BIN=$PWD/python/.venv/bin/python \
PYTHONPATH=$PWD/python:$BLOCKX_SITE_PACKAGES \
ETCD_ENDPOINTS=none \
ICEBERG_NAMESPACE=chaintable_test \
BLOCKX_USAGE_DISABLED=true \
BLOCKDB_TIME_WRITE_ADDR=127.0.0.1:1 \
STUB_BLOCKDB_DELAY_MS=0 \
/tmp/blockx-worker
```

等待日志出现 `worker listening` 和 `executor started`。本地示例跳过 etcd 注册并使用 stub 读取后端。时间表写地址用于满足启动配置，本例不会向该地址写入。

## 启动代理并提交

在另一终端中，从同一仓库根目录运行：

```bash theme={null}
python/.venv/bin/python examples/local_test_service/local_proxy.py
```

保持该进程运行。在第三个终端提交示例任务：

```bash theme={null}
python/.venv/bin/python examples/local_test_service/submit.py
```

```text theme={null}
[{'message': 'hello, ct2'}, {'message': 'hello, blockx'}]
```

两条记录的顺序可能不同。示例使用 `InputsCallConfig` 和 `ReturnValueHandler`，返回值但不写表。

## 遇到问题

| 现象 | 检查项 |
| - | - |
| 宿主构建失败 | CPython 版本、嵌入头文件、编译器与 `pkg-config` |
| Executor 无法导入依赖 | `PYTHONPATH` 是否包含虚拟环境的 site-packages |
| Worker 拒绝启动配置 | 是否提供了启动命令中的变量 |
| 代理连接失败 | 代理是否运行，`PROXY_SOCKET_PATH` 是否匹配其 socket |

## 下一步

* [EVM 计算模型](/zh/concepts/evm-computation)：选择链、区块与数据源。
* [编写 EVM 数据函数](/zh/guides/write-functions)：读取合约状态。
* [一次性计算](/zh/guides/run-once)：提交自己的参数。
* [按区块计算](/zh/guides/block-computation)：生成派生表数据。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.