-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickstart-tether.html
More file actions
486 lines (429 loc) · 19.5 KB
/
Copy pathquickstart-tether.html
File metadata and controls
486 lines (429 loc) · 19.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tether WDK Quickstart — Observer Protocol</title>
<meta name="description" content="Add Tether WDK self-custodial wallets to your agent with Observer Protocol identity verification in 25 minutes.">
<link rel="stylesheet" href="shared-styles.css">
<style>
.quickstart-steps {
max-width: 720px;
margin: 0 auto;
}
.step {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 6px;
padding: 1.5rem 2rem;
margin-bottom: 1.5rem;
position: relative;
}
.step-number {
position: absolute;
left: -12px;
top: 1.5rem;
width: 24px;
height: 24px;
background: var(--orange);
color: #000;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: 600;
}
.step h3 {
font-size: 15px;
font-weight: 500;
margin-bottom: 0.75rem;
color: var(--text-primary);
}
.step p {
font-size: 13px;
color: var(--text-secondary);
font-family: var(--font-sans);
line-height: 1.7;
margin-bottom: 1rem;
}
.step pre {
background: var(--bg-2);
border: 1px solid var(--border);
border-radius: 4px;
padding: 1rem;
overflow-x: auto;
font-size: 12px;
margin-bottom: 1rem;
}
.step code {
font-family: var(--font-mono);
color: var(--text-primary);
}
.step .inline-code {
background: var(--bg-2);
padding: 2px 6px;
border-radius: 3px;
font-size: 12px;
}
.info-box {
background: rgba(38, 161, 123, 0.08);
border-left: 2px solid #26A17B;
padding: 1rem 1.25rem;
margin: 1rem 0;
border-radius: 0 4px 4px 0;
}
.info-box p {
margin: 0;
font-size: 12px;
color: var(--text-secondary);
}
.warning-box {
background: rgba(247, 147, 26, 0.08);
border-left: 2px solid var(--orange);
padding: 1rem 1.25rem;
margin: 1rem 0;
border-radius: 0 4px 4px 0;
}
.warning-box p {
margin: 0;
font-size: 12px;
color: var(--text-secondary);
}
.supported-chains {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
margin: 1rem 0;
}
.chain-card {
background: var(--bg-2);
border: 1px solid var(--border);
border-radius: 4px;
padding: 1rem;
text-align: center;
}
.chain-icon {
font-size: 24px;
margin-bottom: 0.5rem;
}
.chain-name {
font-size: 13px;
font-weight: 500;
color: var(--text-primary);
}
.chain-token {
font-size: 11px;
color: var(--text-dim);
margin-top: 0.25rem;
}
.cta-box {
background: var(--bg-2);
border: 1px solid var(--border);
border-radius: 6px;
padding: 1.5rem;
text-align: center;
margin-top: 2rem;
}
.cta-box h3 {
font-size: 15px;
margin-bottom: 0.5rem;
}
.cta-box p {
font-size: 13px;
color: var(--text-secondary);
margin-bottom: 1rem;
}
</style>
</head>
<body>
<nav class="nav">
<a href="index.html" class="nav-logo">Observer Protocol</a>
<ul class="nav-links">
<li><a href="/verify.html">Verify</a></li>
<li><a href="/supervisors.html">Supervisors</a></li>
<li><a href="/architecture.html">Architecture</a></li>
<li><a href="/docs.html">Docs</a></li>
<li><a href="/registry.html">Registry</a></li>
<li><a href="/agentic-terminal.html">Agentic Terminal</a></li>
</ul>
</nav>
<div class="page">
<section style="padding: 3rem 0 1rem;">
<div class="container">
<div class="section-label">Quickstart</div>
<h1 style="font-size:clamp(1.6rem,4vw,2.4rem);font-weight:600;margin-bottom:1rem;">Tether WDK + Observer Protocol</h1>
<p style="font-size:14px;color:var(--text-secondary);max-width:600px;font-family:var(--font-sans);line-height:1.8;">
Add self-custodial USDT (Ethereum/Polygon) and Bitcoin wallets to your agent with full Observer Protocol identity verification. ~25 minutes.
</p>
<div style="margin-top: 1.5rem; max-width: 720px; padding: 0.9rem 1.1rem; border: 1px solid var(--amber, #f5a623); border-radius: 6px; background: rgba(245, 166, 35, 0.05); font-family: var(--font-sans); font-size: 13px; line-height: 1.7;">
<strong style="color: var(--amber, #f5a623); font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;">v0.2.0-beta.4 · June 2026</strong><br/>
<code>@observer-protocol/wdk-protocol-trust@0.2.0-beta.4</code> now ships the <strong>AIP v0.8 spending-mandate surface</strong> alongside the bilateral-handshake flow below. The new four-call pattern — <code>verifyMandate</code> → <code>withinScope</code> → <code>wallet.send</code> → <code>attest</code> — lets a WDK agent verify a signed delegation credential, gate a proposed spend against its actionScope (per-tx ceiling, allowed rails, allowed categories, authorization-level rules), and emit a portable settlement attestation. See the runnable <a href="https://github.com/observer-protocol/wdk-protocol-trust/blob/master/examples/mandate-flow.mjs" style="color: var(--amber, #f5a623);">examples/mandate-flow.mjs</a> and the <a href="https://github.com/observer-protocol/wdk-protocol-trust#aip-v08-mandate-surface-new-in-020" style="color: var(--amber, #f5a623);">README §AIP v0.8 mandate surface</a>. Steps below cover the v0.1-era handshake surface, which continues to ship alongside the v0.2 mandate surface — pick the one that matches your flow.<br/><br/>For pre-sign policy enforcement on the now-merged WDK #55 hook, use <code>@observer-protocol/wdk-op-policy</code> (the local transaction policy engine adapter): it registers an ALLOW plus a mandatory fail-closed DENY and refuses an out-of-mandate spend before the key signs. Live demo: <a href="/wdk" style="color: var(--amber, #f5a623);">observerprotocol.org/wdk</a>.
</div>
</div>
</section>
<section style="padding: 2rem 0;">
<div class="container">
<div class="supported-chains" style="max-width: 600px; margin: 0 auto 2rem;">
<div class="chain-card">
<div class="chain-icon">⟠</div>
<div class="chain-name">Ethereum</div>
<div class="chain-token">USDT</div>
</div>
<div class="chain-card">
<div class="chain-icon">⬡</div>
<div class="chain-name">Polygon</div>
<div class="chain-token">USDT</div>
</div>
<div class="chain-card">
<div class="chain-icon">₿</div>
<div class="chain-name">Bitcoin</div>
<div class="chain-token">BTC</div>
</div>
</div>
<div class="quickstart-steps">
<!-- Step 1 -->
<div class="step">
<div class="step-number">1</div>
<h3>Install Dependencies</h3>
<p>Install the WDK packages and the Observer Protocol WDK adapter:</p>
<pre><code>npm install @tetherto/wdk @tetherto/wdk-wallet-evm @tetherto/wdk-wallet-btc
npm install @observer-protocol/wdk-op-policy</code></pre>
<div class="info-box">
<p><strong>Changed 2026-08-03.</strong> This step used to say <code class="inline-code">@observerprotocol/sdk</code>,
which is a different npm scope, deprecated and unmaintained since April. The adapter above is the
package this quickstart actually uses, and it is the one under active release.</p>
</div>
<div class="info-box">
<p><strong>Note:</strong> The WDK uses native modules for cryptography. Make sure you have Python and build tools installed. On most systems: <code class="inline-code">npm install -g node-gyp</code></p>
</div>
</div>
<!-- Step 2 -->
<div class="step">
<div class="step-number">2</div>
<h3>Generate or Import Seed Phrase</h3>
<p>The WDK uses BIP-39 seed phrases for deterministic key generation. You can generate a new one or import an existing mnemonic:</p>
<div class="info-box" style="border-left:2px solid #f87171;">
<p><strong>Unverified, 8 August 2026.</strong> This example imported <code class="inline-code">AgentWallet</code> from
<code class="inline-code">@observerprotocol/sdk</code> — the scope Step 1's own correction above removes. So the page
installed one set of packages and imported from another, in a scope it flags as wrong fifteen lines earlier.
The import has been removed rather than repointed: no Observer Protocol package we publish exports
<code class="inline-code">AgentWallet</code>, and guessing a replacement would repeat the mistake.
<strong>Treat the block below as illustrative until the correct import is established.</strong></p>
</div>
<pre><code>// import { AgentWallet } from '<unresolved — see note above>';
// Generate new seed phrase (save this securely!)
const seedPhrase = AgentWallet.generateSeedPhrase();
console.log('Seed phrase:', seedPhrase);
// → "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
// Or use existing seed
const wallet = new AgentWallet({
seedPhrase: process.env.WDK_SEED_PHRASE,
agentId: 'my-agent-001',
alias: 'trading-bot-alpha'
});</code></pre>
<div class="warning-box">
<p><strong>⚠️ Security:</strong> Store your seed phrase in a secure environment variable. Never commit it to code. The WDK keeps private keys in memory only — no external storage.</p>
</div>
</div>
<!-- Step 3 -->
<div class="step">
<div class="step-number">3</div>
<h3>Initialize Wallets</h3>
<p>Initialize wallets for the chains you need. Each chain is initialized on-demand:</p>
<pre><code>// Initialize WDK
await wallet.initializeWDK();
// Initialize Ethereum wallet (for USDT on Ethereum)
const ethWallet = await wallet.initWallet('ethereum', {
provider: process.env.ETHEREUM_RPC_URL // Optional, defaults to public RPC
});
// Initialize Polygon wallet (for USDT on Polygon - lower fees!)
const polyWallet = await wallet.initWallet('polygon', {
provider: process.env.POLYGON_RPC_URL
});
// Initialize Bitcoin wallet
const btcWallet = await wallet.initWallet('bitcoin', {
host: 'bitcoin.lukechilds.co',
port: 50001,
protocol: 'tcp'
});
console.log('ETH address:', ethWallet.address);
console.log('BTC address:', btcWallet.address);</code></pre>
</div>
<!-- Step 4 -->
<div class="step">
<div class="step-number">4</div>
<h3>Register with Observer Protocol</h3>
<p>Register your agent to establish identity and enable bilateral verification:</p>
<pre><code>import crypto from 'crypto';
// Generate a keypair for Observer Protocol identity
// (This is separate from your wallet keys for security isolation)
const identityKey = crypto.generateKeyPairSync('ec', { namedCurve: 'secp256k1' });
const publicKeyHash = crypto
.createHash('sha256')
.update(identityKey.publicKey.export({ format: 'der', type: 'spki' }))
.digest('hex');
// Register agent
await wallet.register({
alias: 'trading-bot-alpha',
publicKeyHash: publicKeyHash,
metadata: {
description: 'USDT payment agent',
supportedChains: ['ethereum', 'polygon', 'bitcoin'],
wdkEnabled: true
}
});
console.log('✅ Agent registered on Observer Protocol');</code></pre>
</div>
<!-- Step 5 -->
<div class="step">
<div class="step-number">5</div>
<h3>Send Verified Payments</h3>
<p>Send payments with automatic bilateral identity verification. Both sender and recipient must be registered on Observer Protocol:</p>
<pre><code>// Check if recipient is verified
const recipientCheck = await wallet.checkRecipient('merchant-bot-beta');
console.log('Recipient verified:', recipientCheck.verified);
// Send USDT on Polygon (fast, cheap)
const payment = await wallet.verifiedSend({
recipientAlias: 'merchant-bot-beta',
amount: '10.00', // 10 USDT
chain: 'polygon',
token: 'USDT'
});
console.log('Payment result:', payment);
// {
// success: true,
// verification: { alias, publicKeyHash, ... },
// payment: { txid, status, amount, recipient, chain, ... }
// }</code></pre>
<div class="info-box">
<p><strong>Bilateral Verification:</strong> The recipient's identity is verified before payment executes. The payment object includes both the transaction hash and the verification proof.</p>
</div>
</div>
<!-- Step 6 -->
<div class="step">
<div class="step-number">6</div>
<h3>Verify a delegation, gate the spend, and attest the settlement (AIP v0.8)</h3>
<p>For agents acting under a signed delegation credential — the typical pattern for autonomous machine commerce — use <code>@observer-protocol/wdk-protocol-trust</code> v0.2.0-beta.4 to verify the delegation, gate the proposed spend against its <code>actionScope</code>, and emit a portable settlement attestation. Four method calls. OP never touches funds.</p>
<pre><code>npm install @observer-protocol/wdk-protocol-trust</code></pre>
<pre><code>import ObserverTrustProtocol from '@observer-protocol/wdk-protocol-trust';
const op = new ObserverTrustProtocol(wallet, {
trustedIssuers: ['did:web:observerprotocol.org'],
attestationKey, // 32-byte Ed25519 secret. DISTINCT from the WDK wallet key.
// gate: optional — defaults to AdvisoryGate (client-side gating).
// WdkPolicyHookGate rides the merged WDK PR #55 policy hook (see @observer-protocol/wdk-op-policy).
});
// 1. Verify the delegation credential (did:web resolve, Ed25519Signature2026,
// schema allowlist pinned to delegation/v2.1.json, validity window).
const mandate = await op.verifyMandate(agentCredential);
// 2. Gate the proposed action against actionScope. Pure, I/O-free:
// rail / per_transaction_ceiling (same-currency only, no FX) /
// allowed_transaction_categories / authorizationLevel-gated rules.
const proposedAction = {
rail: 'usdt_tron',
amount: { amount: '10', currency: 'USDT' },
category: 'ai_inference_credits',
counterparty_did: 'did:web:vendor.example:agents:store'
};
const decision = await op.withinScope(proposedAction, mandate);
if (!decision.allow) {
throw new Error('mandate violation: ' + JSON.stringify(decision.reasons));
}
// 3. WDK executes settlement. OP never touches funds.
const tx = await wallet.send(/* … */);
// 4. Sign a portable ObserverSettlementAttestation binding
// {delegation hash, action, settlement ref, evaluator, timestamp}
// with the agent's attestation key (Ed25519Signature2026).
const attestation = await op.attest({
credential: agentCredential,
action: proposedAction,
settlement: { rail: 'usdt_tron', ref: tx.id }
});
console.log('✅ Settlement attested:', attestation.id);</code></pre>
<div class="info-box">
<p><strong>cumulative_budget, allowed_counterparty_types, geographic_restriction</strong> are reserved as <em>advisory</em> in AIP v0.8 — verifiers surface them but they never ground a deny. Binding semantics for each are reserved for a future draft. See the runnable <a href="https://github.com/observer-protocol/wdk-protocol-trust/blob/master/examples/mandate-flow.mjs" style="color:var(--orange);">examples/mandate-flow.mjs</a> for the full self-contained flow including a self-issued demo credential.</p>
</div>
</div>
<!-- Step 7 -->
<div class="step">
<div class="step-number">7</div>
<h3>Direct Send (No Verification)</h3>
<p>For payments to non-registered addresses, use direct send:</p>
<pre><code>// Send to any address (no OP verification)
const result = await wallet.send({
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
amount: '5.00',
chain: 'ethereum',
token: 'USDT'
});
console.log('Transaction hash:', result.hash);
// Send Bitcoin
const btcResult = await wallet.send({
to: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
amount: '0.001',
chain: 'bitcoin'
});
console.log('BTC txid:', btcResult.txid);</code></pre>
</div>
<!-- Step 8 -->
<div class="step">
<div class="step-number">8</div>
<h3>Mainnet Beta Checklist</h3>
<p>Before deploying to mainnet beta:</p>
<ul style="font-size: 13px; color: var(--text-secondary); line-height: 1.8; margin-left: 1.5rem;">
<li>Use your own RPC endpoints (avoid public nodes for mainnet beta)</li>
<li>Get API keys from Etherscan/Polygonscan for verification</li>
<li>Store seed phrases in secure environment variables or KMS</li>
<li>Set up monitoring for transaction status</li>
<li>Implement retry logic for failed transactions</li>
<li>Consider using Polygon for USDT (much lower fees than Ethereum)</li>
<li>Test on Sepolia testnet first: <code class="inline-code">USDT_CONTRACTS.sepolia</code></li>
</ul>
</div>
</div>
<div class="cta-box">
<h3>Need Help?</h3>
<p>Join the Observer Protocol community for support, share your implementation, or contribute to the SDK.</p>
<div style="display: flex; gap: 1rem; justify-content: center;">
<a href="https://github.com/observer-protocol" class="btn btn-primary" target="_blank">GitHub →</a>
<a href="https://agenticterminal.io" class="btn btn-outline">Open Agentic Terminal →</a>
</div>
</div>
</div>
</section>
</div>
<footer class="footer">
<div class="container">
<div class="footer-grid">
<div>
<div class="footer-brand">Observer Protocol</div>
<p style="font-size:12px;color:var(--text-dim);margin-top:0.5rem;font-family:var(--font-sans);">The trust layer for the agentic economy.</p>
</div>
<div>
<div style="font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.08em;margin-bottom:0.75rem;">Quickstart</div>
<ul style="list-style:none;">
<li><a href="quickstart-lightning.html" class="footer-link">⚡ Lightning Wallet</a></li>
<li><a href="quickstart-tether.html" class="footer-link">₮ Tether WDK</a></li>
<li><a href="quickstart-x402.html" class="footer-link">◈ x402 / L402</a></li>
</ul>
</div>
<div>
<div style="font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.08em;margin-bottom:0.75rem;">Docs</div>
<ul style="list-style:none;">
<li><a href="api.html" class="footer-link">API Reference</a></li>
<li><a href="sdk.html" class="footer-link">SDK</a></li>
<li><a href="architecture.html" class="footer-link">Architecture</a></li>
</ul>
</div>
<div>
<div style="font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.08em;margin-bottom:0.75rem;">Community</div>
<ul style="list-style:none;">
<li><a href="https://github.com/observer-protocol" target="_blank" class="footer-link">GitHub</a></li>
<li><a href="registry.html" class="footer-link">Registry</a></li>
</ul>
</div>
</div>
</div>
</footer>
</body>
</html>