Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions stellar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Stellar Contracts — Wraith Protocol

This directory contains the Soroban smart contracts for the Wraith multichain stealth address platform.

## Contracts

- `stealth-announcer`: Emits announcement events for stealth payments.
- `stealth-registry`: Maps addresses to 64-byte stealth meta-addresses.
- `stealth-sender`: Handles atomic transfers and announcements.
- `wraith-names`: Privacy-preserving name registry for `.wraith` names.

## Prerequisites

- [Rust](https://rustup.rs/) and `wasm32-unknown-unknown` target.
- [Soroban CLI](https://soroban.stellar.org/docs/getting-started/setup#install-the-soroban-cli).

## Build

To build all contracts:

```bash
cargo build --target wasm32-unknown-unknown --release
```

## Test

To run tests for all contracts:

```bash
cargo test
```

## Deployment

A deployment script is provided to deploy all contracts in one go.

### 1. Configure Identities and Networks

```bash
# Add an identity (if not already done)
soroban config identity add --secret-key my-deployer

# Add a network (if not already done)
soroban config network add --rpc-url https://soroban-testnet.stellar.org:443 --network-passphrase "Test SDF Network ; September 2015" testnet
```

### 2. Run Deployment Script

```bash
./deploy.sh testnet my-deployer
```

The script will deploy all contracts and initialize the `stealth-sender` with the `stealth-announcer` ID.
66 changes: 66 additions & 0 deletions stellar/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

# Stellar Deployment Script for Wraith Protocol
# Usage: ./deploy.sh [testnet|futurenet|mainnet] [secret-key-name]

NETWORK=$1
IDENTITY=$2

if [[ -z "$NETWORK" || -z "$IDENTITY" ]]; then
echo "Usage: ./deploy.sh [testnet|futurenet|mainnet] [secret-key-name]"
exit 1
fi

echo "🚀 Deploying Wraith Protocol to $NETWORK using $IDENTITY..."

# 1. Deploy stealth-announcer
echo "--- Deploying stealth-announcer ---"
ANNOUNCER_ID=$(soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/stealth_announcer.wasm \
--source $IDENTITY \
--network $NETWORK)
echo "✅ stealth-announcer: $ANNOUNCER_ID"

# 2. Deploy stealth-registry
echo "--- Deploying stealth-registry ---"
REGISTRY_ID=$(soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/stealth_registry.wasm \
--source $IDENTITY \
--network $NETWORK)
echo "✅ stealth-registry: $REGISTRY_ID"

# 3. Deploy stealth-sender
echo "--- Deploying stealth-sender ---"
SENDER_ID=$(soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/stealth_sender.wasm \
--source $IDENTITY \
--network $NETWORK)
echo "✅ stealth-sender: $SENDER_ID"

# Initialize stealth-sender with announcer ID
echo "Initializing stealth-sender..."
soroban contract invoke \
--id $SENDER_ID \
--source $IDENTITY \
--network $NETWORK \
-- \
init \
--admin $IDENTITY \
--announcer $ANNOUNCER_ID

# 4. Deploy wraith-names
echo "--- Deploying wraith-names ---"
NAMES_ID=$(soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/wraith_names.wasm \
--source $IDENTITY \
--network $NETWORK)
echo "✅ wraith-names: $NAMES_ID"

echo ""
echo "🎉 Deployment Complete!"
echo "--------------------------------------"
echo "Announcer: $ANNOUNCER_ID"
echo "Registry: $REGISTRY_ID"
echo "Sender: $SENDER_ID"
echo "Names: $NAMES_ID"
echo "--------------------------------------"