From c0202fa4c3b3252fb9b2cc9f7d3999a0d0a1bb08 Mon Sep 17 00:00:00 2001 From: Branimir Rakic <33914812+branarakic@users.noreply.github.com> Date: Tue, 13 Oct 2020 10:58:50 +0200 Subject: [PATCH 1/4] Update README.md --- README.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 72bcd35e67..0c4520efc7 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ OriginTrail Node [![Build Status](https://travis-ci.org/OriginTrail/ot-node.svg?branch=master)](https://travis-ci.org/OriginTrail/ot-node) -Company Website: [origintrail.io](https://origintrail.io) - __OriginTrail is an ecosystem dedicated to making global supply chains work together by enabling a universal, collaborative and trusted data exchange.__ This repository contains a work-in-progress code for a network node. @@ -21,7 +19,72 @@ Detailed instructions for installation and configuration of OriginTrail Node: * [API and technical documentation](http://docs.origintrail.io) * [Node setup](http://tech.origintrail.io/node-setup) + +What is OriginTrail +============= +OriginTrail is a purpose-built, open protocol for cross-organizational data sharing in supply chains, supported by blockchain. + +The key issues OriginTrail tackles are: + + * Fragmented and siloed data across supply chains + * Low data interoperability + * Preventing vendor lock-in + * Ensuring the integrity of exchanged data + + +The OriginTrail Ecosystem is built on 3 main pillars: + + ***Neutrality + +Being an open-source, decentralized system, based on open global standards, neutrality is crucial for the OriginTrail ecosystem as it prevents vendor lock-ins, ensures integrity, and effectively breaks data silos. Neutrality means adopting co-creation principles, working with other blockchain ecosystems and solutions builders even as they may be competing in the same market on the application level. + + ***Usability + +Both blockchain environments, as well as OriginTrail, are fundamental technologies. In order to ensure the onboarding of enterprises, there needs to be a great focus on enhancing the user experience, as solutions need to meet the expectations of rapid value generation. + + ***Inclusiveness + +Continuing to form partnerships with technological and business global leaders that can employ the OriginTrail ecosystem for their communities. Catering to the needs of leading global communities requires us to be making strides in designing technical infrastructure and business models that support the adoption of the OriginTrail in diverse business communities. + + +OriginTrail Decentralized Network Overview +============= +OriginTrail protocol is utilized within the permissionless OriginTrail Decentralized Network (ODN). The ODN as a network holds a growing Decentralized Knowledge Graph (DKG) with the following characteristics: + + * Linked data first structure - the graph, enabling connections between data points from all published datasets on the network, conformant with Semantic Web technologies such as RDF and JSON-LD + * Schema flexibility - enabling the mapping of virtually any data model, preferably structured according to relevant standards (such as GS1 EPCIS and CBV) and recommendations (W3C Web of Things, Verifiable Credentials, PROV, etc.) for machine readability + * Identity verification - enabling the utilization of novel identity frameworks such as Self-sovereign identity, in conjunction with industry-specific identity frameworks (such as GS1 GTIN, GIAI, GRAI and other identification schemes) + * Efficient cryptographic integrity verification of subgraphs, using associated dataset graph fingerprints, computed as Merkle roots of the input datasets + * Cryptographic connection entanglement - allowing linking of data points only when specific cryptographic rules are satisfied + * Trust minimization through decentralization - utilizing a decentralized p2p overlay network for data exchange and the Ethereum blockchain in the consensus layer + + +Therefore the key development principles of OriginTrail ecosystem are: + + * Connection-first approach - providing ways to connect the world's data into a global, decentralized knowledge graph + * Technological neutrality - avoiding technological lock-ins and striving towards agnosticism where possible + * Decentralization - designing, implementing and utilizing that are not based on trusted-third parties or centralized entities + * Privacy-by-Design approach - according to the [7 Foundational Principles of Privacy by Design](https://www.ipc.on.ca/wp-content/uploads/Resources/7foundationalprinciples.pdf) + * Development transparency - towards the OriginTrail Ecosystem community of developers, node holders and businesses + * Open Source Development - according to [Open Source Software](https://en.wikipedia.org/wiki/Open-source_model) principles + + Contribution ============ -OriginTrail network is an open source project. We happily invite you to join us in our mission of building decentralised world of supply chain. If you would like to contribute, you are more than welcome. +OriginTrail is an open source project. We happily invite you to join us in our mission of building decentralised world of supply chain. If you would like to contribute, you are more than welcome. + + +### Useful links + + +[OriginTrail website](https://origintrail.io) + +[OriginTrail documentation page](http://docs.origintrail.io) + +[OriginTrail Discord Group](https://discordapp.com/invite/FCgYk2S) + +[OriginTrail Telegram Group](https://t.me/origintrail) + +[OriginTrail Twitter](https://twitter.com/origin_trail) + From 5fb136e5d22778127bfde6878f8cd7c74f7a10ea Mon Sep 17 00:00:00 2001 From: Djordje Kovacevic Date: Wed, 14 Oct 2020 11:42:14 +0200 Subject: [PATCH 2/4] Lint error fixed --- modules/network/kademlia/kademlia.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/network/kademlia/kademlia.js b/modules/network/kademlia/kademlia.js index 3daee85bf1..426c8f556f 100644 --- a/modules/network/kademlia/kademlia.js +++ b/modules/network/kademlia/kademlia.js @@ -893,7 +893,6 @@ class Kademlia { } - _filterRoutingTable() { const message = {}; const nodesToRemove = []; From 4816cc68f9411cb3b0e0576667829ebc973bf2ba Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 22 Oct 2020 12:32:17 +0200 Subject: [PATCH 3/4] Replication request optimization --- modules/network/kademlia/kademlia.js | 49 -------------------------- modules/service/replication-service.js | 10 +++++- 2 files changed, 9 insertions(+), 50 deletions(-) diff --git a/modules/network/kademlia/kademlia.js b/modules/network/kademlia/kademlia.js index 426c8f556f..3bb326d50b 100644 --- a/modules/network/kademlia/kademlia.js +++ b/modules/network/kademlia/kademlia.js @@ -213,8 +213,6 @@ class Kademlia { if (!fs.existsSync(peerCacheFilePath)) { fs.writeFileSync(peerCacheFilePath, '{}'); - } else { - this._filterContacts(peerCacheFilePath); } this.node.rolodex = this.node.plugin(kadence.rolodex(peerCacheFilePath)); @@ -277,7 +275,6 @@ class Kademlia { if (entry) { this.log.info(`Connected to network via ${entry}`); this.log.info(`Discovered ${this.node.router.size} peers from seed`); - this._filterContacts(peerCacheFilePath); } resolve(); }); @@ -891,52 +888,6 @@ class Kademlia { } return null; } - - - _filterRoutingTable() { - const message = {}; - const nodesToRemove = []; - - this.node.router.forEach((value, key, map) => { - if (value.length > 0) { - value.forEach((bValue, bKey, bMap) => { - if (bValue.network_id !== this.config.network.id) { - nodesToRemove.push(bKey); - } else { - message[bKey] = bValue; - } - }); - } - }); - - for (const nod of nodesToRemove) { - this.node.router.removeContactByNodeId(nod); - } - - return message; - } - - _filterPeerCache(peerCacheFilePath) { - const peerCacheFile = fs.readFileSync(peerCacheFilePath); - - const peerCache = JSON.parse(peerCacheFile); - - for (const id in peerCache) { - const elem = peerCache[id]; - if (elem.network_id !== this.config.network.id) { - delete peerCache[id]; - } - } - - fs.writeFileSync(peerCacheFilePath, JSON.stringify(peerCache)); - - return peerCache; - } - - _filterContacts(peerCacheFilePath) { - this._filterPeerCache(peerCacheFilePath); - this._filterRoutingTable(); - } } module.exports = Kademlia; diff --git a/modules/service/replication-service.js b/modules/service/replication-service.js index 9a63ce03f4..36bcf3693a 100644 --- a/modules/service/replication-service.js +++ b/modules/service/replication-service.js @@ -26,6 +26,7 @@ class ReplicationService { this.challengeService = ctx.challengeService; this.importService = ctx.importService; this.permissionedDataService = ctx.permissionedDataService; + this.replicationCache = {}; const replicationPath = path.join(this.config.appDataPath, 'replication_cache'); if (!fs.existsSync(replicationPath)) { @@ -59,7 +60,7 @@ class ReplicationService { const hashes = {}; const writeFilePromises = []; - + this.replicationCache[internalOfferId] = {}; for (let i = 0; i < 3; i += 1) { const color = this.castNumberToColor(i); @@ -100,6 +101,7 @@ class ReplicationService { distributionEpk: distEpk, }; + this.replicationCache[internalOfferId][color] = replication; writeFilePromises.push(this.saveReplication(internalOfferId, color, replication)); hashes[`${color}LitigationHash`] = litRootHash; @@ -158,6 +160,8 @@ class ReplicationService { this.logger.info(`Deleting replications directory and cache for offer with internal ID ${internalOfferId}`); const offerDirPath = this._getOfferDirPath(internalOfferId); await Utilities.deleteDirectory(offerDirPath); + + delete this.replicationCache[internalOfferId]; } /** @@ -178,6 +182,10 @@ class ReplicationService { * @return {Promise<*>} */ async loadReplication(internalOfferId, color) { + if (this.replicationCache[internalOfferId]) { + this.logger.trace(`Loaded replication from cache for offer internal ID ${internalOfferId} and color ${color}`); + return this.replicationCache[internalOfferId][color]; + } const offerDirPath = this._getOfferDirPath(internalOfferId); const colorFilePath = path.join(offerDirPath, `${color}.json`); From 84d0c350eee75255c8dbdf8e851990a9bdf721f3 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 22 Oct 2020 12:39:14 +0200 Subject: [PATCH 4/4] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7f6bc388f3..bfde616202 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "4.1.10", + "version": "4.1.11", "description": "OriginTrail node", "main": ".eslintrc.js", "config": {