neuronum 1.4.2__py3-none-any.whl → 1.5.0__py3-none-any.whl

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.

Potentially problematic release.


This version of neuronum might be problematic. Click here for more details.

neuronum/neuronum.py CHANGED
@@ -260,144 +260,12 @@ class Cell:
260
260
  print(f"Unexpected error: {e}")
261
261
 
262
262
 
263
- def sign_contract(self, contractID: str):
264
- full_url = f"https://{self.network}/api/sign_contract"
265
-
266
- sign_contract = {
267
- "contractID": contractID,
268
- "cell": self.to_dict()
269
- }
270
-
271
- try:
272
- response = requests.post(full_url, json=sign_contract)
273
- response.raise_for_status()
274
- return response.json()["token"]
275
- except requests.exceptions.RequestException as e:
276
- print(f"Error sending request: {e}")
277
- except Exception as e:
278
- print(f"Unexpected error: {e}")
279
-
280
-
281
- def validate_token(self, token: str, cp: str, contractID: str):
282
- full_url = f"https://{self.network}/api/validate_token"
283
-
284
- validate = {
285
- "token": token,
286
- "cp": cp,
287
- "contractID": contractID,
288
- "cell": self.to_dict()
289
- }
290
-
291
- try:
292
- response = requests.post(full_url, json=validate)
293
- response.raise_for_status()
294
- return response.json()["validity"]
295
- except requests.exceptions.RequestException as e:
296
- print(f"Error sending request: {e}")
297
- except Exception as e:
298
- print(f"Unexpected error: {e}")
299
-
300
-
301
- def request_token(self, cp: str, contractID: str):
302
- full_url = f"https://{self.network}/api/request_token"
303
-
304
- request_token = {
305
- "cp": cp,
306
- "contractID": contractID,
307
- "cell": self.to_dict()
308
- }
309
-
310
- try:
311
- response = requests.post(full_url, json=request_token)
312
- response.raise_for_status()
313
- print(response.json())
314
- except requests.exceptions.RequestException as e:
315
- print(f"Error sending request: {e}")
316
- except Exception as e:
317
- print(f"Unexpected error: {e}")
318
-
319
-
320
- def present_token(self, token: str, cp: str, contractID: str):
321
- full_url = f"https://{self.network}/api/present_token"
322
-
323
- present_token = {
324
- "token": token,
325
- "cp": cp,
326
- "contractID": contractID,
327
- "cell": self.to_dict()
328
- }
329
-
330
- try:
331
- response = requests.post(full_url, json=present_token)
332
- response.raise_for_status()
333
- print(response.json())
334
- except requests.exceptions.RequestException as e:
335
- print(f"Error sending request: {e}")
336
- except Exception as e:
337
- print(f"Unexpected error: {e}")
338
-
339
-
340
- def create_contract(self, descr: str, details: dict, partners: list):
341
- full_url = f"https://{self.network}/api/create_contract"
342
-
343
- create_contract = {
344
- "cell": self.to_dict(),
345
- "descr": descr,
346
- "details": details,
347
- "partners": partners
348
- }
349
- try:
350
- response = requests.post(full_url, json=create_contract)
351
- response.raise_for_status()
352
- return response.json()["contractID"]
353
- except requests.exceptions.RequestException as e:
354
- print(f"Error sending request: {e}")
355
- except Exception as e:
356
- print(f"Unexpected error: {e}")
357
-
358
-
359
- def delete_contract(self, contractID: str):
360
- full_url = f"https://{self.network}/api/delete_contract"
361
-
362
- request = {
363
- "cell": self.to_dict(),
364
- "contractID": contractID
365
- }
366
-
367
- try:
368
- response = requests.post(full_url, json=request)
369
- response.raise_for_status()
370
- print(f"Response from Neuronum: {response.json()}")
371
- except requests.exceptions.RequestException as e:
372
- print(f"Error sending request: {e}")
373
- except Exception as e:
374
- print(f"Unexpected error: {e}")
375
-
376
-
377
- def list_contracts(self, cp: str):
378
- full_url = f"https://{self.network}/api/list_contracts"
379
-
380
- list_contracts = {
381
- "cell": self.to_dict(),
382
- "cp": cp
383
- }
384
-
385
- try:
386
- response = requests.post(full_url, json=list_contracts)
387
- response.raise_for_status()
388
- return response.json()
389
- except requests.exceptions.RequestException as e:
390
- print(f"Error sending request: {e}")
391
- except Exception as e:
392
- print(f"Unexpected error: {e}")
393
-
394
-
395
- def list_tx(self, cp: str):
263
+ def list_tx(self, cellID: str):
396
264
  full_url = f"https://{self.network}/api/list_tx"
397
265
 
398
266
  list_tx = {
399
267
  "cell": self.to_dict(),
400
- "cp": cp
268
+ "cellID": cellID
401
269
  }
402
270
 
403
271
  try:
@@ -410,12 +278,12 @@ class Cell:
410
278
  print(f"Unexpected error: {e}")
411
279
 
412
280
 
413
- def list_ctx(self, cp: str):
281
+ def list_ctx(self, cellID: str):
414
282
  full_url = f"https://{self.network}/api/list_ctx"
415
283
 
416
284
  list_ctx = {
417
285
  "cell": self.to_dict(),
418
- "cp": cp
286
+ "cellID": cellID
419
287
  }
420
288
 
421
289
  try:
@@ -428,12 +296,12 @@ class Cell:
428
296
  print(f"Unexpected error: {e}")
429
297
 
430
298
 
431
- def list_stx(self, cp: str):
299
+ def list_stx(self, cellID: str):
432
300
  full_url = f"https://{self.network}/api/list_stx"
433
301
 
434
302
  list_stx = {
435
303
  "cell": self.to_dict(),
436
- "cp": cp
304
+ "cellID": cellID
437
305
  }
438
306
 
439
307
  try:
@@ -485,7 +353,6 @@ class Cell:
485
353
  print(f"Unexpected error: {e}")
486
354
 
487
355
 
488
-
489
356
  def load(self, label: str, ctx: Optional[str] = None):
490
357
  if ctx:
491
358
  full_url = f"https://{self.network}/api/load_from_ctx/{ctx}"
@@ -507,7 +374,6 @@ class Cell:
507
374
  print(f"Unexpected error: {e}")
508
375
 
509
376
 
510
-
511
377
  def delete(self, label: str, ctx: Optional[str] = None):
512
378
  if ctx:
513
379
  full_url = f"https://{self.network}/api/delete_from_ctx/{ctx}"
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.1
2
+ Name: neuronum
3
+ Version: 1.5.0
4
+ Summary: Interact with the Neuronum Network to build & automate interconnected networks of soft- and hardware components
5
+ Home-page: https://neuronum.net
6
+ Author: Neuronum Cybernetics
7
+ Author-email: welcome@neuronum.net
8
+ Project-URL: GitHub, https://github.com/neuronumcybernetics/neuronum
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.6
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests
16
+ Requires-Dist: websocket-client
17
+ Requires-Dist: iota-sdk
18
+
19
+ ![Neuronum Logo](https://neuronum.net/static/logo_pip.png "Neuronum")
20
+
21
+ [![Website](https://img.shields.io/badge/Website-Neuronum-blue)](https://neuronum.net)
22
+ [![Documentation](https://img.shields.io/badge/Docs-Read%20now-green)](https://github.com/neuronumcybernetics/neuronum)
23
+ [![Tutorials](https://img.shields.io/badge/Tutorials-Watch%20now-red)](https://www.youtube.com/@neuronumnet)
24
+
25
+ `Neuronum` is a cybernetic framework enabling businesses to build & automate interconnected networks of soft- and hardware components
26
+
27
+ ## Features
28
+ - **Cell**: Identity to connect and interact with the Neuronum Network
29
+ - **Transmitters (TX)**: Automate economic data transfer and storage
30
+ - **Circuits (CTX)**: Store data in a Key-Value-Label database
31
+ - **Streams (STX)**: Stream, synchronize and control data in real time
32
+ - **Nodes**: Soft-/Hardware components participating in the Network ecosystem
33
+
34
+ To interact with the Network you will need to create a Neuronum Cell.
35
+ Create your Cell: [Create Cell](https://neuronum.net/createcell)
36
+
37
+ Start with installing the Neuronum library using pip:
38
+ ```python
39
+ pip install neuronum
40
+ ```
41
+
42
+ Configure and test Cell connection:
43
+ ```python
44
+ import neuronum
45
+
46
+ cell = neuronum.Cell(
47
+ host="host::cell", # cell host
48
+ password="your_password", # cell password
49
+ network="neuronum.net", # cell network
50
+ synapse="your_synapse" # cell synapse
51
+ )
52
+ cell.connect() # connect to network
53
+ ```
54
+
55
+ ### Transmitters (TX)
56
+ Transmitters (TX) are used to create predefined templates to receive and send data in a standardized format. Data sent with TX is always and automatically stored in a predefined Circuit (CTX)
57
+
58
+ Create Transmitter (TX):
59
+ ```python
60
+ descr = "Test Transmitter" # description (max 25 characters)
61
+ key_values = { # defined keys and example values
62
+ "key1": "value1",
63
+ "key2": "value2",
64
+ "key3": "value3",
65
+ }
66
+ ctx = "id::ctx" # select Circuit (CTX)
67
+ label = "key1:key2" # label TX data
68
+ partners = ["id::cell", "id::cell"] # authorized Cells
69
+ txID = cell.create_tx(descr, key_values, ctx, label, partners)
70
+ ```
71
+
72
+ Activate Transmitter (TX):
73
+ ```python
74
+ TX = "id::tx" # select Transmitter (TX)
75
+ data = { # enter key-values
76
+ "key1": "value1",
77
+ "key2": "value2",
78
+ "key3": "value3",
79
+ }
80
+ cell.activate_tx(TX, data) # activate TX
81
+ ```
82
+
83
+ Delete Transmitter (TX):
84
+ ```python
85
+ TX = "id::tx" # select Transmitter (TX)
86
+ cell.delete_tx(TX) # delete TX
87
+ ```
88
+
89
+ List Transmitter (TX) from Cell:
90
+ ```python
91
+ cellID = "id::cell" # select Cell
92
+ txList = cell.list_tx(cellID) # list Transmitters (TX)
93
+ ```
94
+
95
+ ### Circuits (CTX)
96
+ Circuits (CTX) store and organize data sent via Transmitters (TX) using a Key-Value-Label system
97
+
98
+ Create Circuit (CTX):
99
+ ```python
100
+ descr = "Test Circuit" # description (max 25 characters)
101
+ partners = ["id::cell", "id::cell"] # authorized Cells
102
+ ctxID = cell.create_ctx(descr, partners) # create Circuit (CTX)
103
+ ```
104
+
105
+ Store data on your private Circuit (CTX):
106
+ ```python
107
+ label = "your_label" # data label (should be unique)
108
+ data = { # data as key-value pairs
109
+ "key1": "value1",
110
+ "key2": "value2",
111
+ "key3": "value3",
112
+ }
113
+ cell.store(label, data) # store data
114
+ ```
115
+
116
+ Store data on a public Circuit (CTX):
117
+ ```python
118
+ CTX = "id::ctx" # select Circuit (CTX
119
+ label = "your_label" # data label (should be unique)
120
+ data = { # data as key-value pairs
121
+ "key1": "value1",
122
+ "key2": "value2",
123
+ "key3": "value3",
124
+ }
125
+ cell.store(label, data, CTX) # store data
126
+ ```
127
+
128
+ Load data from your private Circuit (CTX):
129
+ ```python
130
+ label = "your_label" # select label
131
+ data = cell.load(label) # load data by label
132
+ key1 = data["key1"] # get data from key
133
+ key2 = data["key2"]
134
+ key3 = data["key3"]
135
+ print(key1, key2, key3) # print data
136
+ ```
137
+
138
+ Load data from a public Circuit (CTX):
139
+ ```python
140
+ CTX = "id::ctx" # select Circuit (CTX)
141
+ label = "your_label" # select label
142
+ data = cell.load(label, CTX) # load data by label
143
+ key1 = data["key1"] # get data from key
144
+ key2 = data["key2"]
145
+ key3 = data["key3"]
146
+ print(key1, key2, key3) # print data
147
+ ```
148
+
149
+ Delete data from your private Circuit (CTX):
150
+ ```python
151
+ label = "your_label" # select label
152
+ cell.delete(label) # delete data by label
153
+ ```
154
+
155
+ Delete data from a public Circuit (CTX):
156
+ ```python
157
+ CTX = "id::ctx" # select Circuits (CTX)
158
+ label = "your_label" # select label
159
+ cell.delete(label, CTX) # delete data by label
160
+ ```
161
+
162
+ Clear your private Circuit (CTX):
163
+ ```python
164
+ cell.clear() # clear Circuit (CTX)
165
+ ```
166
+
167
+ Clear Circuit (CTX):
168
+ ```python
169
+ CTX = "id::ctx" # select Circuit (CTX)
170
+ cell.clear(CTX) # clear CTX
171
+ ```
172
+
173
+ Delete Circuit (CTX):
174
+ ```python
175
+ CTX = "id::ctx" # select Circuit (CTX)
176
+ cell.delete_ctx(CTX) # delete CTX
177
+ ```
178
+
179
+ List Circuits (CTX) from Cell:
180
+ ```python
181
+ cellID = "id::cell" # select Cell
182
+ ctxList = cell.list_ctx(cellID) # list Circuits (CTX)
183
+ ```
184
+
185
+ ### Streams (STX)
186
+ Streams (STX) facilitate real-time data synchronization and interaction, ensuring real-time connectivity between Nodes in the Neuronum network
187
+
188
+ Create Stream (STX):
189
+ ```python
190
+ descr = "Test Stream" # description (max 25 characters)
191
+ partners = ["id::cell", "id::cell"] # authorized Cells
192
+ stxID = cell.create_stx(descr, partners) # create Stream (STX)
193
+ ```
194
+
195
+ Stream data to your private Stream (STX):
196
+ ```python
197
+ label = "your_label" # data label
198
+ data = { # data as key-value pairs
199
+ "key1": "value1",
200
+ "key2": "value2",
201
+ "key3": "value3",
202
+ }
203
+ cell.stream(label, data) # stream data
204
+ ```
205
+
206
+ Stream data to a public Stream (STX):
207
+ ```python
208
+ STX = "id::stx" # select Stream (STX)
209
+ label = "your_label" # data label
210
+ data = { # data as key-value pairs
211
+ "key1": "value1",
212
+ "key2": "value2",
213
+ "key3": "value3",
214
+ }
215
+ cell.stream(label, data, STX) # stream data
216
+ ```
217
+
218
+ Sync data from your private Stream (STX):
219
+ ```python
220
+ stream = cell.sync() # synchronize Stream (STX)
221
+ for operation in stream: # load stream operations
222
+ label = operation.get("label") # get the operation details by key
223
+ key1 = operation.get("data").get("key1")
224
+ key2 = operation.get("data").get("key2")
225
+ key3 = operation.get("data").get("key3")
226
+ ts = operation.get("time")
227
+ stxID = operation.get("stxID")
228
+ operator = operation.get("operator")
229
+ ```
230
+
231
+ Sync data from a public Stream (STX):
232
+ ```python
233
+ STX = "id::stx" # select Stream (STX)
234
+ stream = cell.sync(STX) # synchronize Stream (STX)
235
+ for operation in stream: # load stream operations
236
+ label = operation.get("label") # get the operation details by key
237
+ key1 = operation.get("data").get("key1")
238
+ key2 = operation.get("data").get("key2")
239
+ key3 = operation.get("data").get("key3")
240
+ ts = operation.get("time")
241
+ stxID = operation.get("stxID")
242
+ operator = operation.get("operator")
243
+ ```
244
+
245
+ List Streams (STX) from Cell:
246
+ ```python
247
+ cellID = "id::cell" # select Cell
248
+ stxList = cell.list_stx(cellID) # list Streams (STX)
249
+ ```
250
+
251
+ ### Nodes
252
+ Neuronum Nodes are computing hardware running the Neuronum Client Library, enabling seamless data transmission, synchronization, and facilitating public Stream (STX) access
253
+
254
+ Register a Node with its associated Stream (STX):
255
+ ```python
256
+ descr = "node_name" # description (max 25 characters)
257
+ mode = "public" # "public" or "private" Node
258
+ STX = "id::stx" # select Stream (STX)
259
+ nodeID = cell.register_node(descr, mode, STX) # register Node
260
+ ```
261
+
262
+ Delete Node:
263
+ ```python
264
+ nodeID = "id::node" # select Node
265
+ cell.delete_node(nodeID) # delete Node
266
+ ```
@@ -0,0 +1,7 @@
1
+ neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
2
+ neuronum/neuronum.py,sha256=BymDHznUPI3mD09mquEbVODFMWiBaxNHYOst4-qDxZ8,14363
3
+ neuronum-1.5.0.dist-info/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
4
+ neuronum-1.5.0.dist-info/METADATA,sha256=9s6uAwEgWSVAM0FwIwayvuskht2myPMUeGXEMgxV8ew,11764
5
+ neuronum-1.5.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
6
+ neuronum-1.5.0.dist-info/top_level.txt,sha256=73zXVVO9UTTiwEcSaXytsJ8n0q47OCwAqPlIh-hzWJU,9
7
+ neuronum-1.5.0.dist-info/RECORD,,
@@ -1,317 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: neuronum
3
- Version: 1.4.2
4
- Summary: Interact with the Neuronum Network to build, connect & automate real-time data streams
5
- Home-page: https://neuronum.net
6
- Author: Neuronum Cybernetics
7
- Author-email: welcome@neuronum.net
8
- Project-URL: GitHub, https://github.com/neuronumcybernetics/neuronum
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.6
13
- Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: requests
16
- Requires-Dist: websocket-client
17
- Requires-Dist: iota-sdk
18
-
19
- ![Neuronum Logo](https://neuronum.net/static/logo_pip.png "Neuronum")
20
-
21
- [![Website](https://img.shields.io/badge/Website-Neuronum-blue)](https://neuronum.net)
22
- [![Documentation](https://img.shields.io/badge/Docs-Read%20now-green)](https://github.com/neuronumcybernetics/neuronum)
23
- [![Tutorials](https://img.shields.io/badge/Tutorials-Watch%20now-red)](https://www.youtube.com/@neuronumnet)
24
-
25
- `Neuronum` is a cybernetic framework enabling businesses to build interconnected networks of Hardware and Software components
26
-
27
- ## Features
28
- - **Cell**: Identity to connect and interact with the Neuronum Network
29
- - **Transmitters (TX)**: Automate economic data transfer and storage
30
- - **Circuits (CTX)**: Store data in a Key-Value-Label database
31
- - **Streams (STX)**: Stream, synchronize and control data in real time
32
- - **Nodes**: Hard-/Software components participating in the Network ecosystem
33
- - **Contracts/Tokens**: Automate Contract-based authorization between Nodes
34
-
35
- ## Getting Started
36
- To interact with the Network you will need to create a Neuronum Cell.
37
- Create your Cell: [Create Cell](https://neuronum.net/createcell)
38
-
39
- Start with installing the Neuronum library using pip:
40
- ```python
41
- pip install neuronum
42
- ```
43
-
44
- Configure and test Cell connection:
45
- ```python
46
- import neuronum
47
-
48
- cell = neuronum.Cell(
49
- host="host::cell", # specify your cell host
50
- password="your_password", # enter your cell password
51
- network="neuronum.net", # choose network
52
- synapse="your_synapse" # provide the synapse (token)
53
- )
54
- cell.connect()
55
- ```
56
-
57
- ### Transmitters (TX)
58
- Transmitters (TX) are used to create predefined templates to receive and send data in a standardized format. Data send with TX is always and automatically stored in a predefined Circuit (CTX)
59
-
60
- Create Transmitter (TX):
61
- ```python
62
- descr = "Test Transmitter" # short description (max 25 characters)
63
- key_values = { # predefined keys with example values
64
- "key1": "value1",
65
- "key2": "value2",
66
- "key3": "value3",
67
- }
68
- ctx = "id::ctx" # target Circuit (CTX)
69
- label = "key1:key2" # label data sent with the TX
70
- partners = ["id::cell", "id::cell"] # authorized cells
71
- txID = cell.create_tx(decr, key_values, ctx, label, partners)
72
- ```
73
-
74
- Activate Transmitter (TX):
75
- ```python
76
- TX = "id::tx" # specify the Transmitter (TX)
77
- data = { # enter key values
78
- "key1": "value1",
79
- "key2": "value2",
80
- "key3": "value3",
81
- }
82
- cell.activate_tx(TX, data)
83
- ```
84
-
85
- Delete Transmitter (TX):
86
- ```python
87
- TX = "id::tx" # specify the Transmitter (TX)
88
- cell.delete_tx(TX)
89
- ```
90
-
91
- List Transmitter (TX) from cell:
92
- ```python
93
- cell = "id::cell" # specify cell
94
- txList = cell.list_tx(cell)
95
- ```
96
-
97
- ### Circuits (CTX)
98
- Circuits (CTX) store and organize data sent via Transmitters (TX) using a Key-Value-Label system, ensuring efficient retrieval and management within the Neuronum network
99
-
100
- Create Circuit (CTX):
101
- ```python
102
- descr = "Test Circuit" # short description of the circuit (max 25 characters)
103
- partners = ["id::cell", "id::cell"] # authorized cells
104
- ctxID = cell.create_ctx(decr, partners)
105
- ```
106
-
107
- Store data on your private Circuit (CTX):
108
- ```python
109
- label = "your_label" # define a unique label (tag)
110
- data = { # store data as key-value pairs
111
- "key1": "value1",
112
- "key2": "value2",
113
- "key3": "value3",
114
- }
115
- cell.store(label, data)
116
- ```
117
-
118
- Store data on a public Circuit (CTX):
119
- ```python
120
- CTX = "id::ctx" # specify the Circuit (CTX
121
- label = "your_label" # define a unique label (tag)
122
- data = { # store data as key-value pairs
123
- "key1": "value1",
124
- "key2": "value2",
125
- "key3": "value3",
126
- }
127
- cell.store(label, data, CTX)
128
- ```
129
-
130
- Load data from your private Circuit (CTX):
131
- ```python
132
- label = "your_label" # load data by label
133
- data = cell.load(label)
134
- key1 = data["key1"] # get the data from the keys
135
- key2 = data["key2"]
136
- key3 = data["key3"]
137
- ```
138
-
139
- Load data from a public Circuit (CTX):
140
- ```python
141
- CTX = "id::ctx" # specify the CTX
142
- label = "your_label" # load data by label
143
- data = cell.load(label, CTX)
144
- key1 = data["key1"] # get the data from the keys
145
- key2 = data["key2"]
146
- key3 = data["key3"]
147
- ```
148
-
149
- Delete data from your private Circuit (CTX):
150
- ```python
151
- label = "your_label" # delete data by label
152
- cell.delete(label)
153
- ```
154
-
155
- Delete data from a public Circuit (CTX):
156
- ```python
157
- CTX = "id::ctx" # specify the CTX
158
- label = "your_label" # delete data by label
159
- cell.delete(label, CTX)
160
- ```
161
-
162
- Empty your private Circuit (CTX):
163
- ```python
164
- cell.clear()
165
- ```
166
-
167
- Empty a Circuit (CTX):
168
- ```python
169
- CTX = "id::ctx" # specify the CTX
170
- cell.clear(CTX)
171
- ```
172
-
173
- Delete Circuit (CTX):
174
- ```python
175
- CTX = "id::ctx" # specify the Circuit (CTX)
176
- cell.delete_ctx(CTX)
177
- ```
178
-
179
- List Circuits (CTX) from cell:
180
- ```python
181
- cell = "id::cell" # specify cell
182
- ctxList = cell.list_ctx(cell)
183
- ```
184
-
185
- ### Streams (STX)
186
- Streams (STX) facilitate real-time data synchronization and interaction, ensuring seamless connectivity between all Nodes in the Neuronum network
187
-
188
- Create Stream (CTX):
189
- ```python
190
- descr = "Test Stream" # short description (max 25 characters)
191
- partners = ["id::cell", "id::cell"] # authorized cells
192
- stxID = cell.create_stx(decr, partners)
193
- ```
194
-
195
- Stream data to your private Stream (STX):
196
- ```python
197
- label = "your_label" # label your data
198
- data = { # define data package (key-values)
199
- "key1": "value1",
200
- "key2": "value2",
201
- "key3": "value3",
202
- }
203
- cell.stream(label, data)
204
- ```
205
-
206
- Stream data to a public Stream (STX):
207
- ```python
208
- STX = "id::stx" # specify the STX
209
- label = "your_label" # label your data
210
- data = { # define data package (key-values)
211
- "key1": "value1",
212
- "key2": "value2",
213
- "key3": "value3",
214
- }
215
- cell.stream(label, data, STX)
216
- ```
217
-
218
- Sync data from your private Stream (STX):
219
- ```python
220
- stream = cell.sync() # retrieve stream data
221
- for operation in stream: # iterate through each operation
222
- label = operation.get("label") # get the operation details
223
- key1 = operation.get("data").get("key1")
224
- key2 = operation.get("data").get("key2")
225
- key3 = operation.get("data").get("key3")
226
- ts = operation.get("time")
227
- stxID = operation.get("stxID")
228
- operator = operation.get("operator")
229
- ```
230
-
231
- Sync data from a public Stream (STX):
232
- ```python
233
- STX = "id::stx" # specify the STX
234
- stream = cell.sync(STX) # retrieve stream data
235
- for operation in stream: # iterate through each operation
236
- label = operation.get("label") # get the operation details
237
- key1 = operation.get("data").get("key1")
238
- key2 = operation.get("data").get("key2")
239
- key3 = operation.get("data").get("key3")
240
- ts = operation.get("time")
241
- stxID = operation.get("stxID")
242
- operator = operation.get("operator")
243
- ```
244
-
245
- List Streams (STX) from cell:
246
- ```python
247
- cell = "id::cell" # specify cell
248
- stxList = cell.list_stx(cell)
249
- ```
250
-
251
- ### Nodes
252
- Neuronum Nodes are computing hardware running the Neuronum Client Library, enabling seamless data transmission, synchronization, and facilitating public Stream (STX) access
253
-
254
- Register a Node with its associated Stream (STX):
255
- ```python
256
- descr = "node_name" # short description (max 25 characters)
257
- mode = "public" # set to "public or "private
258
- STX = "id::stx" # specify the STX
259
- nodeID = cell.register_node(descr, mode, STX)
260
- ```
261
-
262
- Remove a Node:
263
- ```python
264
- nodeID = "id::node" # get Node by ID
265
- cell.delete_node(nodeID)
266
- ```
267
-
268
-
269
- ### Contracts/Tokens
270
- Contracts define rules for authorization, allowing users to sign and generate unique tokens for secure access
271
-
272
- Create a Contract:
273
- ```python
274
- descr = "Test Contract" # short description (max 25 characters)
275
- details = { # define token details
276
- "price_in_eur": 10, # token price in EUR
277
- "max_usage": 10, # max number of uses
278
- "validity_in_min": 10 # token expiration time (minutes)
279
- }
280
- partners = ["id::cell", "id::cell"]
281
- contractID = cell.create_contract(descr, details, partners)
282
- ```
283
-
284
- Sign a Contract:
285
- ```python
286
- contractID = "id::contract" # specify the contract
287
- token = cell.sign_contract(contractID)
288
- ```
289
-
290
- Request a Token from another Cell to authorize a service:
291
- ```python
292
- cp = "id::cell" # specify the counterparty cell
293
- contractID = "id::contract" # specify the contract
294
- cell.request_token(cp, contractID)
295
- ```
296
-
297
- Present a Token to another Cell to authorize a service:
298
- ```python
299
- token = "token" # specify the token
300
- cp = "id::cell" # specify the counterparty cell
301
- contractID = "id::contract" # specify the contract
302
- cell.present_token(token, cp, contractID)
303
- ```
304
-
305
- Validate a Token to authorize a service:
306
- ```python
307
- token = "token" # specify the token
308
- cp = "id::cell" # specify the counterparty cell
309
- contractID = "id::contract" # specify the contract
310
- cell.validate_token(token, cp, contractID)
311
- ```
312
-
313
- List Contracts from cell:
314
- ```python
315
- cell = "id::cell" # specify cell
316
- contractList = cell.list_contracts(cell)
317
- ```
@@ -1,7 +0,0 @@
1
- neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
2
- neuronum/neuronum.py,sha256=Qe8Va5cI5LRFDV0nksedM8HwmbZiTsyNP5QSg9ffFVI,18737
3
- neuronum-1.4.2.dist-info/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
4
- neuronum-1.4.2.dist-info/METADATA,sha256=J5B-8ngh_GhQW0829pBx3JHoyKk9J6xa663JqPqPH88,10116
5
- neuronum-1.4.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
6
- neuronum-1.4.2.dist-info/top_level.txt,sha256=73zXVVO9UTTiwEcSaXytsJ8n0q47OCwAqPlIh-hzWJU,9
7
- neuronum-1.4.2.dist-info/RECORD,,