Skip to main content

SDK Structure

NOT YET AVAILABLE

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.

TESTNET ONLY

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)โ€‹

  1. Hello SELF - Basic connection and query
  2. Token Transfer - Send TEST tokens
  3. Block Explorer - Read blockchain data
  4. Event Watcher - Subscribe to events

Advanced Examples (Coming Later)โ€‹

  1. Simple dApp - Basic decentralized application
  2. NFT Minting - Create test NFTs
  3. Governance Voting - Participate in test governance
  4. 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:

  1. Principle of Least Privilege - Only expose what's necessary
  2. Testnet Isolation - Clear separation from mainnet
  3. Fail-Safe Defaults - Conservative limits and checks
  4. Transparent Communication - Clear about limitations

Questions?โ€‹


โš ๏ธ Remember: These SDKs are for TESTNET only. Never use with real assets!