从批次到代币
我使用 ERC-1155 表示批次,并通过 API 实现转移、拆分和合并。
在硕士论文中,我构建了一个用于追踪批次历史的原型。我希望在批次拆分、转移或合并后,仍能追溯其来源及相关证明文件。
我使用 ERC-1155 表示批次,并通过 API 实现转移、拆分和合并。
公开元数据存储在 IPFS 上。MongoDB 存储聚合数据,供查询使用。我加入了区块链、IPFS 与 MongoDB 之间的一致性检查,以识别同一批次在不同数据表示之间的差异。
在原型中,后端使用测试密钥签名。在投入实际使用之前,密钥管理和参与方之间的双重签名仍需进一步完善。
下载关于可追溯性的硕士毕业论文(PDF) 意大利语 · 3.0 MB
API 与批次逻辑。原始代码仓库中的材料,来源可追溯。
router.get('/batches/:batchId', supplyChainController.getBatchById); router.get('/batches/:batchId/parents', supplyChainController.getBatchParents); router.get('/batches/:batchId/trace-history', supplyChainController.traceBatchHistory); router.get('/batches/:batchId/descendants', supplyChainController.getBatchDescendants); router.post('/batches/:batchId/split', upload.array('attachments'), supplyChainController.splitBatch); router.post('/batches/:batchId/transfer', supplyChainController.transferBatch); router.delete('/batches/:batchId', supplyChainController.burnBatch); router.get('/batches/:batchId/status', supplyChainController.getBatchStatus); router.put('/batches/:batchId/contamination', supplyChainController.setContaminationStatus); router.post('/batches/:batchId/contaminate', supplyChainController.contaminateBatch);对批次拆分和转换进行建模,让我学会了先定义关系,再选择存储方式。区分原始记录与用于查询的数据,也有助于我进行系统集成。
告诉我你想构建或改进什么、谁会使用,以及有哪些约束条件。我会回复你,一起确定从哪里开始。