Arch Network Logo
APIs and Tools

SDK Reference

Complete guide to Arch Network SDKs for building applications and programs

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

Rust SDK Documentation

Feature Comparison

FeatureTypeScript SDKRust SDK
Connection Management
Account Operations
Transaction Building
Program Deployment
UTXO Management
Bitcoin Integration
Web3 Compatibility
Browser Support
Node.js Support
On-chain Programs
System Integration
PerformanceGoodExcellent
Learning CurveEasyModerate

Common Use Cases

Web Application Development

For building web applications, the TypeScript SDK is the clear choice:

import { Connection, Keypair, Transaction } from '@saturnbtcio/arch-sdk';

// Connect to Arch Network
const connection = new Connection('http://localhost:9002');
const keypair = Keypair.generate();

// Create and send a transaction
const transaction = new Transaction();
transaction.addInstruction(/* your instruction */);

const signature = await connection.sendTransaction(transaction, [keypair]);
console.log('Transaction signature:', signature);

Smart Contract Development

For writing on-chain programs, use the Rust SDK:

use arch_sdk::prelude::*;

#[program]
pub mod my_program {
    use super::*;

    pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
        // Your program logic here
        Ok(())
    }
}

#[derive(Accounts)]
pub struct Initialize<'info> {
    // Your account definitions here
}

Backend Services

Both SDKs can be used for backend services, depending on your requirements:

TypeScript SDK (Node.js):

import { Connection } from '@saturnbtcio/arch-sdk';

const connection = new Connection('http://localhost:9002');

// Monitor transactions
connection.onTransaction((tx) => {
    console.log('New transaction:', tx);
});

Rust SDK:

use arch_sdk::{Connection, Event};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let connection = Connection::new("http://localhost:9002");
    
    // Monitor events
    let mut events = connection.subscribe_events().await?;
    while let Some(event) = events.next().await {
        println!("New event: {:?}", event);
    }
    
    Ok(())
}

Migration Guide

From Solana SDKs

If you're coming from Solana development, both SDKs provide familiar patterns:

TypeScript (Solana → Arch):

// Solana
import { Connection } from '@solana/web3.js';

// Arch Network
import { Connection } from '@saturnbtcio/arch-sdk';

Rust (Solana → Arch):

// Solana
use solana_program::prelude::*;

// Arch Network
use arch_sdk::prelude::*;

From Bitcoin Libraries

For Bitcoin developers, the Rust SDK provides familiar UTXO patterns:

use arch_sdk::{Utxo, Transaction, BitcoinAddress};

// Create a Bitcoin transaction
let utxo = Utxo::new(/* utxo data */);
let transaction = Transaction::new()
    .add_input(utxo)
    .add_output(/* output */);

Performance Considerations

TypeScript SDK

  • Pros: Easy to use, great for rapid development
  • Cons: Higher overhead, not suitable for high-frequency operations
  • Best for: Web apps, prototypes, moderate transaction volumes

Rust SDK

  • Pros: High performance, low overhead, full feature access
  • Cons: Steeper learning curve, longer development time
  • Best for: High-performance apps, validators, system tools

Getting Help

TypeScript SDK Support

Rust SDK Support

Next Steps

Resources