Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.chipipay.com/llms.txt

Use this file to discover all available pages before exploring further.

This page shows wallet creation and retrieval with chipi-stack on PyPI, using code lifted verbatim from python/tests/test_staging_smoke.py.
The Python SDK is published as chipi-stack on PyPI — matching the @chipi-stack/* npm scope. (The legacy chipi-python package is deprecated.)

Install

pip install chipi-stack
Requires Python 3.11+.

Initialise the SDK

import os
from chipi_sdk import ChipiSDK, ChipiSDKConfig

sdk = ChipiSDK(
    config=ChipiSDKConfig(
        api_public_key=os.environ["CHIPI_PUBLIC_KEY"],
        api_secret_key=os.environ["CHIPI_SECRET_KEY"],
        # alpha_url is only needed for staging or self-hosted backends
        alpha_url=os.environ.get("CHIPI_BASE_URL"),  # omit for production
    )
)

Create a wallet

create_wallet provisions a fresh Starknet account, encrypts the private key with the encrypt_key you provide, and returns a flat response (no nested .wallet field — public_key and encrypted_private_key are at the root).
from uuid import uuid4
from chipi_sdk import CreateWalletParams, WalletType

external_user_id = f"user-{uuid4().hex[:12]}"

result = sdk.create_wallet(
    params=CreateWalletParams(
        encrypt_key="user-chosen-pin",
        external_user_id=external_user_id,
        wallet_type=WalletType.CHIPI,
    ),
    bearer_token=os.environ["CHIPI_SECRET_KEY"],
)

print(result.public_key)            # 0x...
print(result.wallet_type)           # WalletType.CHIPI
print(result.chain)                 # Chain.STARKNET
print(result.is_deployed)           # False initially; flips to True once the deploy tx confirms

# result.encrypted_private_key is sensitive — store it in your user record
# (e.g. Postgres) alongside the externalUserId. Never log it.
store_in_db(external_user_id, result.encrypted_private_key)

Get a wallet

Look it up later by your own user ID:
from chipi_sdk import GetWalletParams

retrieved = sdk.get_wallet(
    params=GetWalletParams(external_user_id=external_user_id),
    bearer_token=os.environ["CHIPI_SECRET_KEY"],
)

assert retrieved.public_key == result.public_key
assert retrieved.encrypted_private_key == result.encrypted_private_key
The response is the same flat shape — public_key, encrypted_private_key, wallet_type, chain, is_deployed, id, external_user_id, created_at, updated_at are all on the root object.

Putting it together

import os
from uuid import uuid4
from chipi_sdk import (
    ChipiSDK,
    ChipiSDKConfig,
    CreateWalletParams,
    GetWalletParams,
    WalletType,
)


def main():
    sdk = ChipiSDK(
        config=ChipiSDKConfig(
            api_public_key=os.environ["CHIPI_PUBLIC_KEY"],
            api_secret_key=os.environ["CHIPI_SECRET_KEY"],
        )
    )
    bearer = os.environ["CHIPI_SECRET_KEY"]

    external_user_id = f"user-{uuid4().hex[:12]}"

    # 1. Create
    created = sdk.create_wallet(
        params=CreateWalletParams(
            encrypt_key=os.environ["USER_PIN"],
            external_user_id=external_user_id,
            wallet_type=WalletType.CHIPI,
        ),
        bearer_token=bearer,
    )

    # 2. Look it up by your own user ID
    retrieved = sdk.get_wallet(
        params=GetWalletParams(external_user_id=external_user_id),
        bearer_token=bearer,
    )

    print({"public_key": created.public_key, "match": retrieved.public_key == created.public_key})


if __name__ == "__main__":
    main()
Verified by python/tests/test_staging_smoke.py at commit 0042766 (2026-03-31). Runs in CI on every PR from stagingmain against live Chipi staging.

What’s next

Transfers, balance reads, PIN rotation, and session keys are exposed through the same SDK — coverage in the Python guide expands as we port more smoke tests. For the Node-equivalent flow today, see the Node guide.