SDK Reference
SDK Reference
The Arch Network ecosystem provides two distinct SDKs for building applications. Each SDK serves different use cases and development environments. This page will help you choose the right SDK for your project.
Available SDKs
1. TypeScript SDK (by Saturn)
The TypeScript SDK is developed and maintained by Saturn (@saturnbtc) and provides a comprehensive JavaScript/TypeScript interface for interacting with the Arch Network.
Package: @saturnbtcio/arch-sdk
Repository: arch-typescript-sdk
Language: TypeScript/JavaScript
Best for:
- Frontend applications (React, Vue, Angular)
- Node.js backend services
- Web3 applications
- Rapid prototyping
- JavaScript/TypeScript developers
2. Rust SDK
The Rust SDK is the native SDK included in the main Arch Network repository. It provides low-level access to all network features and is used for building high-performance applications and programs.
Package: arch_sdk
Repository: Part of arch-network
Language: Rust
Best for:
- On-chain programs (smart contracts)
- High-performance applications
- System-level integrations
- Validator/node development
- Rust developers
Choosing the Right SDK
Use the TypeScript SDK when:
- Building web applications or dApps
- Working with Node.js backends
- Integrating Arch Network into existing JavaScript projects
- You need quick development cycles
- Your team is more familiar with JavaScript/TypeScript
Use the Rust SDK when:
- Writing on-chain programs for Arch Network
- Building high-performance applications
- Developing system-level tools or validators
- You need maximum control and efficiency
- Your team is comfortable with Rust
Quick Start Comparison
TypeScript SDK Installation
npm install @saturnbtcio/arch-sdk
# or
yarn add @saturnbtcio/arch-sdk
Rust SDK Installation
# In your Cargo.toml
[dependencies]
arch_sdk = "0.5.4"
Basic Connection Example
TypeScript SDK:
import { Connection, Keypair } from '@saturnbtcio/arch-sdk';
const connection = new Connection('http://localhost:9002');
const keypair = Keypair.generate();
const isReady = await connection.isNodeReady();
console.log('Node ready:', isReady);
Rust SDK:
use arch_sdk::{Connection, Keypair};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let connection = Connection::new("http://localhost:9002");
let keypair = Keypair::new();
let is_ready = connection.is_node_ready().await?;
println!("Node ready: {}", is_ready);
Ok(())
}
Documentation Structure
TypeScript SDK Documentation
- Getting Started with TypeScript SDK
- TypeScript API Reference
- TypeScript Examples
- Web3 Integration Guide
Rust SDK Documentation
Shared Concepts
These concepts apply to both SDKs:
- Pubkey - Public key type for identifying accounts
- Account - Account structure and management
- Instructions and Messages - Transaction building
- Runtime Transaction - Transaction format
- Processed Transaction - Transaction results
- Signature - Digital signatures
Feature Comparison
Feature | TypeScript SDK | Rust SDK |
---|---|---|
Language | TypeScript/JavaScript | Rust |
Installation | npm/yarn | Cargo |
Async Support | Promises/async-await | Tokio async |
Program Development | Client-side only | Full support |
Browser Support | ✅ Full | ❌ No |
Node.js Support | ✅ Full | ✅ Full |
Performance | Good | Excellent |
Type Safety | TypeScript types | Rust type system |
Bundle Size | ~200KB | N/A |
Learning Curve | Moderate | Steep |
Migration Between SDKs
While both SDKs interact with the same Arch Network, they have different APIs and patterns. Here are key differences to consider:
Connection Management
- TypeScript: Uses promise-based async patterns
- Rust: Uses Tokio-based async runtime
Error Handling
- TypeScript: Try-catch with custom error types
- Rust: Result<T, E> pattern with detailed error types
Data Serialization
- TypeScript: JSON and Buffer-based serialization
- Rust: Borsh and custom serialization
Getting Help
TypeScript SDK Support
- Issues: Saturn SDK GitHub Issues
- Documentation: TypeScript SDK Docs
- Examples: TypeScript Examples
Rust SDK Support
- Issues: Arch Network GitHub Issues
- Documentation: Rust SDK Docs
- Examples: Rust Examples
General Support
- Discord: Arch Network Discord
- Forum: Arch Network Forum
- Stack Overflow: Tag with
arch-network
Next Steps
Choose your SDK and get started:
For a general introduction to Arch Network concepts, visit our Getting Started Guide.