Skip to content

Commit 89b77cf

Browse files
committed
docs: add documentation for Stellar contracts and Wraith names registration guides.
1 parent c666c8d commit 89b77cf

4 files changed

Lines changed: 223 additions & 2 deletions

File tree

contracts/stellar.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ const tx = new TransactionBuilder(account, { fee: "100" })
162162

163163
Name to meta-address mapping. Names are hashed via SHA-256 for storage keys.
164164

165+
> [!NOTE]
166+
> For the complete operations guide, including subdomain delegation and privacy implications, see the [Wraith Names on Stellar](/guides/wraith-names-stellar) guide.
167+
165168
### Interface
166169

167170
```rust

docs.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,12 @@
125125
"group": "Operations",
126126
"pages": [
127127
"guides/stellar-mainnet-deployment",
128-
"guides/stellar-multisig-withdrawal"
128+
"guides/stellar-multisig-withdrawal",
129129
"guides/privacy-best-practices",
130130
"guides/spectre-stellar-cookbook",
131131
"guides/stellar-federation",
132-
"guides/stellar-custom-assets"
132+
"guides/stellar-custom-assets",
133+
"guides/wraith-names-stellar"
133134
]
134135
}
135136
]

guides/wraith-names-stellar.mdx

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
---
2+
title: "Wraith Names on Stellar"
3+
description: "Core protocol identity lifecycle: registration, updates, subdomains, and privacy"
4+
---
5+
6+
`.wraith` names act as the core identity layer for the Wraith Protocol on Stellar. They map human-readable names to 64-byte stealth meta-addresses, making it easy to send private payments without dealing with raw keys.
7+
8+
This guide covers the complete lifecycle of a `.wraith` name, from registration to subdomain delegation.
9+
10+
## Naming Rules
11+
12+
To ensure consistency and compatibility across the protocol, names must adhere to the following rules:
13+
- **Length:** 3 to 32 characters.
14+
- **Allowed characters:** Lowercase alphanumeric (`a-z`, `0-9`) only.
15+
- **Top-level domain:** All names are implicitly suffixed with `.wraith` (e.g., `alice` becomes `alice.wraith`).
16+
17+
> [!IMPORTANT]
18+
> **Privacy Implication:** While payments sent to a `.wraith` name use stealth addresses and are completely private, the **names themselves and their meta-address mappings are public**. Anyone can see who owns `alice.wraith`, but they cannot see how much XLM or USDC `alice.wraith` has received.
19+
20+
## Prerequisites: Funding on Stellar
21+
22+
Before interacting with the `wraith-names` Soroban contract, you need a funded Stellar account.
23+
24+
- **Testnet:** The easiest way to fund a new account for testing is using Friendbot. When using the SDK, testnet agent accounts are funded automatically via Friendbot.
25+
- **Mainnet:** You must send at least 1.5 XLM to the agent address to activate the account (Stellar minimum balance) plus some reserves for gas/fees.
26+
27+
## Contract Architecture
28+
29+
The Stellar naming registry is powered by the `wraith-names` Soroban contract. On testnet, the contract is deployed at:
30+
`CDEMB3MAE62ZOCCKZPTYSXR5CS5WVENPOU5MDVK4PNKTZXFVDC74AFBV`
31+
32+
See the [Stellar Contracts reference](/contracts/stellar#wraith-names) for the complete interface and deployment details.
33+
34+
---
35+
36+
## Registration
37+
38+
The registration operation binds an available name to your stealth meta-address.
39+
40+
### SDK Example
41+
42+
```typescript
43+
import { Wraith, Chain } from "@wraith-protocol/sdk";
44+
45+
const wraith = new Wraith({ apiKey: process.env.WRAITH_API_KEY! });
46+
const agent = wraith.agent(process.env.AGENT_ID!);
47+
48+
// Agents automatically handle the registration via Soroban
49+
const tx = await agent.chat("register the name alice on stellar");
50+
console.log(tx.response);
51+
```
52+
53+
### CLI Example
54+
55+
```bash
56+
soroban contract invoke \
57+
--id CDEMB3MAE62ZOCCKZPTYSXR5CS5WVENPOU5MDVK4PNKTZXFVDC74AFBV \
58+
--network testnet \
59+
--source <your-key> \
60+
-- register \
61+
--caller <your-address> \
62+
--name "alice" \
63+
--meta_address <hex-encoded-meta-address>
64+
```
65+
66+
> [!WARNING]
67+
> **Mempool Front-Running:** Stellar's mempool and consensus model (SCP) handles transaction ordering differently than EVM chains, but Soroban transactions are still subject to congestion and inclusion delays. If you are registering a high-value name, be aware that others observing the network may attempt to register the same name if your transaction is delayed.
68+
69+
## Gasless / Delegated Registration
70+
71+
You don't need XLM in your own wallet to register a name. The contract supports a gasless "on-behalf" flow using Soroban's built-in auth framework.
72+
73+
By signing a Soroban auth payload, you can delegate the fee payment to a relayer or the Wraith API, which will submit the transaction and pay the network fees on your behalf.
74+
75+
```typescript
76+
// The Wraith SDK handles delegated registration out-of-the-box
77+
const agent = await wraith.createAgent({
78+
name: "alice", // Automatically uses delegated registration if the agent lacks XLM
79+
chain: Chain.Stellar,
80+
wallet: ownerKeypair.publicKey(),
81+
signature: Buffer.from(signature).toString("hex"),
82+
message: "Sign to create Wraith agent"
83+
});
84+
```
85+
86+
---
87+
88+
## Resolve a Name
89+
90+
Resolving a name returns the 64-byte stealth meta-address associated with it.
91+
92+
### SDK Example
93+
94+
```typescript
95+
const metaAddress = await wraith.resolveName("alice.wraith", Chain.Stellar);
96+
console.log("Resolved meta-address:", metaAddress);
97+
```
98+
99+
### CLI Example
100+
101+
```bash
102+
soroban contract invoke \
103+
--id CDEMB3MAE62ZOCCKZPTYSXR5CS5WVENPOU5MDVK4PNKTZXFVDC74AFBV \
104+
--network testnet \
105+
--source <your-key> \
106+
-- resolve \
107+
--name "alice"
108+
```
109+
110+
---
111+
112+
## Reverse Lookup
113+
114+
You can perform a reverse lookup to find the name associated with a specific meta-address.
115+
116+
### SDK Example
117+
118+
```typescript
119+
const name = await wraith.lookupMetaAddress(metaAddress, Chain.Stellar);
120+
console.log("Associated name:", name); // Returns "alice"
121+
```
122+
123+
### CLI Example
124+
125+
```bash
126+
soroban contract invoke \
127+
--id CDEMB3MAE62ZOCCKZPTYSXR5CS5WVENPOU5MDVK4PNKTZXFVDC74AFBV \
128+
--network testnet \
129+
--source <your-key> \
130+
-- name_of \
131+
--meta_address <hex-encoded-meta-address>
132+
```
133+
134+
---
135+
136+
## Update Meta-Address
137+
138+
If you rotate your keys or want to route payments to a different agent, you can update the meta-address mapping for a name you own.
139+
140+
### SDK Example
141+
142+
```typescript
143+
const update = await agent.chat("update my name mapping to the new meta-address on stellar");
144+
console.log(update.response);
145+
```
146+
147+
### CLI Example
148+
149+
```bash
150+
soroban contract invoke \
151+
--id CDEMB3MAE62ZOCCKZPTYSXR5CS5WVENPOU5MDVK4PNKTZXFVDC74AFBV \
152+
--network testnet \
153+
--source <your-key> \
154+
-- update \
155+
--caller <your-address> \
156+
--name "alice" \
157+
--new_meta_address <new-hex-encoded-meta-address>
158+
```
159+
160+
---
161+
162+
## Release a Name
163+
164+
If you no longer need a name, you can release it, making it available for others to register.
165+
166+
### SDK Example
167+
168+
```typescript
169+
const release = await agent.chat("release the name alice on stellar");
170+
console.log(release.response);
171+
```
172+
173+
### CLI Example
174+
175+
```bash
176+
soroban contract invoke \
177+
--id CDEMB3MAE62ZOCCKZPTYSXR5CS5WVENPOU5MDVK4PNKTZXFVDC74AFBV \
178+
--network testnet \
179+
--source <your-key> \
180+
-- release \
181+
--caller <your-address> \
182+
--name "alice"
183+
```
184+
185+
---
186+
187+
## Subdomain Delegation
188+
189+
> [!NOTE]
190+
> **Upcoming Feature:** Subdomain delegation relies on the v2 hierarchical naming contract, which is shipping in the upcoming Contracts Wave. This section will be fully functional once the release goes live on mainnet.
191+
192+
Hierarchical subdomain delegation allows a parent name owner (e.g., `alice.wraith`) to issue subdomains (e.g., `payments.alice.wraith`) without requiring the subdomain owner to interact with the top-level registry.
193+
194+
This is particularly useful for organizations or applications that want to provide native Wraith identities to their users under their own namespace.
195+
196+
### Delegation Flow
197+
198+
1. The owner of `alice.wraith` sets a **Delegation Resolver** address on their name record.
199+
2. When a user attempts to resolve `payments.alice.wraith`, the SDK automatically detects the subdomain structure.
200+
3. The SDK queries the parent name's Delegation Resolver for the `payments` record.
201+
4. The Delegation Resolver returns the stealth meta-address for `payments.alice.wraith`.
202+
203+
### SDK Example (Upcoming)
204+
205+
```typescript
206+
// 1. Set the delegation resolver for your main name
207+
await agent.chat("set subdomain resolver to CC... on stellar");
208+
209+
// 2. Add a user to your custom resolver
210+
await customResolver.addSubdomain("payments", userMetaAddress);
211+
212+
// 3. Resolving "payments.alice.wraith" will now route through your resolver
213+
const resolved = await wraith.resolveName("payments.alice.wraith", Chain.Stellar);
214+
```
215+
216+
For custom integrations, developers can implement the standard `SubdomainResolver` interface in their own Soroban contracts, allowing for custom logic such as subscription-based names, NFT-gated names, or off-chain resolution using signed attestations.

sdk/chains/stellar.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ This replaces the need to manually query `sorobanServer.getEvents()` and parse X
428428

429429
## See Also
430430

431+
- [Wraith Names on Stellar](/guides/wraith-names-stellar) — core protocol identity lifecycle and subdomains
431432
- [Stellar Multisig Stealth Withdrawals](/guides/stellar-multisig-withdrawal) — coordinate N-of-M signers to authorize withdrawals from a multisig source account
432433
## Federation Address Resolution
433434

0 commit comments

Comments
 (0)