Skip to main content
The Python SDK is designed for server-side use. You must use both your public and secret API keys. Never expose your secret key in client-side code.
1

Install System Dependencies

The Python SDK depends on starknet.py, which requires certain system libraries to be installed first.
The following instructions assume Homebrew is installed.
First, install cmake (required for building crypto dependencies):
brew install cmake gmp
If you’re using an Apple Silicon Mac (M1/M2/M3), you may need to set additional flags during installation. See the installation section below.
For more details on macOS installation, see the starknet.py installation guide.
2

Install the Python SDK

pip install chipi-python
If you’re on an Apple Silicon Mac (M1/M2/M3) and encounter issues, use these flags:
CFLAGS=-I`brew --prefix gmp`/include LDFLAGS=-L`brew --prefix gmp`/lib pip install chipi-python
3

Get your API Keys

The Python SDK requires both your public key AND secret key for authentication.
  1. Go to your API Keys in the Chipi Dashboard
  2. Copy your Public Key (pk_prod_xxxx)
  3. Copy your Secret Key (sk_prod_xxxx)
Your secret key is used for backend authentication. Keep it secure and never commit it to version control.
4

Initialize the SDK

Create a new instance of the ChipiSDK with your API keys:
from chipi_sdk import ChipiSDK, ChipiSDKConfig

sdk = ChipiSDK(
    config=ChipiSDKConfig(
        api_public_key="pk_prod_your_public_key",
        api_secret_key="sk_prod_your_secret_key",
    )
)
5

Create Your First Wallet

Now you can create a wallet for your users:
from chipi_sdk import CreateWalletParams, WalletType

# Create a new wallet
wallet_response = sdk.create_wallet(
    params=CreateWalletParams(
        encrypt_key="user-secure-pin",
        external_user_id="your-user-id-123",
        wallet_type=WalletType.CHIPI,  # Optional, defaults to CHIPI
    )
)

print(f"Wallet created: {wallet_response.wallet_public_key}")
print(f"Transaction hash: {wallet_response.tx_hash}")

# Store these values for later use
wallet_data = wallet_response.wallet
# wallet_data.public_key
# wallet_data.encrypted_private_key
6

Make Your First Transfer

Transfer USDC between wallets:
from chipi_sdk import TransferParams, ChainToken

# Transfer USDC
tx_hash = sdk.transfer(
    params=TransferParams(
        encrypt_key="user-secure-pin",
        wallet=wallet_data,  # WalletData from creation
        token=ChainToken.USDC,
        recipient="0x1234567890abcdef...",  # Recipient address
        amount="1.5",  # Amount in USDC
    )
)

print(f"Transfer completed! TX: {tx_hash}")
print(f"View on Starkscan: https://starkscan.co/tx/{tx_hash}")
7

Environment Variables (Recommended)

For production applications, store your API keys as environment variables:
# .env
CHIPI_PUBLIC_KEY=pk_prod_your_public_key
CHIPI_SECRET_KEY=sk_prod_your_secret_key
Then initialize the SDK:
import os
from chipi_sdk import ChipiSDK, ChipiSDKConfig

sdk = ChipiSDK(
    config=ChipiSDKConfig(
        api_public_key=os.getenv("CHIPI_PUBLIC_KEY"),
        api_secret_key=os.getenv("CHIPI_SECRET_KEY"),
    )
)
Consider using python-dotenv to load environment variables from .env files.

Async Support

The Python SDK supports both sync and async operations. For better performance in async applications, use the async methods:
import asyncio
from chipi_sdk import ChipiSDK, ChipiSDKConfig, CreateWalletParams

sdk = ChipiSDK(
    config=ChipiSDKConfig(
        api_public_key="pk_prod_your_public_key",
        api_secret_key="sk_prod_your_secret_key",
    )
)

async def create_wallet_async():
    wallet_response = await sdk.acreate_wallet(
        params=CreateWalletParams(
            encrypt_key="user-secure-pin",
            external_user_id="your-user-id-123",
        )
    )
    return wallet_response

# Run async function
wallet = asyncio.run(create_wallet_async())
All SDK methods have async equivalents prefixed with a (e.g., create_walletacreate_wallet, transferatransfer).

Next Steps

Now that you have the basic setup working, explore more advanced features:

Security Best Practices

  • Never commit your secret API key to version control
  • Use environment variables for all sensitive credentials
  • Validate user inputs before making API calls
  • Securely store wallet encryption keys (never in plaintext)
Need help? Join our Telegram Community for support and to connect with other developers.