GG

graphsense/graphsense-lib

API 开发

本页由 AI 翻译,技术细节请以原文为准。 查看原文

21 stars 质量 72 趋势 30MIT

一个存储 Python 工具函数及所有与 GraphSense 后端交互组件的中央仓库。

概览

一个为GraphSense加密分析平台打造的全面Python库。它为加密货币交易和网络提供数据库访问、数据摄取、维护工具和分析功能。 该库使用可选依赖。使用 graphsense-lib[all] 安装所有功能。 Web API 需要两个后端连接:一个集群(区块链数据)和一个(PostgreSQL)。你可以通过环境变量或 YAML 配置文件配置它们。 指向CONFIG_FILE一个专门针对REST的配置(完整示例见 instance/config.yaml): 如果你已经有 .graphsense.yaml(或 ~/.graphsense.yaml)用于 CLI,你可以添加包含 REST 配置的 web 密钥。应用会自动拾取,无需设置 CONFIG_FILE: Explicit config_file param > CONFIG_FILE env var > ./instance/config.yaml > .graphsense.yaml web key > env vars only. 配置文件中的任何字符串值都可以引用带有 ${VAR} 的环境变量。这在 CLI 配置(.

概述(AI 翻译)

一个为GraphSense加密分析平台打造的全面Python库。它为加密货币交易和网络提供数据库访问、数据摄取、维护工具和分析功能。

注: 本库使用可选依赖。使用 graphsense-lib[all] 安装所有功能。

快速启动

安装

本地提供REST API

Web API 需要两个后端连接:一个 Cassandra 集群(区块链数据)和一个 TagStore(PostgreSQL)。你可以通过环境变量或 YAML 配置文件配置它们。

选项A:仅限环境变量

选项B:YAML配置文件

将CONFIG_FILE指向一个REST专用配置(完整示例见[instance/config.yaml):

或者不看品牌:

选项C:.graphsense.yaml,密钥为web

如果你已经有 .graphsense.yaml(或 ~/.graphsense.yaml)用于 CLI,你可以添加包含 REST 配置的 web 键。应用会自动拾取,无需设置 CONFIG_FILE:

Config resolution order: explicit config_file param > CONFIG_FILE env var > ./instance/config.yaml > .graphsense.yaml web key > env vars only.

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

GraphSense Library

A comprehensive Python library for the GraphSense crypto-analytics platform. It provides database access, data ingestion, maintenance tools, and analysis capabilities for cryptocurrency transactions and networks.

Note: This library uses optional dependencies. Use graphsense-lib[all] to install all features.

Quick Start

Installation

# Install with all features
uv add graphsense-lib[all]

# Install from source
git clone https://github.com/graphsense/graphsense-lib.git
cd graphsense-lib
make install

Serving the REST API locally

The web API requires two backend connections: a Cassandra cluster (blockchain data) and a TagStore (PostgreSQL). You can configure them via environment variables or a YAML config file.

Option A: Environment variables only

GS_CASSANDRA_ASYNC_NODES='[""]' \
GRAPHSENSE_TAGSTORE_READ_URL='postgresql+asyncpg://:@:/tagstore' \
GS_CASSANDRA_ASYNC_CURRENCIES='{"btc":{"raw": "btc_raw", "transformed": "btc_transformed"},"eth":{}}' \
uv run --extra web uvicorn graphsenselib.web.app:create_app --factory --host localhost --port 9000 --reload

Option B: YAML config file

Point CONFIG_FILE to a REST-specific config (see instance/config.yaml for a full example):

CONFIG_FILE=./instance/config.yaml make serve-web

Or without Make:

CONFIG_FILE=./instance/config.yaml \
uv run --extra web uvicorn graphsenselib.web.app:create_app --factory --host localhost --port 9000 --reload

Option C: .graphsense.yaml with a web key

If you already have a .graphsense.yaml (or ~/.graphsense.yaml) for the CLI, you can add a web key containing the REST config. The app will pick it up automatically without setting CONFIG_FILE:

# .graphsense.yaml
environments:
  # ... your existing CLI config ...

web:
  database:
    nodes: [""]
    currencies:
      btc:
      eth:
  gs-tagstore:
    url: "postgresql+asyncpg://:@:/tagstore"
make serve-web

Config resolution order: explicit config_file param > CONFIG_FILE env var > ./instance/config.yaml > .graphsense.yaml web key > env vars only.

Environment variable substitution in YAML

在 GitHub 查看完整 README

推荐工具

换一个关键词,或者移除筛选条件。

安装

npx skillfish add graphsense/graphsense-lib
新手?先看 mcpskill.org 教程 →