diff --git a/README.md b/README.md index 72bcd35e6..0c4520efc 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) + diff --git a/modules/network/kademlia/kademlia.js b/modules/network/kademlia/kademlia.js index 3daee85bf..3bb326d50 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,53 +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 9a63ce03f..36bcf3693 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`); diff --git a/package.json b/package.json index 7f6bc388f..bfde61620 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": {