This document provides architectural notes and design considerations for the Pi Ruby SDK. It is intended to help developers understand system boundaries, responsibilities, and recommended usage patterns.
This document is descriptive, not prescriptive, and does not represent an official roadmap or commitment.
The Pi Ruby SDK operates at the application backend layer and serves as a secure integration interface between:
- A Ruby-based backend application
- The Pi Platform Server APIs
- The Pi Blockchain network (Testnet or Mainnet)
The SDK does not function as:
- A smart contract framework
- A blockchain node
- A price oracle or valuation mechanism
The SDK implements a hybrid off-chain / on-chain payment flow:
| Stage | System | Responsibility |
|---|---|---|
| Payment Creation | Pi Platform Server | Payment intent registration and anti-duplication |
| Transaction Submission | Pi Blockchain | Value transfer and settlement |
| Payment Completion | Pi Platform Server | Transaction verification and finalization |
This design enables fraud prevention, auditability, and deterministic payment lifecycle management.
Payments progress through a defined lifecycle:
- Initialized (
create_payment) - Submitted (
submit_payment) - Verified (blockchain confirmation)
- Completed (
complete_payment) - Cancelled (optional terminal state)
While the SDK exposes granular methods, applications are expected
to persist payment_id and txid to ensure idempotency and recovery.
Blockchain submission is subject to timing constraints and network state.
The SDK includes retry handling for specific transient errors
(e.g. tx_too_early) to improve reliability.
Applications should still treat all payment operations as potentially asynchronous and resilient to retries.
The SDK design assumes that:
- Backend services may retry requests
- Network interruptions may occur
- Payment operations must be resumable
To support this:
payment_idserves as the primary idempotency keyget_incomplete_server_paymentsenables recovery of interrupted flows- Transaction verification is performed server-side by Pi Platform
The SDK may operate against different Pi Network environments (e.g. Testnet or Mainnet). Applications should explicitly separate configuration and credentials per environment to avoid cross-network confusion.
The following are explicitly out of scope for the Pi Ruby SDK:
- Price discovery or exchange integration
- Decentralized governance logic
- Smart contract execution
- On-chain oracle systems
These constraints are intentional and align with Pi Network’s application-first ecosystem model.
- API keys and wallet private seeds must never be exposed to clients
- All SDK usage should occur server-side
- Payment state must be stored durably in application databases
Failure to follow these guidelines may result in fund loss or policy violations.
This document is provided for architectural clarity only. Implementation details may evolve without notice. All final authority rests with the Pi Network Core Team and repository maintainers.