dkg 8.0.0a3__tar.gz → 8.0.1__tar.gz
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.
- {dkg-8.0.0a3 → dkg-8.0.1}/PKG-INFO +28 -19
- {dkg-8.0.0a3 → dkg-8.0.1}/README.md +24 -17
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/__init__.py +1 -1
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/assertion.py +2 -2
- dkg-8.0.1/dkg/clients/__init__.py +4 -0
- dkg-8.0.1/dkg/clients/async_dkg.py +109 -0
- dkg-8.0.0a3/dkg/main.py → dkg-8.0.1/dkg/clients/dkg.py +42 -21
- dkg-8.0.1/dkg/constants.py +180 -0
- dkg-8.0.1/dkg/data/interfaces/AskStorage.json +366 -0
- dkg-8.0.1/dkg/data/interfaces/Chronos.json +202 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/data/interfaces/Hub.json +294 -2
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/data/interfaces/IdentityStorage.json +58 -0
- dkg-8.0.0a3/dkg/data/interfaces/ContentAsset.json → dkg-8.0.1/dkg/data/interfaces/KnowledgeCollection.json +256 -343
- dkg-8.0.1/dkg/data/interfaces/KnowledgeCollectionStorage.json +2312 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/data/interfaces/Paranet.json +30 -214
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/data/interfaces/ParanetIncentivesPoolFactory.json +18 -2
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/data/interfaces/ParanetKnowledgeMinersRegistry.json +20 -4
- dkg-8.0.0a3/dkg/data/interfaces/ParanetNeurowebIncentivesPool.json → dkg-8.0.1/dkg/data/interfaces/ParanetNeuroIncentivesPool.json +7 -7
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/data/interfaces/ParanetsRegistry.json +102 -32
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/data/interfaces/Token.json +146 -17
- dkg-8.0.1/dkg/managers/async_manager.py +69 -0
- {dkg-8.0.0a3/dkg → dkg-8.0.1/dkg/managers}/manager.py +5 -3
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/method.py +5 -2
- dkg-8.0.1/dkg/modules/__init__.py +0 -0
- dkg-8.0.1/dkg/modules/asset/__init__.py +0 -0
- dkg-8.0.1/dkg/modules/asset/asset.py +739 -0
- dkg-8.0.1/dkg/modules/asset/async_asset.py +751 -0
- dkg-8.0.1/dkg/modules/async_module.py +66 -0
- dkg-8.0.1/dkg/modules/graph/__init__.py +0 -0
- dkg-8.0.1/dkg/modules/graph/async_graph.py +118 -0
- dkg-8.0.1/dkg/modules/graph/graph.py +94 -0
- {dkg-8.0.0a3/dkg → dkg-8.0.1/dkg/modules}/module.py +1 -1
- dkg-8.0.1/dkg/modules/network/__init__.py +0 -0
- {dkg-8.0.0a3/dkg → dkg-8.0.1/dkg/modules/network}/network.py +4 -4
- dkg-8.0.1/dkg/modules/node/__init__.py +0 -0
- dkg-8.0.1/dkg/modules/node/async_node.py +39 -0
- {dkg-8.0.0a3/dkg → dkg-8.0.1/dkg/modules/node}/node.py +2 -2
- dkg-8.0.1/dkg/modules/paranet/__init__.py +0 -0
- {dkg-8.0.0a3/dkg → dkg-8.0.1/dkg/modules/paranet}/paranet.py +2 -2
- dkg-8.0.1/dkg/providers/__init__.py +9 -0
- dkg-8.0.1/dkg/providers/blockchain/__init__.py +4 -0
- dkg-8.0.1/dkg/providers/blockchain/async_blockchain.py +245 -0
- dkg-8.0.1/dkg/providers/blockchain/base_blockchain.py +102 -0
- {dkg-8.0.0a3/dkg/providers → dkg-8.0.1/dkg/providers/blockchain}/blockchain.py +15 -96
- dkg-8.0.1/dkg/providers/node/__init__.py +4 -0
- dkg-8.0.1/dkg/providers/node/async_node_http.py +72 -0
- dkg-8.0.1/dkg/providers/node/base_node_http.py +25 -0
- {dkg-8.0.0a3/dkg/providers → dkg-8.0.1/dkg/providers/node}/node_http.py +12 -10
- dkg-8.0.1/dkg/services/__init__.py +0 -0
- dkg-8.0.1/dkg/services/blockchain_services/__init__.py +0 -0
- dkg-8.0.1/dkg/services/blockchain_services/async_blockchain_service.py +180 -0
- dkg-8.0.1/dkg/services/blockchain_services/blockchain_service.py +174 -0
- dkg-8.0.1/dkg/services/input_service.py +183 -0
- dkg-8.0.1/dkg/services/node_services/__init__.py +0 -0
- dkg-8.0.1/dkg/services/node_services/async_node_service.py +184 -0
- dkg-8.0.1/dkg/services/node_services/node_service.py +167 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/types/__init__.py +11 -11
- dkg-8.0.1/dkg/utils/__init__.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/utils/blockchain_request.py +68 -42
- dkg-8.0.1/dkg/utils/knowledge_asset_tools.py +5 -0
- dkg-8.0.1/dkg/utils/knowledge_collection_tools.py +248 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/utils/node_request.py +59 -13
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/utils/rdf.py +9 -3
- {dkg-8.0.0a3 → dkg-8.0.1}/pyproject.toml +5 -3
- dkg-8.0.0a3/dkg/asset.py +0 -912
- dkg-8.0.0a3/dkg/constants.py +0 -69
- dkg-8.0.0a3/dkg/data/interfaces/AssertionStorage.json +0 -229
- dkg-8.0.0a3/dkg/data/interfaces/ContentAssetStorage.json +0 -706
- dkg-8.0.0a3/dkg/data/interfaces/ServiceAgreementStorageProxy.json +0 -1314
- dkg-8.0.0a3/dkg/graph.py +0 -63
- dkg-8.0.0a3/dkg/providers/__init__.py +0 -2
- {dkg-8.0.0a3 → dkg-8.0.1}/LICENSE +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/NOTICE +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/dataclasses.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/exceptions.py +0 -0
- {dkg-8.0.0a3/dkg/utils → dkg-8.0.1/dkg/managers}/__init__.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/types/blockchain.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/types/dkg_node.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/types/encoding.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/types/evm.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/types/general.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/types/generics.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/types/network.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/types/rdf.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/utils/decorators.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/utils/merkle.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/utils/metadata.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/utils/string_transformations.py +0 -0
- {dkg-8.0.0a3 → dkg-8.0.1}/dkg/utils/ual.py +0 -0
@@ -1,22 +1,24 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dkg
|
3
|
-
Version: 8.0.
|
3
|
+
Version: 8.0.1
|
4
4
|
Summary: Python library for interacting with the OriginTrail Decentralized Knowledge Graph
|
5
5
|
License: Apache-2.0
|
6
6
|
Author: Uladzislau Hubar
|
7
|
-
Author-email: hubar.uladzislau@gmail.com
|
7
|
+
Author-email: hubar.uladzislau@gmail.com>, Zvonimir Sculac <zvonimir.sculac@origin-trail.com
|
8
8
|
Requires-Python: >=3.10,<4.0
|
9
9
|
Classifier: License :: OSI Approved :: Apache Software License
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
14
15
|
Requires-Dist: eth-abi (>=5.1.0,<6.0.0)
|
15
16
|
Requires-Dist: eth-account (>=0.13.4,<0.14.0)
|
16
17
|
Requires-Dist: eth-typing (>=5.0.0,<6.0.0)
|
17
18
|
Requires-Dist: hexbytes (>=1.2.1,<2.0.0)
|
18
19
|
Requires-Dist: ot-pyld (>=2.1.1,<3.0.0)
|
19
20
|
Requires-Dist: pandas (>=2.2.3,<3.0.0)
|
21
|
+
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
20
22
|
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
21
23
|
Requires-Dist: rdflib (>=6.3.2,<7.0.0)
|
22
24
|
Requires-Dist: web3 (>=7.3.0,<8.0.0)
|
@@ -24,7 +26,7 @@ Description-Content-Type: text/markdown
|
|
24
26
|
|
25
27
|
<a name="readme-top"></a>
|
26
28
|
|
27
|
-
|
29
|
+
---
|
28
30
|
|
29
31
|
<br />
|
30
32
|
<div align="center">
|
@@ -75,7 +77,7 @@ ___
|
|
75
77
|
</ol>
|
76
78
|
</details>
|
77
79
|
|
78
|
-
|
80
|
+
---
|
79
81
|
|
80
82
|
<br/>
|
81
83
|
|
@@ -85,6 +87,7 @@ ___
|
|
85
87
|
<summary>
|
86
88
|
|
87
89
|
### **What is the Decentralized Knowledge Graph?**
|
90
|
+
|
88
91
|
</summary>
|
89
92
|
|
90
93
|
<br/>
|
@@ -94,17 +97,19 @@ ___
|
|
94
97
|
</div>
|
95
98
|
|
96
99
|
OriginTrail Decentralized Knowledge Graph (DKG), hosted on the OriginTrail Decentralized Network (ODN) as trusted knowledge infrastructure, is shared global Knowledge Graph of Knowledge Assets. Running on the basis of the permissionless multi-chain OriginTrail protocol, it combines blockchains and knowledge graph technology to enable trusted AI applications based on key W3C standards.
|
100
|
+
|
97
101
|
</details>
|
98
102
|
|
99
103
|
<details open>
|
100
104
|
<summary>
|
101
105
|
|
102
106
|
### **The OriginTrail DKG Architecture**
|
107
|
+
|
103
108
|
</summary>
|
104
109
|
|
105
110
|
<br/>
|
106
111
|
|
107
|
-
The OriginTrail tech stack is a three layer structure, consisting of the multi-chain consensus layer (OriginTrail layer 1, running on multiple blockchains), the Decentralized Knowledge Graph layer (OriginTrail Layer 2, hosted on the ODN) and Trusted Knowledge applications in the application layer.
|
112
|
+
The OriginTrail tech stack is a three layer structure, consisting of the multi-chain consensus layer (OriginTrail layer 1, running on multiple blockchains), the Decentralized Knowledge Graph layer (OriginTrail Layer 2, hosted on the ODN) and Trusted Knowledge applications in the application layer.
|
108
113
|
|
109
114
|
<div align="center">
|
110
115
|
<img src="images/dkg-architecture.png" alt="DKG Architecture" width="400">
|
@@ -112,13 +117,15 @@ The OriginTrail tech stack is a three layer structure, consisting of the multi-c
|
|
112
117
|
|
113
118
|
Further, the architecture differentiates between **the public, replicated knowledge graph** shared by all network nodes according to the protocol, and **private Knowledge graphs** hosted separately by each of the OriginTrail nodes.
|
114
119
|
|
115
|
-
**Anyone can run an OriginTrail node and become part of the ODN, contributing
|
120
|
+
**Anyone can run an OriginTrail node and become part of the ODN, contributing to the network capacity and hosting the OriginTrail DKG. The OriginTrail node is the ultimate data service for data and knowledge intensive Web3 applications and is used as the key backbone for trusted AI applications (see https://chatdkg.ai)**
|
121
|
+
|
116
122
|
</details>
|
117
123
|
|
118
124
|
<details open>
|
119
125
|
<summary>
|
120
126
|
|
121
127
|
### **What is a Knowledge Asset?**
|
128
|
+
|
122
129
|
</summary>
|
123
130
|
|
124
131
|
<br/>
|
@@ -130,15 +137,16 @@ Further, the architecture differentiates between **the public, replicated knowle
|
|
130
137
|
**Knowledge Asset is the new, AI‑ready resource for the Internet**
|
131
138
|
|
132
139
|
Knowledge Assets are verifiable containers of structured knowledge that live on the OriginTrail DKG and provide:
|
140
|
+
|
133
141
|
- **Discoverability - UAL is the new URL**. Uniform Asset Locators (UALs, based on the W3C Decentralized Identifiers) are a new Web3 knowledge identifier (extensions of the Uniform Resource Locators - URLs) which identify a specific piece of knowledge and make it easy to find and connect with other Knowledge Assets.
|
134
142
|
- **Ownership - NFTs enable ownership**. Each Knowledge Asset contains an NFT token that enables ownership, knowledge asset administration and market mechanisms.
|
135
143
|
- **Verifiability - On-chain information origin and verifiable trail**. The blockchain tech increases trust, security, transparency, and the traceability of information.
|
136
144
|
|
137
|
-
|
138
145
|
By their nature, Knowledge Assets are semantic resources (following the W3C Semantic Web set of standards), and through their symbolic representations inherently AI ready. See more at https://chatdkg.ai
|
139
146
|
<br/>
|
140
147
|
|
141
148
|
**Discover Knowledge Assets with the DKG Explorer:**
|
149
|
+
|
142
150
|
<div align="center">
|
143
151
|
<table>
|
144
152
|
<tr>
|
@@ -170,7 +178,6 @@ By their nature, Knowledge Assets are semantic resources (following the W3C Sema
|
|
170
178
|
</table>
|
171
179
|
</div>
|
172
180
|
|
173
|
-
|
174
181
|
</details>
|
175
182
|
|
176
183
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
@@ -178,40 +185,43 @@ By their nature, Knowledge Assets are semantic resources (following the W3C Sema
|
|
178
185
|
|
179
186
|
## 🚀 Getting Started
|
180
187
|
|
181
|
-
|
188
|
+
---
|
182
189
|
|
183
190
|
### Prerequisites
|
184
191
|
|
185
|
-
|
186
|
-
|
187
|
-
|
192
|
+
- python `>=3.10`
|
193
|
+
- poetry `>=1.5.1`
|
188
194
|
|
189
195
|
In order to use in the local environment, make sure to [run the local DKG network](https://github.com/OriginTrail/ot-node?tab=readme-ov-file#local-network-setup).
|
190
196
|
|
191
|
-
|
197
|
+
---
|
198
|
+
|
192
199
|
<br/>
|
193
200
|
|
194
201
|
### Installation
|
195
202
|
|
196
|
-
|
197
203
|
Create virtual environment (you can choose any existing folder this command will create configurations and virtual env for python):
|
204
|
+
|
198
205
|
```bash
|
199
206
|
python3 -m venv /path/to/folder
|
200
207
|
```
|
201
208
|
|
202
209
|
Inside of previously generated folder you will find activate script in bin folder and run it:
|
210
|
+
|
203
211
|
```bash
|
204
212
|
source /path/to/folder/bin/activate
|
205
213
|
```
|
206
214
|
|
207
|
-
Install dependencies:
|
215
|
+
Install dependencies and configure pre-commit hooks:
|
216
|
+
|
208
217
|
```bash
|
209
|
-
|
218
|
+
make install
|
210
219
|
```
|
211
220
|
|
212
221
|
Now you can run a demo example file (you need to have the local DKG network running):
|
222
|
+
|
213
223
|
```bash
|
214
|
-
|
224
|
+
make run-demo
|
215
225
|
```
|
216
226
|
|
217
227
|
<br/>
|
@@ -252,7 +262,6 @@ Don't forget to give the project a star! Thanks again!
|
|
252
262
|
|
253
263
|
- [web3.py](https://github.com/ethereum/web3.py): Basis for this project
|
254
264
|
|
255
|
-
|
256
265
|
<br/>
|
257
266
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
258
267
|
|
@@ -287,5 +296,5 @@ Don't forget to give the project a star! Thanks again!
|
|
287
296
|
</a>
|
288
297
|
</div>
|
289
298
|
|
290
|
-
|
299
|
+
---
|
291
300
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<a name="readme-top"></a>
|
2
2
|
|
3
|
-
|
3
|
+
---
|
4
4
|
|
5
5
|
<br />
|
6
6
|
<div align="center">
|
@@ -51,7 +51,7 @@ ___
|
|
51
51
|
</ol>
|
52
52
|
</details>
|
53
53
|
|
54
|
-
|
54
|
+
---
|
55
55
|
|
56
56
|
<br/>
|
57
57
|
|
@@ -61,6 +61,7 @@ ___
|
|
61
61
|
<summary>
|
62
62
|
|
63
63
|
### **What is the Decentralized Knowledge Graph?**
|
64
|
+
|
64
65
|
</summary>
|
65
66
|
|
66
67
|
<br/>
|
@@ -70,17 +71,19 @@ ___
|
|
70
71
|
</div>
|
71
72
|
|
72
73
|
OriginTrail Decentralized Knowledge Graph (DKG), hosted on the OriginTrail Decentralized Network (ODN) as trusted knowledge infrastructure, is shared global Knowledge Graph of Knowledge Assets. Running on the basis of the permissionless multi-chain OriginTrail protocol, it combines blockchains and knowledge graph technology to enable trusted AI applications based on key W3C standards.
|
74
|
+
|
73
75
|
</details>
|
74
76
|
|
75
77
|
<details open>
|
76
78
|
<summary>
|
77
79
|
|
78
80
|
### **The OriginTrail DKG Architecture**
|
81
|
+
|
79
82
|
</summary>
|
80
83
|
|
81
84
|
<br/>
|
82
85
|
|
83
|
-
The OriginTrail tech stack is a three layer structure, consisting of the multi-chain consensus layer (OriginTrail layer 1, running on multiple blockchains), the Decentralized Knowledge Graph layer (OriginTrail Layer 2, hosted on the ODN) and Trusted Knowledge applications in the application layer.
|
86
|
+
The OriginTrail tech stack is a three layer structure, consisting of the multi-chain consensus layer (OriginTrail layer 1, running on multiple blockchains), the Decentralized Knowledge Graph layer (OriginTrail Layer 2, hosted on the ODN) and Trusted Knowledge applications in the application layer.
|
84
87
|
|
85
88
|
<div align="center">
|
86
89
|
<img src="images/dkg-architecture.png" alt="DKG Architecture" width="400">
|
@@ -88,13 +91,15 @@ The OriginTrail tech stack is a three layer structure, consisting of the multi-c
|
|
88
91
|
|
89
92
|
Further, the architecture differentiates between **the public, replicated knowledge graph** shared by all network nodes according to the protocol, and **private Knowledge graphs** hosted separately by each of the OriginTrail nodes.
|
90
93
|
|
91
|
-
**Anyone can run an OriginTrail node and become part of the ODN, contributing
|
94
|
+
**Anyone can run an OriginTrail node and become part of the ODN, contributing to the network capacity and hosting the OriginTrail DKG. The OriginTrail node is the ultimate data service for data and knowledge intensive Web3 applications and is used as the key backbone for trusted AI applications (see https://chatdkg.ai)**
|
95
|
+
|
92
96
|
</details>
|
93
97
|
|
94
98
|
<details open>
|
95
99
|
<summary>
|
96
100
|
|
97
101
|
### **What is a Knowledge Asset?**
|
102
|
+
|
98
103
|
</summary>
|
99
104
|
|
100
105
|
<br/>
|
@@ -106,15 +111,16 @@ Further, the architecture differentiates between **the public, replicated knowle
|
|
106
111
|
**Knowledge Asset is the new, AI‑ready resource for the Internet**
|
107
112
|
|
108
113
|
Knowledge Assets are verifiable containers of structured knowledge that live on the OriginTrail DKG and provide:
|
114
|
+
|
109
115
|
- **Discoverability - UAL is the new URL**. Uniform Asset Locators (UALs, based on the W3C Decentralized Identifiers) are a new Web3 knowledge identifier (extensions of the Uniform Resource Locators - URLs) which identify a specific piece of knowledge and make it easy to find and connect with other Knowledge Assets.
|
110
116
|
- **Ownership - NFTs enable ownership**. Each Knowledge Asset contains an NFT token that enables ownership, knowledge asset administration and market mechanisms.
|
111
117
|
- **Verifiability - On-chain information origin and verifiable trail**. The blockchain tech increases trust, security, transparency, and the traceability of information.
|
112
118
|
|
113
|
-
|
114
119
|
By their nature, Knowledge Assets are semantic resources (following the W3C Semantic Web set of standards), and through their symbolic representations inherently AI ready. See more at https://chatdkg.ai
|
115
120
|
<br/>
|
116
121
|
|
117
122
|
**Discover Knowledge Assets with the DKG Explorer:**
|
123
|
+
|
118
124
|
<div align="center">
|
119
125
|
<table>
|
120
126
|
<tr>
|
@@ -146,7 +152,6 @@ By their nature, Knowledge Assets are semantic resources (following the W3C Sema
|
|
146
152
|
</table>
|
147
153
|
</div>
|
148
154
|
|
149
|
-
|
150
155
|
</details>
|
151
156
|
|
152
157
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
@@ -154,40 +159,43 @@ By their nature, Knowledge Assets are semantic resources (following the W3C Sema
|
|
154
159
|
|
155
160
|
## 🚀 Getting Started
|
156
161
|
|
157
|
-
|
162
|
+
---
|
158
163
|
|
159
164
|
### Prerequisites
|
160
165
|
|
161
|
-
|
162
|
-
|
163
|
-
|
166
|
+
- python `>=3.10`
|
167
|
+
- poetry `>=1.5.1`
|
164
168
|
|
165
169
|
In order to use in the local environment, make sure to [run the local DKG network](https://github.com/OriginTrail/ot-node?tab=readme-ov-file#local-network-setup).
|
166
170
|
|
167
|
-
|
171
|
+
---
|
172
|
+
|
168
173
|
<br/>
|
169
174
|
|
170
175
|
### Installation
|
171
176
|
|
172
|
-
|
173
177
|
Create virtual environment (you can choose any existing folder this command will create configurations and virtual env for python):
|
178
|
+
|
174
179
|
```bash
|
175
180
|
python3 -m venv /path/to/folder
|
176
181
|
```
|
177
182
|
|
178
183
|
Inside of previously generated folder you will find activate script in bin folder and run it:
|
184
|
+
|
179
185
|
```bash
|
180
186
|
source /path/to/folder/bin/activate
|
181
187
|
```
|
182
188
|
|
183
|
-
Install dependencies:
|
189
|
+
Install dependencies and configure pre-commit hooks:
|
190
|
+
|
184
191
|
```bash
|
185
|
-
|
192
|
+
make install
|
186
193
|
```
|
187
194
|
|
188
195
|
Now you can run a demo example file (you need to have the local DKG network running):
|
196
|
+
|
189
197
|
```bash
|
190
|
-
|
198
|
+
make run-demo
|
191
199
|
```
|
192
200
|
|
193
201
|
<br/>
|
@@ -228,7 +236,6 @@ Don't forget to give the project a star! Thanks again!
|
|
228
236
|
|
229
237
|
- [web3.py](https://github.com/ethereum/web3.py): Basis for this project
|
230
238
|
|
231
|
-
|
232
239
|
<br/>
|
233
240
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
234
241
|
|
@@ -263,4 +270,4 @@ Don't forget to give the project a star! Thanks again!
|
|
263
270
|
</a>
|
264
271
|
</div>
|
265
272
|
|
266
|
-
|
273
|
+
---
|
@@ -17,8 +17,8 @@
|
|
17
17
|
|
18
18
|
from typing import Literal
|
19
19
|
|
20
|
-
from dkg.manager import DefaultRequestManager
|
21
|
-
from dkg.module import Module
|
20
|
+
from dkg.managers.manager import DefaultRequestManager
|
21
|
+
from dkg.modules.module import Module
|
22
22
|
from dkg.types import JSONLD, HexStr
|
23
23
|
from dkg.utils.merkle import MerkleTree, hash_assertion_with_indexes
|
24
24
|
from dkg.utils.metadata import generate_assertion_metadata
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
from functools import wraps
|
19
|
+
|
20
|
+
|
21
|
+
from dkg.modules.asset.async_asset import AsyncKnowledgeAsset
|
22
|
+
from dkg.modules.graph.async_graph import AsyncGraph
|
23
|
+
from dkg.managers.async_manager import AsyncRequestManager
|
24
|
+
from dkg.modules.async_module import AsyncModule
|
25
|
+
from dkg.modules.node.async_node import AsyncNode
|
26
|
+
from dkg.types import UAL, Address, ChecksumAddress
|
27
|
+
from dkg.utils.ual import format_ual, parse_ual
|
28
|
+
from dkg.services.input_service import InputService
|
29
|
+
from dkg.providers.blockchain.async_blockchain import AsyncBlockchainProvider
|
30
|
+
from dkg.providers.node.async_node_http import AsyncNodeHTTPProvider
|
31
|
+
from dkg.services.node_services.async_node_service import AsyncNodeService
|
32
|
+
from dkg.services.blockchain_services.async_blockchain_service import (
|
33
|
+
AsyncBlockchainService,
|
34
|
+
)
|
35
|
+
|
36
|
+
|
37
|
+
class AsyncDKG(AsyncModule):
|
38
|
+
asset: AsyncKnowledgeAsset
|
39
|
+
node: AsyncNode
|
40
|
+
graph: AsyncGraph
|
41
|
+
|
42
|
+
def __init__(
|
43
|
+
self,
|
44
|
+
node_provider: AsyncNodeHTTPProvider,
|
45
|
+
blockchain_provider: AsyncBlockchainProvider,
|
46
|
+
config: dict = {},
|
47
|
+
):
|
48
|
+
self.manager = AsyncRequestManager(node_provider, blockchain_provider)
|
49
|
+
|
50
|
+
self.initialize_services(config)
|
51
|
+
|
52
|
+
modules = {
|
53
|
+
"asset": AsyncKnowledgeAsset(
|
54
|
+
self.manager,
|
55
|
+
self.input_service,
|
56
|
+
self.node_service,
|
57
|
+
self.blockchain_service,
|
58
|
+
),
|
59
|
+
"node": AsyncNode(self.manager, self.node_service),
|
60
|
+
"graph": AsyncGraph(self.manager, self.input_service, self.node_service),
|
61
|
+
}
|
62
|
+
self._attach_modules(modules)
|
63
|
+
|
64
|
+
self._setup_backwards_compatibility()
|
65
|
+
|
66
|
+
def _setup_backwards_compatibility(self):
|
67
|
+
# Create async wrapper methods
|
68
|
+
async def graph_get(*args, **kwargs):
|
69
|
+
return await self.asset.get(*args, **kwargs)
|
70
|
+
|
71
|
+
async def graph_create(*args, **kwargs):
|
72
|
+
return await self.asset.create(*args, **kwargs)
|
73
|
+
|
74
|
+
# Attach methods to graph
|
75
|
+
self.graph.get = graph_get
|
76
|
+
self.graph.create = graph_create
|
77
|
+
|
78
|
+
def initialize_services(self, config: dict = {}):
|
79
|
+
self.input_service = InputService(self.manager, config)
|
80
|
+
self.node_service = AsyncNodeService(self.manager)
|
81
|
+
self.blockchain_service = AsyncBlockchainService(self.manager)
|
82
|
+
|
83
|
+
@staticmethod
|
84
|
+
@wraps(format_ual)
|
85
|
+
def format_ual(
|
86
|
+
blockchain: str, contract_address: Address | ChecksumAddress, token_id: int
|
87
|
+
) -> UAL:
|
88
|
+
return format_ual(blockchain, contract_address, token_id)
|
89
|
+
|
90
|
+
@staticmethod
|
91
|
+
@wraps(parse_ual)
|
92
|
+
def parse_ual(ual: UAL) -> dict[str, str | Address | int]:
|
93
|
+
return parse_ual(ual)
|
94
|
+
|
95
|
+
@property
|
96
|
+
def node_provider(self) -> AsyncNodeHTTPProvider:
|
97
|
+
return self.manager.node_provider
|
98
|
+
|
99
|
+
@node_provider.setter
|
100
|
+
def node_provider(self, node_provider: AsyncNodeHTTPProvider) -> None:
|
101
|
+
self.manager.node_provider = node_provider
|
102
|
+
|
103
|
+
@property
|
104
|
+
def blockchain_provider(self) -> AsyncBlockchainProvider:
|
105
|
+
return self.manager.blockchain_provider
|
106
|
+
|
107
|
+
@blockchain_provider.setter
|
108
|
+
def blockchain_provider(self, blockchain_provider: AsyncBlockchainProvider) -> None:
|
109
|
+
self.manager.blockchain_provider = blockchain_provider
|
@@ -18,16 +18,19 @@
|
|
18
18
|
from functools import wraps
|
19
19
|
|
20
20
|
from dkg.assertion import Assertion
|
21
|
-
from dkg.asset import KnowledgeAsset
|
22
|
-
from dkg.graph import Graph
|
23
|
-
from dkg.manager import DefaultRequestManager
|
24
|
-
from dkg.module import Module
|
25
|
-
from dkg.network import Network
|
26
|
-
from dkg.node import Node
|
27
|
-
from dkg.paranet import Paranet
|
21
|
+
from dkg.modules.asset.asset import KnowledgeAsset
|
22
|
+
from dkg.modules.graph.graph import Graph
|
23
|
+
from dkg.managers.manager import DefaultRequestManager
|
24
|
+
from dkg.modules.module import Module
|
25
|
+
from dkg.modules.network.network import Network
|
26
|
+
from dkg.modules.node.node import Node
|
27
|
+
from dkg.modules.paranet.paranet import Paranet
|
28
28
|
from dkg.providers import BlockchainProvider, NodeHTTPProvider
|
29
29
|
from dkg.types import UAL, Address, ChecksumAddress
|
30
30
|
from dkg.utils.ual import format_ual, parse_ual
|
31
|
+
from dkg.services.input_service import InputService
|
32
|
+
from dkg.services.node_services.node_service import NodeService
|
33
|
+
from dkg.services.blockchain_services.blockchain_service import BlockchainService
|
31
34
|
|
32
35
|
|
33
36
|
class DKG(Module):
|
@@ -38,34 +41,52 @@ class DKG(Module):
|
|
38
41
|
node: Node
|
39
42
|
graph: Graph
|
40
43
|
|
41
|
-
@staticmethod
|
42
|
-
@wraps(format_ual)
|
43
|
-
def format_ual(
|
44
|
-
blockchain: str, contract_address: Address | ChecksumAddress, token_id: int
|
45
|
-
) -> UAL:
|
46
|
-
return format_ual(blockchain, contract_address, token_id)
|
47
|
-
|
48
|
-
@staticmethod
|
49
|
-
@wraps(parse_ual)
|
50
|
-
def parse_ual(ual: UAL) -> dict[str, str | Address | int]:
|
51
|
-
return parse_ual(ual)
|
52
|
-
|
53
44
|
def __init__(
|
54
45
|
self,
|
55
46
|
node_provider: NodeHTTPProvider,
|
56
47
|
blockchain_provider: BlockchainProvider,
|
48
|
+
config: dict = {},
|
57
49
|
):
|
58
50
|
self.manager = DefaultRequestManager(node_provider, blockchain_provider)
|
51
|
+
|
52
|
+
self.initialize_services(config)
|
53
|
+
|
59
54
|
modules = {
|
60
55
|
"assertion": Assertion(self.manager),
|
61
|
-
"asset": KnowledgeAsset(
|
56
|
+
"asset": KnowledgeAsset(
|
57
|
+
self.manager,
|
58
|
+
self.input_service,
|
59
|
+
self.node_service,
|
60
|
+
self.blockchain_service,
|
61
|
+
),
|
62
62
|
"paranet": Paranet(self.manager),
|
63
63
|
"network": Network(self.manager),
|
64
64
|
"node": Node(self.manager),
|
65
|
-
"graph": Graph(self.manager),
|
65
|
+
"graph": Graph(self.manager, self.input_service, self.node_service),
|
66
66
|
}
|
67
67
|
self._attach_modules(modules)
|
68
68
|
|
69
|
+
# Backwards compatibility
|
70
|
+
self.graph.get = self.asset.get.__get__(self.asset)
|
71
|
+
self.graph.create = self.asset.create.__get__(self.asset)
|
72
|
+
|
73
|
+
def initialize_services(self, config):
|
74
|
+
self.input_service = InputService(self.manager, config)
|
75
|
+
self.node_service = NodeService(self.manager)
|
76
|
+
self.blockchain_service = BlockchainService(self.manager)
|
77
|
+
|
78
|
+
@staticmethod
|
79
|
+
@wraps(format_ual)
|
80
|
+
def format_ual(
|
81
|
+
blockchain: str, contract_address: Address | ChecksumAddress, token_id: int
|
82
|
+
) -> UAL:
|
83
|
+
return format_ual(blockchain, contract_address, token_id)
|
84
|
+
|
85
|
+
@staticmethod
|
86
|
+
@wraps(parse_ual)
|
87
|
+
def parse_ual(ual: UAL) -> dict[str, str | Address | int]:
|
88
|
+
return parse_ual(ual)
|
89
|
+
|
69
90
|
@property
|
70
91
|
def node_provider(self) -> NodeHTTPProvider:
|
71
92
|
return self.manager.node_provider
|