@genobank/biofs 1.8.2 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +120 -171
  2. package/dist/commands/biofiles.d.ts +9 -0
  3. package/dist/commands/biofiles.d.ts.map +1 -0
  4. package/dist/commands/biofiles.js +112 -0
  5. package/dist/commands/biofiles.js.map +1 -0
  6. package/dist/commands/labs/list.d.ts +19 -0
  7. package/dist/commands/labs/list.d.ts.map +1 -0
  8. package/dist/commands/labs/list.js +98 -0
  9. package/dist/commands/labs/list.js.map +1 -0
  10. package/dist/commands/share.d.ts +10 -0
  11. package/dist/commands/share.d.ts.map +1 -0
  12. package/dist/commands/share.js +186 -0
  13. package/dist/commands/share.js.map +1 -0
  14. package/dist/commands/verify.d.ts +9 -0
  15. package/dist/commands/verify.d.ts.map +1 -0
  16. package/dist/commands/verify.js +138 -0
  17. package/dist/commands/verify.js.map +1 -0
  18. package/dist/index.js +99 -42
  19. package/dist/index.js.map +1 -1
  20. package/dist/lib/ai/classifier.d.ts +1 -3
  21. package/dist/lib/ai/classifier.d.ts.map +1 -1
  22. package/dist/lib/ai/classifier.js +17 -37
  23. package/dist/lib/ai/classifier.js.map +1 -1
  24. package/dist/lib/api/client.d.ts +46 -0
  25. package/dist/lib/api/client.d.ts.map +1 -1
  26. package/dist/lib/api/client.js +159 -19
  27. package/dist/lib/api/client.js.map +1 -1
  28. package/dist/lib/auth/server.d.ts.map +1 -1
  29. package/dist/lib/auth/server.js +2 -11
  30. package/dist/lib/auth/server.js.map +1 -1
  31. package/dist/lib/biofiles/fingerprint.d.ts.map +1 -1
  32. package/dist/lib/biofiles/fingerprint.js +11 -40
  33. package/dist/lib/biofiles/fingerprint.js.map +1 -1
  34. package/dist/lib/biofiles/resolver.d.ts.map +1 -1
  35. package/dist/lib/biofiles/resolver.js +59 -75
  36. package/dist/lib/biofiles/resolver.js.map +1 -1
  37. package/dist/lib/config/constants.d.ts +1 -0
  38. package/dist/lib/config/constants.d.ts.map +1 -1
  39. package/dist/lib/config/constants.js +3 -3
  40. package/dist/lib/config/constants.js.map +1 -1
  41. package/dist/lib/utils/logger.d.ts +5 -6
  42. package/dist/lib/utils/logger.d.ts.map +1 -1
  43. package/dist/lib/utils/logger.js +5 -23
  44. package/dist/lib/utils/logger.js.map +1 -1
  45. package/dist/types/api.d.ts +21 -0
  46. package/dist/types/api.d.ts.map +1 -1
  47. package/dist/types/biofiles.d.ts +2 -2
  48. package/dist/types/biofiles.d.ts.map +1 -1
  49. package/package.json +2 -3
  50. package/.claude/settings.local.json +0 -33
  51. package/BIOFS_CLI_NODE_CONVERGENCE_ANALYSIS.md +0 -932
  52. package/BIOFS_FEDERATED_NETWORK_ARCHITECTURE.md +0 -1071
  53. package/BIOFS_NODE_CLIENT_ARCHITECTURE.md +0 -557
  54. package/BIOFS_NODE_IMPLEMENTATION_PLAN.md +0 -2164
  55. package/BIOROUTER_IMPLEMENTATION_CHECKLIST.md +0 -618
  56. package/BUBBLEWRAP_INTEGRATION.md +0 -486
  57. package/BUBBLEWRAP_QUICKSTART.md +0 -356
  58. package/BUBBLEWRAP_README.md +0 -466
  59. package/BUBBLEWRAP_STRATEGIC_ANALYSIS.md +0 -625
  60. package/EXECUTIVE_SUMMARY_BIOROUTER_CONVERGENCE.md +0 -323
  61. package/GEMINI_REMOVAL_COMPLETE.md +0 -311
  62. package/debug_credentials.js +0 -60
  63. package/dist/commands/sandbox.d.ts +0 -10
  64. package/dist/commands/sandbox.d.ts.map +0 -1
  65. package/dist/commands/sandbox.js +0 -418
  66. package/dist/commands/sandbox.js.map +0 -1
  67. package/dist/lib/sandbox/bubblewrap.d.ts +0 -125
  68. package/dist/lib/sandbox/bubblewrap.d.ts.map +0 -1
  69. package/dist/lib/sandbox/bubblewrap.js +0 -343
  70. package/dist/lib/sandbox/bubblewrap.js.map +0 -1
  71. package/examples/sandbox-usage.ts +0 -361
@@ -1,618 +0,0 @@
1
- # BioRouter Implementation Checklist
2
- **Date**: November 1, 2025
3
- **Purpose**: Step-by-step action items for biofs-cli + biofs-node convergence
4
- **Timeline**: 12 weeks to beta launch
5
-
6
- ---
7
-
8
- ## 🚨 CRITICAL PATH - MUST DO FIRST
9
-
10
- ### Week 1: Get Master Node Online
11
-
12
- #### Day 1-2: Initialize BiodataRouter Smart Contract
13
- ```bash
14
- # Task: Set master node wallet in BiodataRouter contract
15
- cd /home/ubuntu/biofs-node
16
-
17
- # 1. Create initialization script
18
- cat > scripts/initialize-biodata-router.ts << 'EOF'
19
- import { ethers } from 'ethers';
20
- import * as dotenv from 'dotenv';
21
-
22
- dotenv.config();
23
-
24
- const BIODATA_ROUTER_V2 = '0x8D68dd359ff8331e7594147BF72EC566ce403105';
25
- const MASTER_NODE_WALLET = '0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a'; // CEO wallet
26
-
27
- async function initializeBiodataRouter() {
28
- const provider = new ethers.JsonRpcProvider('http://52.90.163.112:8545');
29
- const executorKey = process.env.SEQUENTIA_EXECUTOR_KEY!;
30
- const wallet = new ethers.Wallet(executorKey, provider);
31
-
32
- // BiodataRouter ABI (simplified)
33
- const abi = [
34
- 'function setMasterNode(address _masterNode) external',
35
- 'function masterNode() external view returns (address)'
36
- ];
37
-
38
- const biodataRouter = new ethers.Contract(BIODATA_ROUTER_V2, abi, wallet);
39
-
40
- // Check current master node
41
- const currentMaster = await biodataRouter.masterNode();
42
- console.log('Current master node:', currentMaster);
43
-
44
- if (currentMaster === '0x0000000000000000000000000000000000000000') {
45
- console.log('Setting master node to:', MASTER_NODE_WALLET);
46
- const tx = await biodataRouter.setMasterNode(MASTER_NODE_WALLET);
47
- console.log('Transaction hash:', tx.hash);
48
- await tx.wait();
49
- console.log('✅ Master node initialized!');
50
- } else {
51
- console.log('⚠️ Master node already set');
52
- }
53
- }
54
-
55
- initializeBiodataRouter().catch(console.error);
56
- EOF
57
-
58
- # 2. Run initialization
59
- npx tsx scripts/initialize-biodata-router.ts
60
-
61
- # 3. Verify
62
- npx tsx scripts/check-biodata-router-master.ts
63
-
64
- # ✅ Expected output: Master node = 0x5f5a60EaEf242c0D51A21c703f520347b96Ed19a
65
- ```
66
-
67
- **Acceptance Criteria**:
68
- - [ ] BiodataRouter contract returns CEO wallet as master node
69
- - [ ] Transaction confirmed on Sequentia blockchain
70
- - [ ] No errors in contract interaction
71
-
72
- ---
73
-
74
- #### Day 3-4: Deploy Master Node to Production
75
-
76
- ```bash
77
- # Task: Deploy biofs-node to biofs-master.genobank.io
78
-
79
- # 1. Build production bundle
80
- cd /home/ubuntu/biofs-node
81
- npm run build
82
-
83
- # 2. Create systemd service
84
- sudo tee /etc/systemd/system/biofs-node-master.service << 'EOF'
85
- [Unit]
86
- Description=BioFS Master Node - BioRouter Operating System
87
- After=network.target
88
-
89
- [Service]
90
- Type=simple
91
- User=ubuntu
92
- WorkingDirectory=/home/ubuntu/biofs-node
93
- ExecStart=/usr/bin/node /home/ubuntu/biofs-node/dist/index.js start --config /home/ubuntu/biofs-node/production.yaml
94
- Restart=always
95
- RestartSec=10
96
- Environment=NODE_ENV=production
97
-
98
- [Install]
99
- WantedBy=multi-user.target
100
- EOF
101
-
102
- # 3. Enable and start service
103
- sudo systemctl daemon-reload
104
- sudo systemctl enable biofs-node-master.service
105
- sudo systemctl start biofs-node-master.service
106
-
107
- # 4. Check status
108
- sudo systemctl status biofs-node-master.service
109
- sudo journalctl -u biofs-node-master -f
110
-
111
- # 5. Update nginx for public access
112
- sudo tee /etc/nginx/sites-available/biofs-master.genobank.io << 'EOF'
113
- server {
114
- listen 80;
115
- server_name biofs-master.genobank.io;
116
-
117
- location / {
118
- proxy_pass http://localhost:8081;
119
- proxy_set_header Host $host;
120
- proxy_set_header X-Real-IP $remote_addr;
121
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
122
- proxy_set_header X-Forwarded-Proto $scheme;
123
- }
124
- }
125
- EOF
126
-
127
- sudo ln -s /etc/nginx/sites-available/biofs-master.genobank.io /etc/nginx/sites-enabled/
128
- sudo nginx -t
129
- sudo systemctl reload nginx
130
-
131
- # 6. Test public access
132
- curl http://biofs-master.genobank.io/health
133
- # ✅ Expected: {"status": "ok", "node_type": "master"}
134
- ```
135
-
136
- **Acceptance Criteria**:
137
- - [ ] biofs-node-master.service running and enabled
138
- - [ ] Nginx proxying traffic to port 8081
139
- - [ ] Public access working (http://biofs-master.genobank.io/health)
140
- - [ ] Logs showing no errors
141
-
142
- ---
143
-
144
- #### Day 5: Set Up SSL Certificate
145
-
146
- ```bash
147
- # Task: Enable HTTPS for biofs-master.genobank.io
148
-
149
- # Option 1: Cloudflare Origin Certificate (RECOMMENDED)
150
- # 1. Go to Cloudflare Dashboard → SSL/TLS → Origin Server
151
- # 2. Create Origin Certificate
152
- # 3. Save certificate and private key
153
-
154
- sudo mkdir -p /etc/ssl/cloudflare
155
- sudo tee /etc/ssl/cloudflare/biofs-master.genobank.io.pem << 'EOF'
156
- [PASTE CLOUDFLARE ORIGIN CERTIFICATE HERE]
157
- EOF
158
-
159
- sudo tee /etc/ssl/cloudflare/biofs-master.genobank.io.key << 'EOF'
160
- [PASTE PRIVATE KEY HERE]
161
- EOF
162
-
163
- sudo chmod 600 /etc/ssl/cloudflare/biofs-master.genobank.io.key
164
-
165
- # 4. Update nginx
166
- sudo tee /etc/nginx/sites-available/biofs-master.genobank.io << 'EOF'
167
- server {
168
- listen 443 ssl http2;
169
- server_name biofs-master.genobank.io;
170
-
171
- ssl_certificate /etc/ssl/cloudflare/biofs-master.genobank.io.pem;
172
- ssl_certificate_key /etc/ssl/cloudflare/biofs-master.genobank.io.key;
173
-
174
- location / {
175
- proxy_pass http://localhost:8081;
176
- proxy_set_header Host $host;
177
- proxy_set_header X-Real-IP $remote_addr;
178
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
179
- proxy_set_header X-Forwarded-Proto $scheme;
180
-
181
- # WebSocket support (for real-time updates)
182
- proxy_http_version 1.1;
183
- proxy_set_header Upgrade $http_upgrade;
184
- proxy_set_header Connection "upgrade";
185
- }
186
- }
187
-
188
- server {
189
- listen 80;
190
- server_name biofs-master.genobank.io;
191
- return 301 https://$server_name$request_uri;
192
- }
193
- EOF
194
-
195
- sudo nginx -t
196
- sudo systemctl reload nginx
197
-
198
- # 5. Update DNS
199
- # Go to Cloudflare DNS settings:
200
- # - Type: A
201
- # - Name: biofs-master
202
- # - Content: 184.73.150.10
203
- # - Proxy: ✅ Proxied (orange cloud)
204
-
205
- # 6. Test HTTPS
206
- curl https://biofs-master.genobank.io/health
207
- # ✅ Expected: {"status": "ok", "node_type": "master"}
208
- ```
209
-
210
- **Acceptance Criteria**:
211
- - [ ] HTTPS working (https://biofs-master.genobank.io)
212
- - [ ] HTTP redirects to HTTPS
213
- - [ ] SSL certificate valid (Cloudflare)
214
- - [ ] WebSocket support enabled
215
-
216
- ---
217
-
218
- ### Week 2: Register First Lab Node
219
-
220
- #### Day 6-7: Deploy AUGenomics Lab Node
221
-
222
- ```bash
223
- # Task: Set up AUGenomics as first federated lab
224
-
225
- # 1. Create lab configuration
226
- cd /home/ubuntu/biofs-node
227
- tee augenomics-lab.yaml << 'EOF'
228
- node:
229
- type: lab
230
- id: augenomics
231
- name: "AUGenomics Advanced Sequencing Lab"
232
- wallet: "0x8d917cE06925508079E806AA7555667642B805BD"
233
- url: "https://biofs.augenomics.org" # (If they deploy)
234
- # OR "https://biofs-master.genobank.io/labs/augenomics" (If we host)
235
-
236
- api:
237
- port: 8082
238
- host: 0.0.0.0
239
-
240
- storage:
241
- bucket: "augenomicsadvancedsequencinglab.mirror.genobank"
242
- region: "us-west-1"
243
- mirror_dest: "test.vault.genoverse.io" # GenoBank master backup
244
-
245
- master:
246
- url: "https://biofs-master.genobank.io"
247
- registration_token: "" # Will be filled after registration
248
-
249
- services:
250
- # Lab can optionally sponsor their own API keys
251
- # If not provided, master node provides sponsored services
252
- anthropic_key: "" # Optional
253
- story_executor_key: "" # Optional
254
-
255
- monitoring:
256
- prometheus_enabled: true
257
- port: 9091
258
- EOF
259
-
260
- # 2. Register lab with master
261
- npx tsx scripts/register-lab.ts \
262
- --name "AUGenomics Advanced Sequencing Lab" \
263
- --wallet 0x8d917cE06925508079E806AA7555667642B805BD \
264
- --bucket s3://augenomicsadvancedsequencinglab.mirror.genobank \
265
- --master https://biofs-master.genobank.io \
266
- --email admin@augenomics.org
267
-
268
- # ✅ Output: Registration token: biofs_augenomics_abc123xyz456
269
-
270
- # 3. Update config with token
271
- sed -i 's/registration_token: ""/registration_token: "biofs_augenomics_abc123xyz456"/' augenomics-lab.yaml
272
-
273
- # 4. Start lab node
274
- npx tsx src/index.ts start --config augenomics-lab.yaml
275
-
276
- # (For production, create systemd service similar to master)
277
- ```
278
-
279
- **Acceptance Criteria**:
280
- - [ ] Lab registered with master node
281
- - [ ] Registration token saved in config
282
- - [ ] Lab node sending heartbeats every 30 seconds
283
- - [ ] Master node shows lab as "online"
284
-
285
- ---
286
-
287
- #### Day 8-10: Test Heartbeat and Failover
288
-
289
- ```bash
290
- # Task: Verify automatic failover mechanism
291
-
292
- # 1. Monitor master node logs
293
- sudo journalctl -u biofs-node-master -f
294
-
295
- # 2. Check lab status via API
296
- curl https://biofs-master.genobank.io/api/v1/labs/augenomics/status
297
- # ✅ Expected: {"status": "online", "last_heartbeat": "2025-11-01T12:34:56Z"}
298
-
299
- # 3. Test failover: Stop lab node
300
- # (In lab node terminal)
301
- # Press Ctrl+C to stop
302
-
303
- # 4. Wait 2 minutes, check master logs
304
- # ✅ Expected: "Lab augenomics offline, activating failover"
305
-
306
- # 5. Test file access during failover
307
- curl -H "Authorization: Bearer <user_signature>" \
308
- https://biofs-master.genobank.io/api/v1/files/discover?wallet=0xPatient
309
-
310
- # ✅ Expected: Files still accessible (master serving from backup bucket)
311
-
312
- # 6. Restart lab node
313
- npx tsx src/index.ts start --config augenomics-lab.yaml
314
-
315
- # 7. Verify master switches back
316
- sudo journalctl -u biofs-node-master -f
317
- # ✅ Expected: "Lab augenomics online, deactivating failover"
318
- ```
319
-
320
- **Acceptance Criteria**:
321
- - [ ] Heartbeat mechanism working (30-second intervals)
322
- - [ ] Master detects lab offline within 2 minutes
323
- - [ ] Failover activates automatically
324
- - [ ] Files still accessible during failover
325
- - [ ] Master switches back when lab returns
326
-
327
- ---
328
-
329
- ## 📋 COMPLETE WEEK-BY-WEEK CHECKLIST
330
-
331
- ### Week 1: Master Node Deployment ✅
332
- - [ ] Day 1-2: Initialize BiodataRouter contract
333
- - [ ] Day 3-4: Deploy master node to biofs-master.genobank.io
334
- - [ ] Day 5: Set up SSL certificate (Cloudflare)
335
-
336
- ### Week 2: First Lab Registration ✅
337
- - [ ] Day 6-7: Deploy AUGenomics lab node
338
- - [ ] Day 8-10: Test heartbeat and failover
339
-
340
- ### Week 3: x402 Payment Implementation
341
- - [ ] Day 11-12: Implement `/x402/verify` endpoint
342
- - [ ] Day 13-14: Implement `/x402/settle` endpoint
343
- - [ ] Day 15: Test with Clara Agent (variant calling)
344
-
345
- ### Week 4: Shared Library Creation
346
- - [ ] Day 16-17: Create `@genobank/biofs-common` package
347
- - [ ] Day 18: Migrate BioCIDResolver to shared lib
348
- - [ ] Day 19: Migrate X402Client to shared lib
349
- - [ ] Day 20: Publish v0.1.0 to npm
350
-
351
- ### Week 5: File Discovery Convergence
352
- - [ ] Day 21-22: Implement `/api/v1/files/discover` on master
353
- - [ ] Day 23: Add federated lab query support
354
- - [ ] Day 24: Add Redis caching layer
355
- - [ ] Day 25: Performance testing (<500ms target)
356
-
357
- ### Week 6: biofs-cli Refactoring
358
- - [ ] Day 26-27: Update biofs-cli to use biofs-common
359
- - [ ] Day 28: Point biofs-cli to BioRouter endpoints
360
- - [ ] Day 29: Add `biofs nodes list` command
361
- - [ ] Day 30: Add `biofs agents list` command
362
-
363
- ### Week 7: Agent Registration
364
- - [ ] Day 31-32: Register Clara Agent in AgentRegistry
365
- - [ ] Day 33: Register OpenCRAVAT Agent
366
- - [ ] Day 34: Mint ERC-8004 reputation NFTs
367
- - [ ] Day 35: Test reputation-based routing
368
-
369
- ### Week 8: Monitoring Dashboard
370
- - [ ] Day 36-38: Deploy Prometheus + Grafana
371
- - [ ] Day 39-40: Build React ecosystem dashboard
372
- - [ ] Day 41: Real-time WebSocket updates
373
- - [ ] Day 42: Configure alerts (lab failures)
374
-
375
- ### Week 9: Security Audit
376
- - [ ] Day 43-44: Penetration testing
377
- - [ ] Day 45: Smart contract audit (BiodataRouter)
378
- - [ ] Day 46: x402 signature validation testing
379
- - [ ] Day 47-49: Remediate findings
380
-
381
- ### Week 10: Documentation
382
- - [ ] Day 50-51: Write user guide (biofs-cli)
383
- - [ ] Day 52: Write lab onboarding guide
384
- - [ ] Day 53: Write agent onboarding guide
385
- - [ ] Day 54: Write BioRouter protocol spec
386
-
387
- ### Week 11: Beta Launch Prep
388
- - [ ] Day 55: Invite 5 pilot labs
389
- - [ ] Day 56: Invite 10 beta users
390
- - [ ] Day 57-60: Monitor metrics, collect feedback
391
-
392
- ### Week 12: Public Launch
393
- - [ ] Day 61: Final QA testing
394
- - [ ] Day 62: Press release preparation
395
- - [ ] Day 63: Announce BioRouter v1.0
396
- - [ ] Day 64-70: Community education, support
397
-
398
- ---
399
-
400
- ## 🛠️ DETAILED IMPLEMENTATION GUIDES
401
-
402
- ### How to Implement `/x402/verify` Endpoint
403
-
404
- ```typescript
405
- // File: /home/ubuntu/biofs-node/src/api/routes/x402.ts
406
-
407
- import { FastifyInstance } from 'fastify';
408
- import { ethers } from 'ethers';
409
-
410
- export async function x402Routes(fastify: FastifyInstance) {
411
-
412
- // POST /x402/verify
413
- fastify.post('/x402/verify', async (request, reply) => {
414
- const { from, to, value, validAfter, validBefore, nonce, signature } = request.body;
415
-
416
- try {
417
- // 1. Verify EIP-3009 signature
418
- const domain = {
419
- name: 'SeqUSDC',
420
- version: '1',
421
- chainId: 15132025,
422
- verifyingContract: process.env.SEQ_USDC_ADDRESS!
423
- };
424
-
425
- const types = {
426
- TransferWithAuthorization: [
427
- { name: 'from', type: 'address' },
428
- { name: 'to', type: 'address' },
429
- { name: 'value', type: 'uint256' },
430
- { name: 'validAfter', type: 'uint256' },
431
- { name: 'validBefore', type: 'uint256' },
432
- { name: 'nonce', type: 'bytes32' }
433
- ]
434
- };
435
-
436
- const message = { from, to, value, validAfter, validBefore, nonce };
437
-
438
- const recoveredAddress = ethers.verifyTypedData(domain, types, message, signature);
439
-
440
- if (recoveredAddress.toLowerCase() !== from.toLowerCase()) {
441
- return reply.code(400).send({ error: 'Invalid signature' });
442
- }
443
-
444
- // 2. Check balance
445
- const seqUSDC = new ethers.Contract(
446
- process.env.SEQ_USDC_ADDRESS!,
447
- ['function balanceOf(address) view returns (uint256)'],
448
- new ethers.JsonRpcProvider('http://52.90.163.112:8545')
449
- );
450
-
451
- const balance = await seqUSDC.balanceOf(from);
452
- if (balance < BigInt(value)) {
453
- return reply.code(400).send({ error: 'Insufficient balance' });
454
- }
455
-
456
- // 3. Check agent reputation (if applicable)
457
- const agentRegistry = new ethers.Contract(
458
- process.env.AGENT_REGISTRY_ADDRESS!,
459
- ['function agents(address) view returns (tuple(string name, address operator, uint8 reputation, bool active))'],
460
- new ethers.JsonRpcProvider('http://52.90.163.112:8545')
461
- );
462
-
463
- const agent = await agentRegistry.agents(to);
464
- if (agent.reputation < 50) {
465
- return reply.code(403).send({ error: 'Agent reputation too low' });
466
- }
467
-
468
- // 4. Generate job ID
469
- const jobId = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
470
-
471
- // 5. Store pending authorization
472
- await fastify.db.pendingAuthorizations.insert({
473
- jobId,
474
- from,
475
- to,
476
- value,
477
- validAfter,
478
- validBefore,
479
- nonce,
480
- signature,
481
- createdAt: new Date()
482
- });
483
-
484
- return { verified: true, jobId };
485
-
486
- } catch (error) {
487
- fastify.log.error(error);
488
- return reply.code(500).send({ error: 'Verification failed' });
489
- }
490
- });
491
- }
492
- ```
493
-
494
- **Test**:
495
- ```bash
496
- curl -X POST https://biofs-master.genobank.io/x402/verify \
497
- -H "Content-Type: application/json" \
498
- -d '{
499
- "from": "0x12C472797465bf9cCF5e93Bc3f60FAF34066214d",
500
- "to": "0x743D7FaE711C74a96654deDC6eeDa36352C75ACb",
501
- "value": "4000000",
502
- "validAfter": "0",
503
- "validBefore": "9999999999",
504
- "nonce": "0x...",
505
- "signature": "0x..."
506
- }'
507
-
508
- # ✅ Expected: {"verified": true, "jobId": "1730434567-abc123"}
509
- ```
510
-
511
- ---
512
-
513
- ### How to Create Shared Library
514
-
515
- ```bash
516
- # 1. Create new package directory
517
- mkdir -p /home/ubuntu/biofs-common
518
- cd /home/ubuntu/biofs-common
519
-
520
- # 2. Initialize package
521
- npm init -y
522
-
523
- # 3. Update package.json
524
- cat > package.json << 'EOF'
525
- {
526
- "name": "@genobank/biofs-common",
527
- "version": "0.1.0",
528
- "description": "Shared types and utilities for BioFS CLI and Node",
529
- "main": "dist/index.js",
530
- "types": "dist/index.d.ts",
531
- "files": ["dist/"],
532
- "scripts": {
533
- "build": "tsc",
534
- "prepublishOnly": "npm run build"
535
- },
536
- "dependencies": {
537
- "ethers": "^6.9.0",
538
- "axios": "^1.6.0"
539
- },
540
- "devDependencies": {
541
- "typescript": "^5.3.0",
542
- "@types/node": "^20.0.0"
543
- }
544
- }
545
- EOF
546
-
547
- # 4. Create TypeScript config
548
- cat > tsconfig.json << 'EOF'
549
- {
550
- "compilerOptions": {
551
- "target": "ES2020",
552
- "module": "commonjs",
553
- "declaration": true,
554
- "outDir": "./dist",
555
- "strict": true,
556
- "esModuleInterop": true
557
- },
558
- "include": ["src/**/*"]
559
- }
560
- EOF
561
-
562
- # 5. Create shared types
563
- mkdir -p src
564
- cat > src/types.ts << 'EOF'
565
- export interface BioFile {
566
- filename: string;
567
- biocid: string;
568
- type: 'vcf' | 'fastq' | 'bam' | 'pdf' | 'bioip';
569
- source: 'S3' | 'BioFS' | 'IPFS' | 'Story';
570
- size?: number;
571
- created_at?: string;
572
- s3_path?: string;
573
- presigned_url?: string;
574
- ip_asset?: string;
575
- granted?: boolean;
576
- owner?: string;
577
- license_type?: 'commercial' | 'non-commercial';
578
- }
579
- EOF
580
-
581
- # 6. Build and publish
582
- npm run build
583
- npm publish --access public
584
-
585
- # 7. Use in biofs-cli
586
- cd /home/ubuntu/biofs-cli
587
- npm install @genobank/biofs-common@latest
588
-
589
- # 8. Use in biofs-node
590
- cd /home/ubuntu/biofs-node
591
- npm install @genobank/biofs-common@latest
592
- ```
593
-
594
- ---
595
-
596
- ## 📊 SUCCESS METRICS
597
-
598
- ### Technical KPIs
599
- - [ ] Master node uptime: >99.9%
600
- - [ ] File discovery latency: <500ms
601
- - [ ] Lab failover time: <2 minutes
602
- - [ ] x402 payment success rate: >99.5%
603
-
604
- ### Network Growth KPIs
605
- - [ ] Week 2: 1 master + 1 lab
606
- - [ ] Week 6: 1 master + 2 labs + 2 agents
607
- - [ ] Week 12: 1 master + 5 labs + 5 agents + 50 users
608
-
609
- ### Financial KPIs
610
- - [ ] Week 12: $10,000 USDC routed through BioRouter
611
- - [ ] Month 6: $50,000 USDC routed
612
- - [ ] Year 1: $500,000 USDC routed
613
-
614
- ---
615
-
616
- **Document Version**: 1.0
617
- **Last Updated**: November 1, 2025
618
- **Status**: Ready for implementation