Quickstart
Download the Lexe Wallet app
To get started, you'll need a Lexe wallet. Download the Lexe mobile app for:
- iOS (App Store): https://lexe.app/ios
- Android (Play Store): https://lexe.app/android
After installing the app, select "Create a new wallet", optionally connect your Google Drive (for backups), and set a backup password. This will create a new self-custody Bitcoin+Lightning wallet that runs in a secure enclave in the cloud; you can now send and receive Lightning payments 24/7!
Configure credentials for the SDK
The Python SDK supports two credential types:
ClientCredentials: control an existing wallet created in the Lexe app.RootSeed: sign up users and manage wallets from your backend.
Option 1: ClientCredentials (existing app wallet)
To control a wallet created in the app, export client credentials:
- Open the Lexe app > Menu sidebar > "SDK clients" > "Create new client"
- Copy the client credentials string
Set LEXE_CLIENT_CREDENTIALS in your environment or in a .env file:
# Option 1: Set directly in environment
$ export LEXE_CLIENT_CREDENTIALS="eyJsZXhlX2F1dGhfdG9rZ...TA0In0"
# Option 2: Use a .env file
$ echo 'LEXE_CLIENT_CREDENTIALS=eyJsZXhlX2F1dGhfdG9rZ...TA0In0' > .env
$ chmod 600 .env
Option 2: RootSeed (programmatic signup)
To sign up users and manage wallets from your backend, use RootSeed
credentials. The examples below show this flow with load_or_fresh,
signup, and provision.
Install the SDK
The package includes precompiled native bindings for Linux (x86_64, aarch64), macOS (x86_64, Apple Silicon), and Windows (x86_64). Python 3.10+ is required.
Create a new node for your user
Wallet developers can programmatically create Lexe nodes for their users. Each user gets a self-custodial Lightning node running in a secure enclave.
from lexe import Credentials, LexeWallet, RootSeed, SeedFileError, WalletConfig
# Create a wallet config for mainnet (or testnet3() for testing)
config = WalletConfig.mainnet()
# Try to load an existing seed from ~/.lexe, or create a fresh one
try:
seed = RootSeed.read(config)
is_new_seed = False
except SeedFileError.NotFound:
seed = RootSeed.generate()
is_new_seed = True
# Create credentials and load or create wallet (data stored in ~/.lexe)
creds = Credentials.from_root_seed(seed)
wallet = LexeWallet.load_or_fresh(config, creds)
if is_new_seed:
# Sign up the user and provision their node.
# Pass your partner_user_pk to associate the node with your platform.
wallet.signup(
root_seed=seed,
partner_pk=None, # Your partner user_pk (hex), if applicable
)
# Persist the seed so we can load it on subsequent runs.
# Stored at ~/.lexe/seedphrase.txt (mainnet).
seed.write(config)
else:
# Ensure the node is running the latest enclave version
wallet.provision(creds)
# The node is now live. Query its info
info = wallet.node_info()
print(f"Node created! Public key: {info.node_pk}")
print(f"Balance: {info.balance_sats} sats")
Using the SDK
Once a node is provisioned, you can create invoices, send payments, and more:
from lexe import Credentials, LexeWallet, PaymentFilter, RootSeed, WalletConfig
config = WalletConfig.mainnet()
seed = RootSeed.read(config)
creds = Credentials.from_root_seed(seed)
wallet = LexeWallet.load_or_fresh(config, creds)
wallet.provision(creds)
# Get node info
info = wallet.node_info()
print(f"Balance: {info.balance_sats} sats")
# Create a Lightning invoice
resp = wallet.create_invoice(
expiration_secs=3600,
amount_sats=None,
description="Payment for coffee",
)
print(f"Invoice: {resp.invoice}")
# Pay a Lightning invoice
payment_resp = wallet.pay_invoice(
invoice="lnbc...",
fallback_amount_sats=None,
note="Paying for coffee",
)
# Sync and list payments
wallet.sync_payments()
payments = wallet.list_payments(filter=PaymentFilter.ALL)
for p in payments.payments:
print(f" {p.status}: {p.amount_sats} sats")