@genobank/biofs 2.4.1 โ†’ 2.5.1

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 (153) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE +37 -0
  3. package/README.md +2 -1
  4. package/bin/biofs.js +2 -1
  5. package/contracts/ClaraJobNFT.sol +101 -0
  6. package/dist/commands/agent/health.js +1 -1
  7. package/dist/commands/agent/health.js.map +1 -1
  8. package/dist/commands/agent/list.d.ts +14 -0
  9. package/dist/commands/agent/list.d.ts.map +1 -0
  10. package/dist/commands/agent/list.js +101 -0
  11. package/dist/commands/agent/list.js.map +1 -0
  12. package/dist/commands/agent/register.d.ts +18 -0
  13. package/dist/commands/agent/register.d.ts.map +1 -0
  14. package/dist/commands/agent/register.js +120 -0
  15. package/dist/commands/agent/register.js.map +1 -0
  16. package/dist/commands/agent/status.d.ts +14 -0
  17. package/dist/commands/agent/status.d.ts.map +1 -0
  18. package/dist/commands/agent/status.js +151 -0
  19. package/dist/commands/agent/status.js.map +1 -0
  20. package/dist/commands/annotate/status.d.ts +11 -0
  21. package/dist/commands/annotate/status.d.ts.map +1 -0
  22. package/dist/commands/annotate/status.js +123 -0
  23. package/dist/commands/annotate/status.js.map +1 -0
  24. package/dist/commands/annotate/submit.d.ts +23 -0
  25. package/dist/commands/annotate/submit.d.ts.map +1 -0
  26. package/dist/commands/annotate/submit.js +296 -0
  27. package/dist/commands/annotate/submit.js.map +1 -0
  28. package/dist/commands/family-status.d.ts +12 -0
  29. package/dist/commands/family-status.d.ts.map +1 -0
  30. package/dist/commands/family-status.js +220 -0
  31. package/dist/commands/family-status.js.map +1 -0
  32. package/dist/commands/job/status.d.ts +1 -0
  33. package/dist/commands/job/status.d.ts.map +1 -1
  34. package/dist/commands/job/status.js.map +1 -1
  35. package/dist/commands/link-clara.d.ts +20 -0
  36. package/dist/commands/link-clara.d.ts.map +1 -0
  37. package/dist/commands/link-clara.js +234 -0
  38. package/dist/commands/link-clara.js.map +1 -0
  39. package/dist/commands/mount-remote.d.ts +1 -1
  40. package/dist/commands/mount-remote.js +1 -1
  41. package/dist/commands/payment/balance.d.ts +12 -0
  42. package/dist/commands/payment/balance.d.ts.map +1 -0
  43. package/dist/commands/payment/balance.js +101 -0
  44. package/dist/commands/payment/balance.js.map +1 -0
  45. package/dist/commands/payment/faucet.d.ts +11 -0
  46. package/dist/commands/payment/faucet.d.ts.map +1 -0
  47. package/dist/commands/payment/faucet.js +92 -0
  48. package/dist/commands/payment/faucet.js.map +1 -0
  49. package/dist/commands/payment/history.d.ts +27 -0
  50. package/dist/commands/payment/history.d.ts.map +1 -0
  51. package/dist/commands/payment/history.js +162 -0
  52. package/dist/commands/payment/history.js.map +1 -0
  53. package/dist/commands/payment/pricing.d.ts +12 -0
  54. package/dist/commands/payment/pricing.d.ts.map +1 -0
  55. package/dist/commands/payment/pricing.js +65 -0
  56. package/dist/commands/payment/pricing.js.map +1 -0
  57. package/dist/commands/payment/setup.d.ts +25 -0
  58. package/dist/commands/payment/setup.d.ts.map +1 -0
  59. package/dist/commands/payment/setup.js +155 -0
  60. package/dist/commands/payment/setup.js.map +1 -0
  61. package/dist/commands/tokenize-biosample.d.ts +19 -0
  62. package/dist/commands/tokenize-biosample.d.ts.map +1 -0
  63. package/dist/commands/tokenize-biosample.js +253 -0
  64. package/dist/commands/tokenize-biosample.js.map +1 -0
  65. package/dist/index.js +281 -13
  66. package/dist/index.js.map +1 -1
  67. package/dist/lib/api/bionft-client.d.ts +35 -7
  68. package/dist/lib/api/bionft-client.d.ts.map +1 -1
  69. package/dist/lib/api/bionft-client.js +106 -16
  70. package/dist/lib/api/bionft-client.js.map +1 -1
  71. package/dist/lib/kite/agent.d.ts +85 -0
  72. package/dist/lib/kite/agent.d.ts.map +1 -0
  73. package/dist/lib/kite/agent.js +332 -0
  74. package/dist/lib/kite/agent.js.map +1 -0
  75. package/dist/lib/kite/index.d.ts +9 -0
  76. package/dist/lib/kite/index.d.ts.map +1 -0
  77. package/dist/lib/kite/index.js +25 -0
  78. package/dist/lib/kite/index.js.map +1 -0
  79. package/dist/lib/kite/passport.d.ts +69 -0
  80. package/dist/lib/kite/passport.d.ts.map +1 -0
  81. package/dist/lib/kite/passport.js +312 -0
  82. package/dist/lib/kite/passport.js.map +1 -0
  83. package/dist/lib/x402/client.d.ts +78 -0
  84. package/dist/lib/x402/client.d.ts.map +1 -0
  85. package/dist/lib/x402/client.js +298 -0
  86. package/dist/lib/x402/client.js.map +1 -0
  87. package/dist/lib/x402/index.d.ts +9 -0
  88. package/dist/lib/x402/index.d.ts.map +1 -0
  89. package/dist/lib/x402/index.js +37 -0
  90. package/dist/lib/x402/index.js.map +1 -0
  91. package/dist/lib/x402/middleware.d.ts +37 -0
  92. package/dist/lib/x402/middleware.d.ts.map +1 -0
  93. package/dist/lib/x402/middleware.js +220 -0
  94. package/dist/lib/x402/middleware.js.map +1 -0
  95. package/dist/types/kite.d.ts +157 -0
  96. package/dist/types/kite.d.ts.map +1 -0
  97. package/dist/types/kite.js +107 -0
  98. package/dist/types/kite.js.map +1 -0
  99. package/dist/types/x402.d.ts +78 -0
  100. package/dist/types/x402.d.ts.map +1 -0
  101. package/dist/types/x402.js +79 -0
  102. package/dist/types/x402.js.map +1 -0
  103. package/docs/AI_AGENT_MCP_MANUAL.md +1029 -0
  104. package/docs/USER_MANUAL.md +603 -0
  105. package/docs/technical-details.html +555 -0
  106. package/lib/bionfs-client.js +2 -0
  107. package/lib/consent-manager.js +2 -0
  108. package/lib/consent-prompt.js +2 -0
  109. package/package.json +9 -3
  110. package/presentation/biofs-x402-kite-presentation.html +813 -0
  111. package/scripts/build_annotator_dictionary.py +1 -0
  112. package/scripts/deploy-clara-nft.js +37 -0
  113. package/test-complete-flow.sh +1 -1
  114. package/test.vcf +1 -0
  115. package/test_23andme.txt +1 -0
  116. package/ADMIN_REGISTER_LAB.md +0 -252
  117. package/ANNOTATOR_RECOMMENDATIONS_API.md +0 -490
  118. package/BIOFS_QUICK_START.md +0 -200
  119. package/BIOFS_TOKENIZE_COMPLETE.md +0 -541
  120. package/BIOFS_V1.2.7_PUBLISHED.md +0 -317
  121. package/BIOFS_V1.2.9_FIXES.md +0 -306
  122. package/BIOFS_V1.3.0_DIRECT_GRANT.md +0 -381
  123. package/BIOFS_V1.3.1_GRANTED_FILES.md +0 -328
  124. package/BIONFS_DEPLOYMENT_GUIDE.md +0 -408
  125. package/BIONFS_MOUNT_INTEGRATION_PLAN.md +0 -415
  126. package/BIONFS_PROTOCOL_SPECIFICATION.md +0 -688
  127. package/BIONFS_SEQUENTIAS_INTEGRATION.md +0 -457
  128. package/BIONFT_GATED_REMOTE_MOUNTING.md +0 -1260
  129. package/BIONFT_NFS_PROTOCOL_ARCHITECTURE.md +0 -583
  130. package/BIOOS_CLI_IMPLEMENTATION_COMPLETE.md +0 -422
  131. package/BIOOS_JOB_MANAGEMENT.md +0 -681
  132. package/BUGFIX_V2.1.3.md +0 -72
  133. package/CHANGELOG_V2.1.0.md +0 -386
  134. package/CHANGELOG_V2.2.0.md +0 -284
  135. package/ENHANCEMENT_DOCUMENTATION.md +0 -218
  136. package/GDPR_BIONFS_CONSENT_ARCHITECTURE.md +0 -798
  137. package/GDPR_BIONFS_IMPLEMENTATION_STATUS.md +0 -462
  138. package/INSTALL_V1.2.7_ON_MAC.md +0 -306
  139. package/LABNFT_BIOFS_INTEGRATION.md +0 -396
  140. package/OPENCRAVAT_ANNOTATORS_REFERENCE.md +0 -340
  141. package/OPENCRAVAT_ANNOTATOR_INTELLIGENCE_COMPLETE.md +0 -479
  142. package/QUICK_START_V2.1.0.md +0 -116
  143. package/RELEASE_SUMMARY_V1.2.7.md +0 -479
  144. package/RELEASE_SUMMARY_V1.3.0.md +0 -324
  145. package/SEQUENTIAS_PROTOCOL_ARCHITECTURE.md +0 -880
  146. package/SEQUENTIA_MIGRATION_GUIDE.md +0 -337
  147. package/SESSION_SUMMARY_DIRECT_GRANT.md +0 -321
  148. package/ULTRATHINK_BIONFS_COMPLETE.md +0 -458
  149. package/WEB3FUSE_LICENSE_TOKEN_ANALYSIS.md +0 -494
  150. package/WHERE_PERMISSIONS_LIVE.md +0 -165
  151. package/config.json +0 -21
  152. package/opencravat_annotators_dictionary.json +0 -2356
  153. package/package.json.working.v1.9.2.20251105_023952 +0 -48
@@ -1,541 +0,0 @@
1
- # BioFS Tokenize Command - Complete Implementation
2
-
3
- **Date:** October 4, 2025
4
- **Status:** โœ… **FULLY OPERATIONAL**
5
- **Version:** 1.0.0
6
-
7
- ## ๐ŸŽ‰ Overview
8
-
9
- The `biofs tokenize` command is now fully implemented and follows the exact workflow of bioip.genobank.app for tokenizing genomic datasets as BioIP NFTs on Story Protocol blockchain.
10
-
11
- ---
12
-
13
- ## โœ… What Was Built
14
-
15
- ### 1. Core Tokenization Command
16
-
17
- **Command Signature:**
18
- ```bash
19
- biofs tokenize <file> [options]
20
- ```
21
-
22
- **Available Options:**
23
- - `--title <string>` - Custom title for the NFT (auto-generated if not provided)
24
- - `--description <string>` - Custom description (uses Gemini AI if not provided)
25
- - `--license <type>` - License type: `commercial` or `non-commercial` (default: non-commercial)
26
- - `--collection <address>` - Manual collection address override
27
- - `--network <network>` - Story Protocol network: `mainnet` or `testnet` (default: mainnet)
28
- - `--no-ai` - Skip AI classification
29
- - `--quiet` - No interactive prompts
30
-
31
- ---
32
-
33
- ## ๐ŸŒ Story Protocol Network Support
34
-
35
- ### Mainnet (Production)
36
- - **RPC:** `https://rpc.story.foundation`
37
- - **Chain ID:** `1516`
38
- - **Explorer:** `https://explorer.story.foundation`
39
- - **Usage:** Default network for production tokenization
40
-
41
- ### Testnet (Odyssey)
42
- - **RPC:** `https://testnet.storyrpc.io`
43
- - **Chain ID:** `1513`
44
- - **Explorer:** `https://testnet.storyscan.xyz`
45
- - **Usage:** For testing before mainnet deployment
46
-
47
- ---
48
-
49
- ## ๐Ÿ”ง Complete Tokenization Workflow
50
-
51
- ### Step-by-Step Process:
52
-
53
- ```
54
- 1. FILE VALIDATION โœ…
55
- โ””โ”€> Checks file exists and is readable
56
- โ””โ”€> Validates file extension (vcf, txt, fastq, bam, etc.)
57
- โ””โ”€> Gets file size and basic metadata
58
-
59
- 2. AUTHENTICATION CHECK โœ…
60
- โ””โ”€> Loads credentials from ~/.genobank/credentials.json
61
- โ””โ”€> Validates user_signature and wallet_address
62
- โ””โ”€> Confirms user is authenticated
63
-
64
- 3. NETWORK SELECTION โœ…
65
- โ””โ”€> Selects Story Protocol network (mainnet/testnet)
66
- โ””โ”€> Configures RPC and Chain ID
67
- โ””โ”€> Sets appropriate explorer URL
68
-
69
- 4. FINGERPRINT CALCULATION โœ…
70
- โ””โ”€> For VCF files: Extracts SNPs (chr:pos:ref:alt)
71
- โ””โ”€> For 23andMe/Ancestry: Extracts rsID:genotype pairs
72
- โ””โ”€> Limits to first 10,000 SNPs for consistency
73
- โ””โ”€> Generates MD5 hash of sorted SNP list
74
- โ””โ”€> Used for duplicate detection
75
-
76
- 5. AI CLASSIFICATION (Optional) โœ…
77
- โ””โ”€> Sends file sample to Gemini AI
78
- โ””โ”€> Gets intelligent description (2-3 sentences)
79
- โ””โ”€> Auto-detects dataset category
80
- โ””โ”€> Suggests title based on content
81
- โ””โ”€> Can be skipped with --no-ai flag
82
-
83
- 6. COLLECTION SELECTION โœ…
84
- โ””โ”€> Auto-selects based on file category:
85
- โ€ข VCF โ†’ 0x19A615224D03487AaDdC43e4520F9D83923d9512
86
- โ€ข Genomic โ†’ 0x5021F7438ea502b0c346cB59F8E92B749Ecd74B5
87
- โ€ข GWAS/SNP/23andMe โ†’ 0x29853ed299B8FBBe16568840F3Bb2A8E40dc7401
88
- โ€ข BAM/SAM โ†’ 0xB8d03f2E1C02e4cC5b5fe1613c575c01BDD12269
89
- โ€ข FASTQ/FASTA โ†’ 0x88Ed5b47ea8f609Ee14ac60968C3f76f9138a171
90
- โ””โ”€> Manual override available with --collection flag
91
-
92
- 7. LICENSE CONFIGURATION โœ…
93
- โ””โ”€> Story Protocol PIL (Programmable IP License)
94
- โ””โ”€> Non-commercial: PIL_NON_COMMERCIAL_REMIX (default)
95
- โ””โ”€> Commercial: PIL_COMMERCIAL_REMIX
96
- โ””โ”€> Sets on-chain licensing terms
97
-
98
- 8. METADATA PREPARATION โœ…
99
- โ””โ”€> Title: From --title or AI suggestion or filename
100
- โ””โ”€> Description: From --description or AI or auto-generated
101
- โ””โ”€> NFT Traits:
102
- โ€ข File Type (VCF, FASTQ, etc.)
103
- โ€ข File Size (bytes)
104
- โ€ข SNP Count (for genomic files)
105
- โ€ข Fingerprint Hash
106
- โ€ข Created Date
107
- โ€ข Category
108
- โ””โ”€> Image: Auto-selected category-appropriate image
109
-
110
- 9. API SUBMISSION โœ…
111
- โ””โ”€> Uploads to /api_bioip/register_bioip
112
- โ””โ”€> Includes all metadata and file
113
- โ””โ”€> Shows upload progress
114
- โ””โ”€> Handles errors gracefully
115
-
116
- 10. NFT MINTING โœ…
117
- โ””โ”€> Server-side minting using BIOSAMPLE_EXECUTOR wallet
118
- โ””โ”€> Mints on selected Story Protocol network
119
- โ””โ”€> Registers as IP Asset
120
- โ””โ”€> Attaches PIL license terms
121
- โ””โ”€> Returns IP Asset ID and transaction hash
122
-
123
- 11. BIOCID GENERATION โœ…
124
- โ””โ”€> Format: biocid://<wallet>/<category>/<filename>
125
- โ””โ”€> Example: biocid://0x5f5a.../variant/my-genome.vcf
126
- โ””โ”€> Universal identifier for cross-platform access
127
-
128
- 12. RESULT DISPLAY โœ…
129
- โ””โ”€> Shows all tokenization details
130
- โ””โ”€> Provides explorer link
131
- โ””โ”€> Saves local record
132
- โ””โ”€> Displays BioCID
133
- ```
134
-
135
- ---
136
-
137
- ## ๐Ÿ“ Usage Examples
138
-
139
- ### Basic Tokenization (Mainnet, Non-Commercial)
140
- ```bash
141
- biofs tokenize my-genome.vcf
142
- ```
143
- **Output:**
144
- ```
145
- ๐Ÿงฌ BioFS Tokenization
146
- โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
147
-
148
- โœ… File validated: my-genome.vcf (2.5 MB)
149
- โœ… Authenticated: 0x5f5a60Ea...
150
- โœ… Network: Story Protocol Mainnet (Chain ID: 1516)
151
- โœ… Fingerprint: 3a4f7d2c... (10,000 SNPs)
152
- โœ… AI Classification: Variant Call Format
153
- โœ… Collection: VCF Analysis (0x19A6...9512)
154
- โœ… Upload complete
155
- โœ… NFT minted successfully!
156
-
157
- โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
158
- ๐ŸŽ‰ BioIP Tokenization Successful!
159
- โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
160
-
161
- ๐Ÿ“ฆ IP Asset ID: 0x4925ef6c5FbE63F9d5cF9FB20c074497FaB694C0
162
- ๐Ÿ”— BioCID: biocid://0x5f5a.../variant/my-genome.vcf
163
- ๐Ÿ›๏ธ License: Non-Commercial Remix
164
- ๐Ÿ“Š Collection: VCF Analysis
165
-
166
- ๐ŸŒ View on Explorer:
167
- https://explorer.story.foundation/ipa/0x4925ef6c5FbE63F9d5cF9FB20c074497FaB694C0
168
- ```
169
-
170
- ### Testnet with Commercial License
171
- ```bash
172
- biofs tokenize research-data.txt --network testnet --license commercial
173
- ```
174
-
175
- ### Custom Metadata (No AI)
176
- ```bash
177
- biofs tokenize genome.vcf \
178
- --title "Clinical Whole Genome Sequencing" \
179
- --description "WGS for hereditary cancer research" \
180
- --no-ai
181
- ```
182
-
183
- ### Manual Collection Selection
184
- ```bash
185
- biofs tokenize alignment.bam \
186
- --collection 0xB8d03f2E1C02e4cC5b5fe1613c575c01BDD12269 \
187
- --network mainnet
188
- ```
189
-
190
- ### 23andMe/Ancestry File
191
- ```bash
192
- biofs tokenize my_23andme_data.txt
193
- ```
194
- **Auto-detects:** DTC category, uses GWAS collection
195
-
196
- ---
197
-
198
- ## ๐Ÿ—‚๏ธ File Type Support
199
-
200
- | File Type | Extension | Category | Collection Address |
201
- |-----------|-----------|----------|-------------------|
202
- | VCF | `.vcf` | variant | `0x19A6...9512` |
203
- | 23andMe/Ancestry | `.txt` | dtc | `0x2985...7401` |
204
- | BAM | `.bam` | alignment | `0xB8d0...2269` |
205
- | SAM | `.sam` | alignment | `0xB8d0...2269` |
206
- | FASTQ | `.fastq`, `.fq` | sequence | `0x88Ed...9171` |
207
- | FASTA | `.fasta`, `.fa` | sequence | `0x88Ed...9171` |
208
- | GFF | `.gff` | annotation | `0x88Ed...9171` |
209
- | GTF | `.gtf` | annotation | `0x88Ed...9171` |
210
- | BED | `.bed` | annotation | `0x88Ed...9171` |
211
- | DICOM | `.dicom`, `.dcm` | medical_imaging | `0x5021...74B5` |
212
-
213
- ---
214
-
215
- ## ๐Ÿงฌ Fingerprint Algorithm
216
-
217
- ### VCF Files
218
- ```typescript
219
- 1. Read VCF file line by line
220
- 2. Skip header lines (starting with #)
221
- 3. For each variant:
222
- - Extract: chromosome, position, ref, alt
223
- - Create SNP ID: "chr1:100:A:G"
224
- 4. Collect up to 10,000 SNPs
225
- 5. Sort SNPs alphabetically
226
- 6. Join with commas: "chr1:100:A:G,chr1:200:C:T,..."
227
- 7. Calculate MD5 hash
228
- 8. Use for duplicate detection
229
- ```
230
-
231
- ### 23andMe/Ancestry Files
232
- ```typescript
233
- 1. Read file line by line
234
- 2. Skip comment lines (starting with #)
235
- 3. For each SNP:
236
- - Extract: rsID, genotype
237
- - Create pair: "rs12345:AG"
238
- 4. Collect up to 10,000 SNPs
239
- 5. Sort alphabetically
240
- 6. Join with commas
241
- 7. Calculate MD5 hash
242
- ```
243
-
244
- ### Other Files
245
- ```typescript
246
- 1. Read entire file content
247
- 2. Calculate MD5 hash of content
248
- 3. Use for file integrity verification
249
- ```
250
-
251
- ---
252
-
253
- ## ๐Ÿค– AI Classification
254
-
255
- ### Gemini AI Integration
256
-
257
- **API:** Google Generative AI (Gemini Pro)
258
- **Key:** `AIzaSyCuPPjSPkHTbu2YBoyZjUB-o-xCnhCNaac`
259
-
260
- **What AI Does:**
261
- 1. Analyzes first 100 lines of file
262
- 2. Identifies file type and format
263
- 3. Generates 2-3 sentence description
264
- 4. Suggests appropriate title
265
- 5. Determines best category
266
-
267
- **Example Output:**
268
- ```json
269
- {
270
- "description": "Whole genome sequencing variant calls from Illumina platform, containing approximately 4.5 million variants across all chromosomes. High-quality calls filtered for clinical significance.",
271
- "category": "variant",
272
- "suggestedTitle": "Clinical WGS Variant Analysis"
273
- }
274
- ```
275
-
276
- **Can be disabled** with `--no-ai` flag for faster processing or custom metadata.
277
-
278
- ---
279
-
280
- ## ๐Ÿ“œ Story Protocol PIL Licensing
281
-
282
- ### License Types Supported
283
-
284
- #### Non-Commercial (Default)
285
- - **PIL Term:** `PIL_NON_COMMERCIAL_REMIX`
286
- - **Allows:**
287
- - Non-commercial use
288
- - Derivative works
289
- - Attribution required
290
- - **Forbids:**
291
- - Commercial use
292
- - Selling derivatives
293
- - **Usage:** `--license non-commercial` (or omit flag)
294
-
295
- #### Commercial
296
- - **PIL Term:** `PIL_COMMERCIAL_REMIX`
297
- - **Allows:**
298
- - Commercial use
299
- - Derivative works
300
- - Revenue from derivatives
301
- - Attribution required
302
- - **Usage:** `--license commercial`
303
-
304
- ### On-Chain Enforcement
305
- - License terms stored on Story Protocol blockchain
306
- - Immutable and transparent
307
- - Automatically inherited by derivatives
308
- - Royalty tracking built-in
309
-
310
- ---
311
-
312
- ## ๐Ÿ” Security & Privacy
313
-
314
- ### Authentication
315
- - Uses existing `~/.genobank/credentials.json`
316
- - No re-authentication needed
317
- - Web3 signature verified by API
318
- - Wallet ownership confirmed
319
-
320
- ### Private Key Handling
321
- - **BIOSAMPLE_EXECUTOR** private key NEVER exposed to CLI
322
- - All blockchain transactions signed server-side
323
- - CLI only sends data, API handles minting
324
- - Zero-trust architecture
325
-
326
- ### Data Storage
327
- - **Public (Blockchain):** IP Asset ID, collection, license type
328
- - **Public (IPFS):** NFT metadata, description, traits, image
329
- - **Private (MongoDB):** S3 path, wallet address, fingerprint
330
- - **Never Public:** Genomic file content, S3 paths, user data
331
-
332
- ### Fingerprint Privacy
333
- - Fingerprint is MD5 hash of SNP list
334
- - Does not expose raw genomic data
335
- - Sufficient for duplicate detection
336
- - Cannot reverse-engineer genome from hash
337
-
338
- ---
339
-
340
- ## ๐Ÿ“Š Collection Addresses
341
-
342
- ### Story Protocol Mainnet Collections
343
-
344
- ```javascript
345
- const BIOIP_COLLECTIONS = {
346
- 'genomic': '0x5021F7438ea502b0c346cB59F8E92B749Ecd74B5',
347
- 'variant': '0x19A615224D03487AaDdC43e4520F9D83923d9512',
348
- 'alignment': '0xB8d03f2E1C02e4cC5b5fe1613c575c01BDD12269',
349
- 'sequence': '0x88Ed5b47ea8f609Ee14ac60968C3f76f9138a171',
350
- 'annotation': '0x88Ed5b47ea8f609Ee14ac60968C3f76f9138a171',
351
- 'microarray': '0x29853ed299B8FBBe16568840F3Bb2A8E40dc7401',
352
- 'snp': '0x29853ed299B8FBBe16568840F3Bb2A8E40dc7401',
353
- 'gwas': '0x29853ed299B8FBBe16568840F3Bb2A8E40dc7401',
354
- 'dtc': '0x29853ed299B8FBBe16568840F3Bb2A8E40dc7401',
355
- 'medical_imaging': '0x5021F7438ea502b0c346cB59F8E92B749Ecd74B5',
356
- 'medical': '0x5021F7438ea502b0c346cB59F8E92B749Ecd74B5'
357
- };
358
- ```
359
-
360
- **Note:** Testnet uses same addresses but on different chain (1513).
361
-
362
- ---
363
-
364
- ## ๐ŸŒ BioCID Format
365
-
366
- ### Structure
367
- ```
368
- biocid://<wallet_address>/<category>/<filename>
369
- ```
370
-
371
- ### Examples
372
- ```
373
- biocid://0x5f5a60eaef242c0d51a21c703f520347b96ed19a/variant/my-genome.vcf
374
- biocid://0x5f5a60eaef242c0d51a21c703f520347b96ed19a/dtc/23andme_data.txt
375
- biocid://0x5f5a60eaef242c0d51a21c703f520347b96ed19a/sequence/sample_R1.fastq
376
- ```
377
-
378
- ### Usage
379
- - Universal identifier across GenoBank ecosystem
380
- - Used in `biofs download` command
381
- - Resolves to S3/IPFS/Story Protocol
382
- - Platform-independent file reference
383
-
384
- ---
385
-
386
- ## ๐Ÿ“ Implementation Files
387
-
388
- ### Core Command
389
- - `/home/ubuntu/genobank-cli/src/commands/tokenize.ts` - Main command logic
390
- - `/home/ubuntu/genobank-cli/src/index.ts` - Command registration
391
-
392
- ### Supporting Libraries
393
- - `/home/ubuntu/genobank-cli/src/lib/biofiles/fingerprint.ts` - Fingerprint calculation
394
- - `/home/ubuntu/genobank-cli/src/lib/ai/classifier.ts` - Gemini AI integration
395
- - `/home/ubuntu/genobank-cli/src/lib/bioip/collections.ts` - Collection mapping
396
- - `/home/ubuntu/genobank-cli/src/lib/bioip/licenses.ts` - License type mapping
397
- - `/home/ubuntu/genobank-cli/src/lib/config/constants.ts` - Network configuration
398
- - `/home/ubuntu/genobank-cli/src/lib/storage/tokenizations.ts` - Local record storage
399
-
400
- ### Configuration
401
- - `/home/ubuntu/genobank-cli/.env` - Environment variables
402
- - `/home/ubuntu/genobank-cli/package.json` - Dependencies
403
-
404
- ### Dependencies Added
405
- ```json
406
- {
407
- "@google/generative-ai": "^0.24.1" // Gemini AI SDK
408
- }
409
- ```
410
-
411
- ---
412
-
413
- ## ๐Ÿงช Testing
414
-
415
- ### Test Files
416
-
417
- **Create test VCF:**
418
- ```bash
419
- cat > test.vcf << 'EOF'
420
- ##fileformat=VCFv4.2
421
- #CHROM POS ID REF ALT QUAL FILTER INFO
422
- chr1 100 rs123 A G 30 PASS DP=10
423
- chr1 200 rs456 C T 40 PASS DP=15
424
- chr2 300 rs789 G A 50 PASS DP=20
425
- EOF
426
- ```
427
-
428
- **Create test 23andMe:**
429
- ```bash
430
- cat > test_23andme.txt << 'EOF'
431
- # rsid chromosome position genotype
432
- rs12345 1 100 AG
433
- rs67890 2 200 CC
434
- rs11111 3 300 TT
435
- EOF
436
- ```
437
-
438
- ### Test Commands
439
-
440
- ```bash
441
- # Test mainnet tokenization
442
- biofs tokenize test.vcf
443
-
444
- # Test testnet
445
- biofs tokenize test.vcf --network testnet
446
-
447
- # Test with AI disabled
448
- biofs tokenize test_23andme.txt --no-ai
449
-
450
- # Test commercial license
451
- biofs tokenize test.vcf --license commercial
452
-
453
- # Test full options
454
- biofs tokenize test.vcf \
455
- --title "Test VCF" \
456
- --description "Test variant file" \
457
- --license non-commercial \
458
- --network mainnet
459
- ```
460
-
461
- ---
462
-
463
- ## โœ… Success Criteria - All Met!
464
-
465
- - โœ… Command runs without errors
466
- - โœ… File fingerprint calculated correctly for VCF and 23andMe
467
- - โœ… AI classification provides intelligent descriptions
468
- - โœ… Correct collection auto-selected based on file type
469
- - โœ… Network selection works (mainnet/testnet)
470
- - โœ… NFT minted successfully on Story Protocol
471
- - โœ… BioCID generated and displayed
472
- - โœ… Transaction details shown with explorer links
473
- - โœ… Local tokenization records saved
474
- - โœ… Beautiful, informative terminal output
475
- - โœ… Error handling graceful and helpful
476
- - โœ… Secure BIOSAMPLE_EXECUTOR handling
477
- - โœ… PIL licensing properly configured
478
-
479
- ---
480
-
481
- ## ๐Ÿš€ What's Next?
482
-
483
- ### Potential Enhancements
484
-
485
- 1. **Batch Tokenization**
486
- ```bash
487
- biofs tokenize --batch *.vcf
488
- ```
489
-
490
- 2. **Royalty Configuration**
491
- ```bash
492
- biofs tokenize file.vcf --royalty 5%
493
- ```
494
-
495
- 3. **Derivative Creation**
496
- ```bash
497
- biofs tokenize analysis.csv --parent 0x1234...
498
- ```
499
-
500
- 4. **License Token Minting**
501
- ```bash
502
- biofs mint-license 0x1234... --amount 10
503
- ```
504
-
505
- 5. **Collection Management**
506
- ```bash
507
- biofs create-collection "My Research" MYRES
508
- ```
509
-
510
- ---
511
-
512
- ## ๐Ÿ“š Related Documentation
513
-
514
- - **BioFS CLI Guide:** `/home/ubuntu/genobank-cli/README.md`
515
- - **Quick Start:** `/home/ubuntu/genobank-cli/BIOFS_QUICK_START.md`
516
- - **Architecture:** `/home/ubuntu/Genobank_APIs/GENOBANK_CLI_ARCHITECTURE.md`
517
- - **BioIP API:** `/home/ubuntu/Genobank_APIs/production_api/plugins/bioip/api_bioip.py`
518
- - **Story Protocol DAO:** `/home/ubuntu/Genobank_APIs/production_api/libs/dao/story/story_protocol_manager_dao.py`
519
-
520
- ---
521
-
522
- ## ๐ŸŽ‰ Conclusion
523
-
524
- The `biofs tokenize` command is **fully operational** and production-ready! It provides a seamless command-line interface for tokenizing genomic datasets as BioIP NFTs on Story Protocol, with:
525
-
526
- - โœ… AI-powered metadata generation
527
- - โœ… Intelligent fingerprinting for duplicate detection
528
- - โœ… Automatic collection and license selection
529
- - โœ… Multi-network support (mainnet/testnet)
530
- - โœ… Beautiful terminal UX
531
- - โœ… Secure server-side blockchain operations
532
- - โœ… Complete integration with GenoBank ecosystem
533
-
534
- **Users can now tokenize their genomic data with a single command!** ๐Ÿš€
535
-
536
- ---
537
-
538
- **Version:** 1.0.0
539
- **Last Updated:** October 4, 2025
540
- **Status:** โœ… Production Ready
541
- **Maintained By:** GenoBank.io Team