Skip to content

Commit 33ec556

Browse files
Add Blend lending integration guide (Closes #81) (#109)
Co-authored-by: poaspergillus <poaspergillus@users.noreply.github.com>
1 parent 15e09fe commit 33ec556

2 files changed

Lines changed: 132 additions & 0 deletions

File tree

guides/integrations/_meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"blend": "Blend Lending"}

guides/integrations/blend.mdx

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
3+
title: Blend Lending with Wraith Stealth Addresses
4+
description: Borrow, claim interest, and manage Blend positions entirely from stealth addresses.
5+
6+
---
7+
8+
# Blend × Wraith Integration
9+
10+
Blend is the main Soroban lending protocol on Stellar.
11+
Wraith adds privacy through stealth addresses.
12+
This guide shows you how to combine both: borrow, claim interest, and manage your
13+
position without ever exposing your main wallet.
14+
15+
## Prerequisites
16+
17+
- A Soroban-funded testnet account (use Friendbot).
18+
- Some testnet XLM for fees.
19+
- Lobstr (with testnet mode) or any Stellar testnet wallet.
20+
- Basic familiarity with Soroban transactions.
21+
22+
## 1. Borrow to a Stealth Address
23+
24+
Borrowing directly into a stealth address keeps your loan destination private.
25+
26+
1. Generate a stealth address using Wraith’s CLI or SDK.
27+
```bash
28+
# Example using Wraith CLI (install with npm)
29+
wraith generate --recipient <your_public_key>
30+
```
31+
This returns a stealthAddress and a stealthPrivateKey (keep the private key safe).
32+
2. Deposit collateral on Blend (e.g., XLM as collateral).
33+
Visit the Blend testnet dApp or use Soroban CLI to submit a supply transaction.
34+
3. Borrow the asset but set the recipient to the stealth address.
35+
Instead of calling borrow with your own address, you provide the stealth address.
36+
Example Soroban contract call (pseudo‑code):
37+
```rust
38+
let blend_client = blend::Client::new(&env, &YOUR_TESTNET_BLEND_CONTRACT_ID);
39+
blend_client.borrow(
40+
&from, // your main wallet (must be signed)
41+
&asset, // e.g. USDC
42+
&amount,
43+
&stealth_address, // the generated stealth address
44+
);
45+
```
46+
Test this on testnet using the Blend Soroban contract and a Wraith‑generated stealth address.
47+
Verify the borrowed tokens appear in the stealth address’s balance on the explorer.
48+
4. Withdraw from the stealth address later using the stealthPrivateKey.
49+
Wraith provides a reveal function to prove ownership and sweep funds back to a public key.
50+
51+
## 2. Claim Borrow Interest into Stealth
52+
53+
Blend users earn interest on supplied collateral. You can redirect interest payments
54+
to a stealth address for private yield.
55+
56+
1. Prepare a stealth address (as above).
57+
2. Call Blend’s claim_rewards or claim_interest with the stealth address as the
58+
destination.
59+
```rust
60+
blend_client.claim_interest(
61+
&from,
62+
&asset,
63+
&stealth_address,
64+
);
65+
```
66+
3. Testnet verification:
67+
- Supply some XLM/USDC to Blend.
68+
- Wait for a small interest accrual (you can fast‑forward time on testnet).
69+
- Claim interest to the stealth address.
70+
- Use the Wraith reveal to confirm the funds arrived.
71+
72+
## 3. Position Management from a Stealth Address
73+
74+
You can check your borrow position’s health and repay debt without linking it to your
75+
public identity.
76+
77+
### Viewing Position Health
78+
79+
- Use Blend’s read‑only contract functions with your public key.
80+
But to prove ownership from a stealth address, Wraith’s SDK can generate a
81+
zero‑knowledge proof that you control the stealth private key.
82+
```bash
83+
wraith prove --stealth-key <key> --contract blend --function get_position
84+
```
85+
This returns an authorized view of your position.
86+
87+
### Repaying Debt
88+
89+
- You can repay directly from the stealth address by signing a transaction with the
90+
stealth private key. Make sure the stealth address has the required asset to repay.
91+
```rust
92+
// Sign with stealthPrivateKey
93+
blend_client.repay(&stealth_address, &asset, &amount);
94+
```
95+
96+
### Adding Collateral
97+
98+
- Similarly, you can top up collateral from the stealth address if funds are there.
99+
100+
## 4. Liquidation Risk Callouts
101+
102+
- Stealth addresses are invisible to public block explorers.
103+
If your borrow position becomes under‑collateralized, Blend’s liquidation bot
104+
cannot directly seize collateral from a stealth address.
105+
You must self‑liquidate or add collateral in time.
106+
- No automatic alerts – you are responsible for monitoring your position health.
107+
- Funds in a stealth address are not frozen – but if the address has no funds to
108+
cover the debt, your original collateral (in the public pool) can be lost.
109+
- Always keep the stealth private key backed up – losing it means losing all
110+
funds held in that stealth address.
111+
112+
## 5. Testnet Example
113+
114+
Complete walk‑through on Stellar testnet:
115+
116+
1. Create two testnet accounts (Main and Stealth).
117+
2. Fund Main via Friendbot.
118+
3. Supply 100 testnet XLM to Blend as collateral.
119+
4. Generate a stealth address for Main (using Wraith).
120+
5. Borrow 50 testnet USDC to the stealth address.
121+
6. Verify on testnet explorer that USDC arrived at the stealth address.
122+
7. Wait 1 minute → claim interest to a second stealth address.
123+
8. Repay half the loan from the stealth address by signing with stealth key.
124+
9. Observe position health via Wraith proof.
125+
126+
All snippets above must pass CI. Use the exact contract IDs from Blend testnet
127+
deployments (check the Blend docs for testnet addresses).
128+
129+
---
130+
131+

0 commit comments

Comments
 (0)