SDK Structure
This page describes the PLANNED structure for future SDKs. These SDKs do not exist yet and cannot be installed or used. All code examples are conceptual illustrations of the intended API design.
When released, these SDKs will be for testnet use only:
- Do not use in production or with real assets
- Testnet tokens have ZERO monetary value
- Network may reset at any time without notice
Repository Structure Planโ
This document outlines the planned structure for SELF Chain SDKs that will be developed in the future. These are design specifications, not existing packages.
Planned SDK Repositoriesโ
self-chain-sdk-js/ # JavaScript/TypeScript SDK
self-chain-sdk-rust/ # Rust SDK
self-chain-sdk-python/ # Python SDK
self-chain-sdk-go/ # Go SDK
JavaScript/TypeScript SDK Structureโ
self-chain-sdk-js/
โโโ README.md # TESTNET warnings prominent
โโโ package.json
โโโ tsconfig.json
โโโ src/
โ โโโ index.ts
โ โโโ client/
โ โ โโโ SELFClient.ts # Main client class
โ โ โโโ testnet.ts # Testnet-specific configuration
โ โ โโโ types.ts
โ โโโ crypto/
โ โ โโโ keys.ts # Key generation (testnet only)
โ โ โโโ signing.ts
โ โ โโโ hashing.ts
โ โโโ transactions/
โ โ โโโ builder.ts # Transaction construction
โ โ โโโ types.ts
โ โ โโโ validation.ts
โ โโโ poai/ # PoAI interaction (limited in testnet)
โ โ โโโ validator.ts
โ โ โโโ colorMarker.ts
โ โโโ utils/
โ โโโ constants.ts # TESTNET constants
โ โโโ errors.ts
โโโ examples/ # Testnet examples only
โ โโโ 01-connect.ts # Basic connection
โ โโโ 02-transfer.ts # Token transfer
โ โโโ 03-query.ts # Query blockchain
โ โโโ README.md # โ ๏ธ Testnet warning
โโโ tests/
โ โโโ unit/
โ โโโ integration/
โโโ docs/
โโโ getting-started.md # Testnet focus
โโโ api-reference.md
Core SDK Features (Planned Design)โ
REMINDER: The code examples below are conceptual designs showing how the SDKs will work when developed. You cannot install or use these packages yet.
1. Client Connection (Conceptual Example)โ
// PLANNED API - NOT YET IMPLEMENTED
// This shows how the SDK will work in the future
import { SELFClient } from '@self-chain/sdk'; // Package does not exist yet
const client = new SELFClient({
network: 'testnet', // ONLY testnet supported
endpoint: 'https://testnet-api.self.app',
warning: true // Shows testnet warning on connection
});
// SDK will display warning:
// โ ๏ธ WARNING: Connected to SELF Chain TESTNET
// Do not use real assets or production data!
2. Transaction Building (Conceptual Example)โ
// PLANNED API - This is how transactions will work when implemented
const tx = await client.transaction()
.transfer({
to: 'self1234...', // Testnet address
amount: '100', // TEST tokens only
memo: 'Test transfer'
})
.sign(privateKey) // Testnet key only
.broadcast();
// Response includes testnet warning
console.log(tx.warning); // "This is a testnet transaction"
3. Safety Featuresโ
All SDKs will include:
// Automatic testnet detection
if (isMainnetAddress(address)) {
throw new Error('Mainnet address detected! Use testnet addresses only.');
}
// Transaction limits
const MAX_TESTNET_AMOUNT = 10000; // TEST tokens
if (amount > MAX_TESTNET_AMOUNT) {
throw new Error('Amount exceeds testnet limits');
}
// Prominent warnings
console.warn('๐ง TESTNET TRANSACTION - NO REAL VALUE ๐ง');
Public Interfaces (Security-Safe)โ
Exposed APIsโ
These interfaces can be safely made public:
// Read-only blockchain queries
interface BlockchainQuery {
getBlock(height: number): Promise<Block>;
getTransaction(hash: string): Promise<Transaction>;
getAccount(address: string): Promise<Account>;
getValidators(): Promise<Validator[]>;
}
// Transaction construction (no security secrets)
interface TransactionBuilder {
transfer(params: TransferParams): Transaction;
delegate(params: DelegateParams): Transaction;
undelegate(params: UndelegateParams): Transaction;
}
// Event subscription (read-only)
interface EventSubscription {
onBlock(callback: BlockCallback): Unsubscribe;
onTransaction(callback: TxCallback): Unsubscribe;
onEvent(type: string, callback: EventCallback): Unsubscribe;
}
Hidden/Restricted APIsโ
These remain in private repositories:
// โ NOT exposed in public SDKs:
// - AI validation thresholds
// - Pattern matching algorithms
// - Consensus mechanism internals
// - Security-critical parameters
// - Production configurations
SDK Development Guidelinesโ
1. Testnet-First Designโ
- Every function assumes testnet
- Prominent warnings throughout
- Automatic mainnet detection and rejection
- Test token limits enforced
2. Security Boundariesโ
- No exposure of validation logic
- No consensus parameters
- No security thresholds
- Read-only blockchain access
3. Developer Experienceโ
- Clear error messages with testnet context
- Comprehensive examples (testnet only)
- TypeScript types for safety
- Intuitive API design
Example Applications Planโ
Basic Examples (Safe for Testnet)โ
- Hello SELF - Basic connection and query
- Token Transfer - Send TEST tokens
- Block Explorer - Read blockchain data
- Event Watcher - Subscribe to events
Advanced Examples (Coming Later)โ
- Simple dApp - Basic decentralized application
- NFT Minting - Create test NFTs
- Governance Voting - Participate in test governance
- Cross-Chain Bridge - Test bridge functionality
Planned Release Timelineโ
Note: These are tentative timelines subject to change. SDKs are not yet available.
Phase 1: Core SDKs (Target: Q4 2025)โ
- JavaScript/TypeScript SDK (testnet)
- Basic transaction support
- Read-only queries
- Event subscriptions
Phase 2: Extended Features (Target: Q1 2026)โ
- Python SDK
- Rust SDK
- Smart contract interaction
- Advanced queries
Phase 3: Developer Tools (Target: Q2 2026)โ
- Go SDK
- CLI improvements
- Testing frameworks
- Documentation expansion
Contributing to SDKsโ
When SDKs are released, contributions welcome for:
- ๐ง Bug fixes
- ๐ Documentation improvements
- ๐งช Test coverage
- ๐ Internationalization
- โฟ Accessibility features
NOT accepted:
- ๐ซ Mainnet features (until ready)
- ๐ซ Security bypass attempts
- ๐ซ Consensus modifications
- ๐ซ Production features
Security Considerationsโ
All SDK development follows:
- Principle of Least Privilege - Only expose what's necessary
- Testnet Isolation - Clear separation from mainnet
- Fail-Safe Defaults - Conservative limits and checks
- Transparent Communication - Clear about limitations
Questions?โ
- GitHub: Create an issue with [SDK] tag
- Email: devs@self.app
โ ๏ธ Remember: These SDKs are for TESTNET only. Never use with real assets!