For the complete documentation index, see llms.txt. This page is also available as Markdown.

Guide and Examples

vbase-api (pip install vbase-api; import vbase_api) is the Python client for the REST API. You can use it to stamp and verify files or structured data and to manage collections. See the quickstart for setup.

Verify your connection

After creating a client, confirm your key is valid before proceeding:

user = client.get_current_user()
print(f"Connected as: {user.email}")
print(f"Blockchain address: {user.last_address}")

Collections

Create a collection

collection = client.create_collection(
    name="daily-demand-forecasts",
    description="Daily demand forecasts by region",
)
print(f"Collection CID: {collection.cid}")

Retrieve collections

collections = client.get_collections()
for c in collections:
    print(f"{c.name}: {c.cid}")

Filter by pinning status:

Retrieve collections for a specific blockchain address:

Stamping

The examples below use demand forecasts. The same calls work with other predictive datasets, alternative data, portfolios, research results, and other files.

Stamp a file

store_stamped_file=False prevents vBase from retaining the file, but the file is still uploaded for CID calculation:

Use upload_stamped_file to store it later. If the file must not leave your machine before reveal, see Private Stamping with Delayed Reveal.

Stamp structured data

Pass a Python dict or string as data. The client serializes dicts with json.dumps before sending them.

file_name sets the stored filename for data. Specify collection_name or collection_cid, not both.

Commitment receipt

Every successful stamp returns a commitment receipt:

Idempotency

By default, resending identical content within 3,600 seconds can return the existing receipt. Set idempotent=False only when identical content needs a new timestamp.

Verifying stamps

Look up existing stamps by content ID:

filter_by_user=True limits results to the authenticated user; the default searches all users. Pass multiple content IDs in one call:

Uploading a previously stamped file

If you stamped with store_stamped_file=False or data_cid, you can upload the file later. The authenticated user must own the collection, and the file's CID must match a commitment in that collection:

Client lifecycle

Use the client as a context manager to close its HTTP session automatically:

If you do not use a with block, call client.close() when finished.

Reference

Last updated