跳到正文

Stellar-Sentinel

sentinel-contracts

Soroban contract for authorized Stellar Sentinel flags, configurable thresholds, and latest-flag records.

README 已保存到本站,可直接阅读

Documentation snapshot

README 快照

这篇是英文原文

下面正文是项目自己的英文 README。想读全文就用浏览器自带的整页翻译: Chrome / Edge 点地址栏右侧的翻译图标,或用右键菜单里的「翻译成中文」; 手机浏览器一般在菜单里。

本页保存的是公开项目资料快照,阅读过程不需要连接 GitHub。

Stellar Sentinel Soroban Contract

图片:CI 图片:License: MIT

Soroban contract for administrator-managed monitoring agents, a configurable 0–100 score threshold, and account flags. It publishes flagged events and stores the latest flag for each subject. It does not store full history; event indexing is needed for that.

Architecture

flowchart LR
  Admin[Contract administrator] -->|authorize, revoke, set threshold| Contract[Stellar Sentinel Soroban contract]
  Agent[Authorized agent] -->|flag_anomaly| Contract
  Contract -->|latest flag state| State[Soroban persistent storage]
  Contract -->|flagged event| RPC[Stellar RPC event stream]
  RPC -->|read events| Backend[Stellar Sentinel backend]
  Backend -->|JSON API| UI[Dashboard]

The backend reads events and does not sign or submit transactions. The contract and backend RPC must use the same network for events to appear in the dashboard.

Testnet deployment

The current Stellar Sentinel instance is deployed and initialized on the Stellar Testnet. It uses the Testnet network passphrase Test SDF Network ; September 2015 and the Soroban RPC endpoint https://soroban-testnet.stellar.org.

DetailValue
Contract IDCCZAAZ3FJ7LKZA7E7A6EKQTU2HCNVI3YUVIHKWHSULGZSWAJFS2D2XVX
Contract source5b6b5a7
Wasm SHA-256f501250438515ff26e18ebf951cd62de717c711e68d031fb0fad5c9a9b36bd5d
Score threshold70 (initialized)
Admin accountGAPNXDMWAMEWHEVMSDXYD5BS2V3P6E4A7OPG6F2MLME5666VSPT5BIHM
Authorized monitoring agentsNone yet

Transaction records:

The admin identity alias stellar-sentinel-testnet-admin is stored in the deploying machine’s macOS Keychain using Stellar CLI secure storage. Its secret is not in this repository. Preserve the Keychain entry and securely back up the recovery material. The backend’s .env.example points to this contract. The event feed is connected, but it currently has no flags because no monitoring agent has been authorized.

Reproduce a separate Testnet deployment

These commands create a new identity and contract instance; they do not redeploy or alter the contract above. Install the Stellar CLI, Rust, and the Wasm target first. Keep the generated identity in secure storage and never commit its seed phrase.

stellar keys generate sentinel-admin --network testnet --fund --secure-store
stellar contract build --locked
stellar contract deploy \
  --wasm target/wasm32v1-none/release/sentinel_contract.wasm \
  --source-account sentinel-admin \
  --network testnet \
  --alias sentinel_contract
stellar contract invoke \
  --id sentinel_contract \
  --source-account sentinel-admin \
  --network testnet -- \
  initialize --admin sentinel-admin --default-threshold 70

To verify this deployment’s initialized threshold without submitting a transaction:

stellar contract invoke \
  --id  \
  --source-account sentinel-admin \
  --network testnet --send=no -- \
  get_threshold

Set the resulting contract ID as the backend’s CONTRACT_ID. Keep its Horizon and Soroban RPC endpoints on Testnet as well.

Project layout

  • src/lib.rs — contract entry points, storage keys, authorization, threshold checks, event publication, and latest-flag lookup.
  • src/test.rs — contract behavior tests using Soroban test utilities.
  • Cargo.toml / Cargo.lock — Rust and Soroban SDK dependencies.
  • .github/workflows/ci.yml — Wasm build, unit tests, and Clippy checks.

Build and test

Requires stable Rust, the wasm32-unknown-unknown and wasm32v1-none targets, and Stellar CLI for optimized deployment builds. There are no contract-specific environment variables; network IDs and signing identities are supplied to deployment tooling outside this repository.

rustup target add wasm32-unknown-unknown wasm32v1-none
cargo build --target wasm32-unknown-unknown --release
stellar contract build --locked
cargo test
cargo clippy --all-targets -- -D warnings

The CI Wasm artifact is under target/wasm32-unknown-unknown/release/. stellar contract build --locked creates the optimized deployable artifact under target/wasm32v1-none/release/. CI runs the Wasm build, tests, and lint checks (Clippy).

Contract interface

  • initialize(admin, default_threshold) — one-time admin and threshold setup.
  • authorize_agent(admin, agent) / revoke_agent(admin, agent) — manage flagging agents.
  • set_threshold(admin, threshold) / get_threshold() — configure/read the threshold.
  • is_agent(agent) — check agent authorization.
  • flag_anomaly(agent, subject, score) — require an authorized agent and a score at or above threshold; persist the latest record and publish flagged.
  • get_latest_flag(subject) — read the latest record, if one exists.

Only trusted addresses should receive agent authorization. The contract enforces the score range and threshold, but it cannot establish that an off-chain score is accurate. Storage follows Soroban TTL and archival rules. Deploy, initialize, and configure each network separately; never commit secrets.

Official distribution

获取与安装

暂未发现可确认的官方软件包地址

当前 README 快照没有出现 npm、PyPI、Crates.io、pub.dev 等官方包页链接。本站不会根据仓库名称猜测下载地址。

本站不托管项目文件;需要安装时,请以项目维护者发布的官方文档为准。

使用前核验

本站保存公开资料用于阅读,不代表安全审计或功能背书。安装前请核对许可证、依赖来源和发布签名,不要直接运行来源不明的二进制文件或高权限脚本。