Skip to content
Arch-NetworkPublic

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1,708 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Satellite

Smart Contract Framework for Arch Network

Build Status Docs License

Overview

Satellite is Arch Network's smart contract framework, forked from Solana's Anchor and adapted for building programs on the Arch Bitcoin L2. It maintains ~95% code compatibility with Anchor while adding Bitcoin-native capabilities.

Satellite enables developers to:

  • Write Arch programs using familiar Anchor-style Rust macros
  • Leverage the same account validation and serialization patterns
  • Access Bitcoin integration through Arch's syscalls
  • Port existing Solana programs with minimal changes

Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│                              SATELLITE FRAMEWORK                             │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ┌──────────────────┐    ┌──────────────────┐    ┌──────────────────┐       │
│  │ arch-satellite-  │    │ arch-satellite-  │    │  anchor-client   │       │
│  │      lang        │    │      apl         │    │                  │       │
│  │                  │    │                  │    │                  │       │
│  │ • #[program]     │    │ • Token CPI      │    │ • RPC Client     │       │
│  │ • #[account]     │    │ • ATA CPI        │    │ • Account Fetch  │       │
│  │ • #[derive]      │    │ • Mint/Burn      │    │ • Tx Builder     │       │
│  │ • Context<T>     │    │ • Transfer       │    │ • IDL Support    │       │
│  └────────┬─────────┘    └────────┬─────────┘    └────────┬─────────┘       │
│           │                       │                       │                  │
│           ▼                       ▼                       ▼                  │
│  ┌──────────────────────────────────────────────────────────────────┐       │
│  │                         ARCH RUNTIME                              │       │
│  │                                                                   │       │
│  │   • eBPF/SBF Execution        • Bitcoin Syscalls                 │       │
│  │   • Account Model             • FROST Threshold Signatures       │       │
│  │   • Cross-Program Invocation  • UTXO Validation                  │       │
│  └──────────────────────────────────────────────────────────────────┘       │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

Key Differences from Anchor

Feature Anchor (Solana) Satellite (Arch)
Import anchor_lang arch_satellite_lang
SPL Tokens anchor_spl arch_satellite_apl
Program ID Base58 string 64-char hex
Token Interface InterfaceAccount<Mint> Account<Mint>
Bitcoin Integration N/A Native syscalls
Network Solana Arch (Bitcoin L2)

Packages

Package Description Purpose
arch-satellite-lang Core framework with macros and types Writing Arch programs
arch-satellite-apl CPI clients for token programs Token operations
anchor-client Rust client for Arch programs Off-chain interactions

Quick Start

Installation

Add to your Cargo.toml:

[dependencies]
arch-satellite-lang = "0.31"
arch-satellite-apl = "0.31"  # If using tokens

Example: Counter Program

use arch_satellite_lang::prelude::*;

declare_id!("da075cb2ff5ec6817613de530b692a8735477769da47430cbd8154335c4a8327");

#[program]
mod counter {
    use super::*;

    pub fn initialize(ctx: Context<Initialize>, start: u64) -> Result<()> {
        let counter = &mut ctx.accounts.counter;
        counter.authority = *ctx.accounts.authority.key;
        counter.count = start;
        Ok(())
    }

    pub fn increment(ctx: Context<Increment>) -> Result<()> {
        let counter = &mut ctx.accounts.counter;
        counter.count += 1;
        Ok(())
    }
}

#[derive(Accounts)]
pub struct Initialize<'info> {
    #[account(init, payer = authority, space = 48)]
    pub counter: Account<'info, Counter>,
    pub authority: Signer<'info>,
    pub system_program: Program<'info, System>,
}

#[derive(Accounts)]
pub struct Increment<'info> {
    #[account(mut, has_one = authority)]
    pub counter: Account<'info, Counter>,
    pub authority: Signer<'info>,
}

#[account]
pub struct Counter {
    pub authority: Pubkey,
    pub count: u64,
}

Building

# Build the program
cargo-build-sbf

# Or with cargo
cargo build --release

Migrating from Anchor

Import Changes

// BEFORE (Anchor)
use anchor_lang::prelude::*;
use anchor_spl::token::*;

// AFTER (Satellite)
use arch_satellite_lang::prelude::*;
use arch_satellite_apl::token::*;

Program ID Format

// Anchor (Base58)
declare_id!("BmDHboaj1kBUoinJKKSRqKfMeRKJqQqEbUj1VgzeQe4A");

// Satellite (Hex - 64 chars)
declare_id!("da075cb2ff5ec6817613de530b692a8735477769da47430cbd8154335c4a8327");

Token Interface Types

// Anchor
pub mint: InterfaceAccount<'info, Mint>,
pub token_program: Interface<'info, TokenInterface>,

// Satellite
pub mint: Account<'info, Mint>,
pub token_program: Program<'info, Token>,

Automated Migration

Use the anchor-to-satellite CLI tool:

# Analyze what will change
a2s analyze --path ./my-anchor-program

# Convert to new directory
a2s convert --source ./my-anchor-program --output ./my-arch-satellite-program

# Convert in-place (creates backup)
a2s convert-in-place --path ./my-anchor-program --backup

Bitcoin Integration

Satellite programs can interact with Bitcoin through Arch's syscalls:

use arch_satellite_lang::prelude::*;

#[program]
mod bitcoin_aware {
    use super::*;

    pub fn verify_btc_tx(ctx: Context<Verify>, txid: [u8; 32]) -> Result<()> {
        // Fetch Bitcoin transaction data
        let btc_tx = arch_get_bitcoin_tx(&txid)?;

        // Validate UTXO ownership
        arch_validate_utxo_ownership(&utxo, &owner)?;

        // Get network's FROST public key
        let network_pubkey = arch_get_network_xonly_pubkey()?;

        Ok(())
    }
}

Available Syscalls

Syscall Description Cost
arch_get_bitcoin_tx Fetch Bitcoin transaction 10,000 CU
arch_get_network_xonly_pubkey Get network FROST key 100 CU
arch_set_transaction_to_sign Queue tx for signing 5,000 CU
arch_validate_utxo_ownership Validate UTXO owner 1,000 CU

Project Structure

satellite/
├── lang/                    # arch-satellite-lang crate
│   ├── src/
│   │   ├── lib.rs          # Core exports
│   │   ├── accounts.rs     # Account types
│   │   ├── context.rs      # Context<T> implementation
│   │   └── error.rs        # Error handling
│   └── attribute/          # Procedural macros
│       ├── program/        # #[program] macro
│       └── account/        # #[account] macro
├── spl/                     # arch-satellite-apl crate
│   └── src/
│       ├── token.rs        # Token program CPI
│       ├── associated_token.rs
│       └── metadata.rs
├── client/                  # anchor-client crate
│   └── src/
│       └── lib.rs          # RPC client
└── docs/                    # Documentation
    ├── SATELLITE_MIGRATION_GUIDE.md
    ├── QUICK_REFERENCE.md
    └── TROUBLESHOOTING.md

Documentation

Related Projects

Project Description
Arch Network Core validator and runtime
anchor-to-satellite Automated conversion tool
arch-bridge Cross-chain bridge
Anchor Original Solana framework

License

Satellite is licensed under Apache 2.0.

This project is a fork of Anchor by Coral. We thank the Anchor team and contributors for their foundational work.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages