Skip to main content

CLI for tiders-x402-server: run a payment-enabled database API server from a YAML config file.

Project description

tiders-x402-server (CLI)

Sell access to your data — install the server, point this server at a database, set a price, and anyone on the internet can pay small cryptocurrency amounts to query your data instantly, with no contracts, accounts, or billing setup.

Buyers submit SQL queries over HTTP and receive results as efficient Apache Arrow IPC streams. You control what data is exposed, which tables are available, and how much each query costs — per row returned or a flat fee to access a table. Buyers interact using familiar SQL, but Tiders enforces a safe subset — blocking expensive operations like JOINs and subqueries — so your database stays protected and costs stay predictable.

Payments are handled by the x402 protocol, an open standard for HTTP-native micropayments. When a server needs payment it returns a standard 402 Payment Required response; a client with x402 support signs it, and the transaction settles in under a second using stablecoins — no accounts, no checkout pages, no minimum spend.

Under the hood, Tiders is a Rust server that connects to different databases such as DuckDB, PostgreSQL, or ClickHouse. Buyers query using familiar SQL, but Tiders enforces a safe subset — blocking expensive operations like JOINs and subqueries — so your database stays protected and costs stay predictable.

Serving raw data from your database through a paid API is the server's core job. As an optional addition — because selling data is hard without showing buyers what they're getting — the same server application can scaffold and publish interactive dashboards: fully customizable visual reports you design and your buyers explore in a browser, with a convenience button that hits the server's x402-gated APIs to download the underlying data. The server works exactly the same with or without dashboards.

Think of the dashboard feature as a vending machine for data: buyers browse the dashboard to preview what's available, then pay per request to access the full dataset. You stay in full control — what data is freely visible in the dashboard, which tables the server exposes, and how much each query costs, whether that's per row returned or a flat fee to access a table.

Full documentation: https://yulesa.github.io/tiders-x402-server/

Installation

pip install tiders-x402-server
# or
cargo install tiders-x402-server

Quick Start

Tiders-x402-server assumes you already have a database populated with the data you want to sell. If you don't, the Tiders ingestion tool can help you stand one up and load it with crypto data — see Choosing a Database for guidance on picking a backend.

  1. Install the CLI:
pip install tiders-x402-server
  1. Create a tiders-x402-server.yaml:
server:
  bind_address: "0.0.0.0:4021"
  base_url: "http://localhost:4021"

facilitator:
  url: "https://facilitator.x402.rs"

database:
  duckdb:
    path: "./data/my_data.duckdb"

tables:
  - name: my_table
    description: "My dataset"
    price_tags:
      - type: per_row
        pay_to: "0xYourWalletAddress"
        token: usdc/base_sepolia
        amount_per_item: "0.002"
        is_default: true

dashboard: # Optional
  entries:
    - slug: my_dashboard
      title: "My Dashboard"
      description: "Description text for the dashboard"
      tags: ["Tag1", "Tag2"]
  1. Start the server:
tiders-x402-server start

The CLI auto-discovers YAML config files, supports ${VAR_NAME} environment variable expansion, and hot-reloads configuration on file changes.

  1. Optional - Create the dashboards:

You can create dashboards before or after starting the server. Scaffold dashboards defined in the YAML with the CLI command:

tiders-x402-server dashboard          # scaffold all entries
tiders-x402-server dashboard <slug>   # scaffold one

This copies a minimal Evidence project template into dashboards/<slug>/. From there, edit the files, mainly dashboards/<slug>/pages/index.md, to build your reports — the Evidence docs cover the full dashboard authoring workflow.

Note: Data visible in the dashboard can be scraped freely without payment. Only expose data you are comfortable sharing publicly, and leave anything sensitive behind the paid API instead.

Once the dashboard is ready, build it into a static site:

(cd dashboards/<slug> && npm install && npm run build)

The server will pick up and serve the built files automatically. Dashboards are static — they do not update live. Rebuild whenever the underlying data changes.

HTTP API

Endpoint Description
GET /api/ Server metadata: tables, schemas, payment requirements, SQL parser rules
GET /api/table/:name Full schema and payment offers for a table. Requires payment if the table has a MetadataPrice tag
GET /api/query?query=… Execute a SQL query (SQL in the query URL parameter). Returns 402 with payment options, or 200 with an Arrow IPC stream
GET /<slug>/ Static Evidence dashboard, one per dashboards: entry

Response formats:

  • 200 OKapplication/vnd.apache.arrow.stream
  • 402 Payment Required — JSON payment options; resend with X-Payment header
  • 400 Bad Request / 500 Internal Server Error — plain text error

Related packages

License

Licensed under either of Apache License 2.0 or MIT license at your option.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tiders_x402_server-0.3.3-py3-none-win_amd64.whl (18.8 MB view details)

Uploaded Python 3Windows x86-64

tiders_x402_server-0.3.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

tiders_x402_server-0.3.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (19.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

tiders_x402_server-0.3.3-py3-none-macosx_11_0_arm64.whl (22.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

tiders_x402_server-0.3.3-py3-none-macosx_10_12_x86_64.whl (23.7 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file tiders_x402_server-0.3.3-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for tiders_x402_server-0.3.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 63be8eeef9dfd05cfbccca7b5fcc4832205d41c2b264b4893ac86b374e041149
MD5 26068a97e693bbd55079bad2fa778b22
BLAKE2b-256 f66df1f08f7405cdf75045e29d8a128d4759155e22ee76db4325dc597a735ebf

See more details on using hashes here.

File details

Details for the file tiders_x402_server-0.3.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tiders_x402_server-0.3.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5c6165d100f8636c66901080316cc47b1825b476d5002a799eefb5e7bab28775
MD5 33ef9c41a01c265e42c9eadfa20d16d8
BLAKE2b-256 edd961a267316f5800635fb920f5a3b0e534d6ff923a61d60d9185774495c7df

See more details on using hashes here.

File details

Details for the file tiders_x402_server-0.3.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tiders_x402_server-0.3.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 824b7605b793da91994e07fd9bc3a062e40adeaac267d243f2a98e399a8e0b7c
MD5 8eecdf2b4274b35db50a486362ebd57d
BLAKE2b-256 b938a22b8f739135257458fa70d4c78178d6dcdfeaba8789ab32067d6818903e

See more details on using hashes here.

File details

Details for the file tiders_x402_server-0.3.3-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tiders_x402_server-0.3.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d6ce51c793889ae4ea71d60b56a18e55af768183bddbcc673500763cca737953
MD5 e1024559809d519b75c4e5e35f34992a
BLAKE2b-256 19584076d4a5935d952cbfb4e2c399d060aa1e33019e2d7717f4ca9cb19d38a7

See more details on using hashes here.

File details

Details for the file tiders_x402_server-0.3.3-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for tiders_x402_server-0.3.3-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bc1e44b6ad524b49ad812d478ecce9e35e327c02ec18ed18da8c6b6d7d37c674
MD5 f86f3717a2f2054fe0860c06018f2456
BLAKE2b-256 f1f704bbd0d53cee1be1815423d16b112e0924e719522b276008cb4a20c37caf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page