neuronum 1.4.2__py3-none-any.whl → 1.5.1__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 +8 -142
- neuronum-1.5.1.dist-info/METADATA +267 -0
- neuronum-1.5.1.dist-info/RECORD +7 -0
- neuronum-1.4.2.dist-info/METADATA +0 -317
- neuronum-1.4.2.dist-info/RECORD +0 -7
- {neuronum-1.4.2.dist-info → neuronum-1.5.1.dist-info}/LICENSE +0 -0
- {neuronum-1.4.2.dist-info → neuronum-1.5.1.dist-info}/WHEEL +0 -0
- {neuronum-1.4.2.dist-info → neuronum-1.5.1.dist-info}/top_level.txt +0 -0
neuronum/neuronum.py
CHANGED
|
@@ -32,13 +32,13 @@ class Cell:
|
|
|
32
32
|
return "Authentication successful" in response
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
def create_tx(self, descr: str, key_values: dict,
|
|
35
|
+
def create_tx(self, descr: str, key_values: dict, stx: str, label: str, partners: list):
|
|
36
36
|
url = f"https://{self.network}/api/create_tx"
|
|
37
37
|
|
|
38
38
|
TX = {
|
|
39
39
|
"descr": descr,
|
|
40
40
|
"key_values": key_values,
|
|
41
|
-
"
|
|
41
|
+
"stx": stx,
|
|
42
42
|
"label": label,
|
|
43
43
|
"partners": partners,
|
|
44
44
|
"cell": self.to_dict()
|
|
@@ -260,144 +260,12 @@ class Cell:
|
|
|
260
260
|
print(f"Unexpected error: {e}")
|
|
261
261
|
|
|
262
262
|
|
|
263
|
-
def
|
|
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
|
-
"
|
|
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,
|
|
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
|
-
"
|
|
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,
|
|
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
|
-
"
|
|
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,267 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: neuronum
|
|
3
|
+
Version: 1.5.1
|
|
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
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
[](https://neuronum.net)
|
|
21
|
+
[](https://github.com/neuronumcybernetics/neuronum)
|
|
22
|
+
[](https://www.youtube.com/@neuronumnet)
|
|
23
|
+
|
|
24
|
+
`Neuronum` is a cybernetic framework enabling businesses to build & automate interconnected networks of soft- and hardware components
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
- **Cell**: Identity to connect and interact with the Neuronum Network
|
|
28
|
+
- **Transmitters (TX)**: Automate economic data transfer
|
|
29
|
+
- **Circuits (CTX)**: Store data in Key-Value-Label databases
|
|
30
|
+
- **Streams (STX)**: Stream, synchronize and control data in real time
|
|
31
|
+
- **Nodes**: Soft-/Hardware components participating in the Network ecosystem
|
|
32
|
+
|
|
33
|
+
To interact with the Network you will need to create a Neuronum Cell.
|
|
34
|
+
Create your Cell: [Create Cell](https://neuronum.net/createcell)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Installation & Connection
|
|
38
|
+
Start with installing the Neuronum library using pip:
|
|
39
|
+
```python
|
|
40
|
+
pip install neuronum
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Configure and test Cell connection:
|
|
44
|
+
```python
|
|
45
|
+
import neuronum
|
|
46
|
+
|
|
47
|
+
cell = neuronum.Cell(
|
|
48
|
+
host="host::cell", # cell host
|
|
49
|
+
password="your_password", # cell password
|
|
50
|
+
network="neuronum.net", # cell network
|
|
51
|
+
synapse="your_synapse" # cell synapse
|
|
52
|
+
)
|
|
53
|
+
cell.connect() # connect to network
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Transmitters (TX)
|
|
57
|
+
Transmitters (TX) are used to create predefined templates to receive and send data in a standardized format.
|
|
58
|
+
|
|
59
|
+
Create Transmitter (TX):
|
|
60
|
+
```python
|
|
61
|
+
descr = "Test Transmitter" # description (max 25 characters)
|
|
62
|
+
key_values = { # defined keys and example values
|
|
63
|
+
"key1": "value1",
|
|
64
|
+
"key2": "value2",
|
|
65
|
+
"key3": "value3",
|
|
66
|
+
}
|
|
67
|
+
stx = "id::stx" # select Stream (STX)
|
|
68
|
+
label = "key1:key2" # label TX data
|
|
69
|
+
partners = ["id::cell", "id::cell"] # authorized Cells
|
|
70
|
+
txID = cell.create_tx(descr, key_values, stx, label, partners) # create TX
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Activate Transmitter (TX):
|
|
74
|
+
```python
|
|
75
|
+
TX = "id::tx" # select Transmitter (TX)
|
|
76
|
+
data = { # enter key-values
|
|
77
|
+
"key1": "value1",
|
|
78
|
+
"key2": "value2",
|
|
79
|
+
"key3": "value3",
|
|
80
|
+
}
|
|
81
|
+
cell.activate_tx(TX, data) # activate TX
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Delete Transmitter (TX):
|
|
85
|
+
```python
|
|
86
|
+
TX = "id::tx" # select Transmitter (TX)
|
|
87
|
+
cell.delete_tx(TX) # delete TX
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
List Transmitter (TX) from Cell:
|
|
91
|
+
```python
|
|
92
|
+
cellID = "id::cell" # select Cell
|
|
93
|
+
txList = cell.list_tx(cellID) # list Transmitters (TX)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Circuits (CTX)
|
|
97
|
+
Circuits (CTX) store and organize data using a Key-Value-Label system
|
|
98
|
+
|
|
99
|
+
Create Circuit (CTX):
|
|
100
|
+
```python
|
|
101
|
+
descr = "Test Circuit" # description (max 25 characters)
|
|
102
|
+
partners = ["id::cell", "id::cell"] # authorized Cells
|
|
103
|
+
ctxID = cell.create_ctx(descr, partners) # create Circuit (CTX)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Store data on your private Circuit (CTX):
|
|
107
|
+
```python
|
|
108
|
+
label = "your_label" # data label (should be unique)
|
|
109
|
+
data = { # data as key-value pairs
|
|
110
|
+
"key1": "value1",
|
|
111
|
+
"key2": "value2",
|
|
112
|
+
"key3": "value3",
|
|
113
|
+
}
|
|
114
|
+
cell.store(label, data) # store data
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Store data on a public Circuit (CTX):
|
|
118
|
+
```python
|
|
119
|
+
CTX = "id::ctx" # select Circuit (CTX
|
|
120
|
+
label = "your_label" # data label (should be unique)
|
|
121
|
+
data = { # data as key-value pairs
|
|
122
|
+
"key1": "value1",
|
|
123
|
+
"key2": "value2",
|
|
124
|
+
"key3": "value3",
|
|
125
|
+
}
|
|
126
|
+
cell.store(label, data, CTX) # store data
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Load data from your private Circuit (CTX):
|
|
130
|
+
```python
|
|
131
|
+
label = "your_label" # select label
|
|
132
|
+
data = cell.load(label) # load data by label
|
|
133
|
+
key1 = data["key1"] # get data from key
|
|
134
|
+
key2 = data["key2"]
|
|
135
|
+
key3 = data["key3"]
|
|
136
|
+
print(key1, key2, key3) # print data
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Load data from a public Circuit (CTX):
|
|
140
|
+
```python
|
|
141
|
+
CTX = "id::ctx" # select Circuit (CTX)
|
|
142
|
+
label = "your_label" # select label
|
|
143
|
+
data = cell.load(label, CTX) # load data by label
|
|
144
|
+
key1 = data["key1"] # get data from key
|
|
145
|
+
key2 = data["key2"]
|
|
146
|
+
key3 = data["key3"]
|
|
147
|
+
print(key1, key2, key3) # print data
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Delete data from your private Circuit (CTX):
|
|
151
|
+
```python
|
|
152
|
+
label = "your_label" # select label
|
|
153
|
+
cell.delete(label) # delete data by label
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Delete data from a public Circuit (CTX):
|
|
157
|
+
```python
|
|
158
|
+
CTX = "id::ctx" # select Circuits (CTX)
|
|
159
|
+
label = "your_label" # select label
|
|
160
|
+
cell.delete(label, CTX) # delete data by label
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Clear your private Circuit (CTX):
|
|
164
|
+
```python
|
|
165
|
+
cell.clear() # clear Circuit (CTX)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Clear Circuit (CTX):
|
|
169
|
+
```python
|
|
170
|
+
CTX = "id::ctx" # select Circuit (CTX)
|
|
171
|
+
cell.clear(CTX) # clear CTX
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Delete Circuit (CTX):
|
|
175
|
+
```python
|
|
176
|
+
CTX = "id::ctx" # select Circuit (CTX)
|
|
177
|
+
cell.delete_ctx(CTX) # delete CTX
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
List Circuits (CTX) from Cell:
|
|
181
|
+
```python
|
|
182
|
+
cellID = "id::cell" # select Cell
|
|
183
|
+
ctxList = cell.list_ctx(cellID) # list Circuits (CTX)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Streams (STX)
|
|
187
|
+
Streams (STX) facilitate real-time data synchronization and interaction, ensuring real-time connectivity between Nodes in the Neuronum network
|
|
188
|
+
|
|
189
|
+
Create Stream (STX):
|
|
190
|
+
```python
|
|
191
|
+
descr = "Test Stream" # description (max 25 characters)
|
|
192
|
+
partners = ["id::cell", "id::cell"] # authorized Cells
|
|
193
|
+
stxID = cell.create_stx(descr, partners) # create Stream (STX)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Stream data to your private Stream (STX):
|
|
197
|
+
```python
|
|
198
|
+
label = "your_label" # data label
|
|
199
|
+
data = { # data as key-value pairs
|
|
200
|
+
"key1": "value1",
|
|
201
|
+
"key2": "value2",
|
|
202
|
+
"key3": "value3",
|
|
203
|
+
}
|
|
204
|
+
cell.stream(label, data) # stream data
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Stream data to a public Stream (STX):
|
|
208
|
+
```python
|
|
209
|
+
STX = "id::stx" # select Stream (STX)
|
|
210
|
+
label = "your_label" # data label
|
|
211
|
+
data = { # data as key-value pairs
|
|
212
|
+
"key1": "value1",
|
|
213
|
+
"key2": "value2",
|
|
214
|
+
"key3": "value3",
|
|
215
|
+
}
|
|
216
|
+
cell.stream(label, data, STX) # stream data
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Sync data from your private Stream (STX):
|
|
220
|
+
```python
|
|
221
|
+
stream = cell.sync() # synchronize Stream (STX)
|
|
222
|
+
for operation in stream: # load stream operations
|
|
223
|
+
label = operation.get("label") # get the operation details by key
|
|
224
|
+
key1 = operation.get("data").get("key1")
|
|
225
|
+
key2 = operation.get("data").get("key2")
|
|
226
|
+
key3 = operation.get("data").get("key3")
|
|
227
|
+
ts = operation.get("time")
|
|
228
|
+
stxID = operation.get("stxID")
|
|
229
|
+
operator = operation.get("operator")
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Sync data from a public Stream (STX):
|
|
233
|
+
```python
|
|
234
|
+
STX = "id::stx" # select Stream (STX)
|
|
235
|
+
stream = cell.sync(STX) # synchronize Stream (STX)
|
|
236
|
+
for operation in stream: # load stream operations
|
|
237
|
+
label = operation.get("label") # get the operation details by key
|
|
238
|
+
key1 = operation.get("data").get("key1")
|
|
239
|
+
key2 = operation.get("data").get("key2")
|
|
240
|
+
key3 = operation.get("data").get("key3")
|
|
241
|
+
ts = operation.get("time")
|
|
242
|
+
stxID = operation.get("stxID")
|
|
243
|
+
operator = operation.get("operator")
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
List Streams (STX) from Cell:
|
|
247
|
+
```python
|
|
248
|
+
cellID = "id::cell" # select Cell
|
|
249
|
+
stxList = cell.list_stx(cellID) # list Streams (STX)
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Nodes
|
|
253
|
+
Neuronum Nodes are computing hardware running the Neuronum Client Library, enabling seamless data transmission, synchronization, and facilitating public Stream (STX) access
|
|
254
|
+
|
|
255
|
+
Register a Node with its associated Stream (STX):
|
|
256
|
+
```python
|
|
257
|
+
descr = "node_name" # description (max 25 characters)
|
|
258
|
+
mode = "public" # "public" or "private" Node
|
|
259
|
+
STX = "id::stx" # select Stream (STX)
|
|
260
|
+
nodeID = cell.register_node(descr, mode, STX) # register Node
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Delete Node:
|
|
264
|
+
```python
|
|
265
|
+
nodeID = "id::node" # select Node
|
|
266
|
+
cell.delete_node(nodeID) # delete Node
|
|
267
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
neuronum/__init__.py,sha256=Drsm263_w3_VWgl1YsKLUr8WwVodqV3TSjqpxLjyq_M,46
|
|
2
|
+
neuronum/neuronum.py,sha256=AL0zXiULx-R-Co4XyYtL0lF-z7GGqXGXDxQEYgithPY,14363
|
|
3
|
+
neuronum-1.5.1.dist-info/LICENSE,sha256=UiZjNHiCyRP6WoZfbYQh9cv4JW96wIofKXmzBJrYSUk,1125
|
|
4
|
+
neuronum-1.5.1.dist-info/METADATA,sha256=H3UZ6u7BHgUcngCTf_0xDwcHjIR1EBlazKe38rXkqnc,11212
|
|
5
|
+
neuronum-1.5.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
6
|
+
neuronum-1.5.1.dist-info/top_level.txt,sha256=73zXVVO9UTTiwEcSaXytsJ8n0q47OCwAqPlIh-hzWJU,9
|
|
7
|
+
neuronum-1.5.1.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
|
-

|
|
20
|
-
|
|
21
|
-
[](https://neuronum.net)
|
|
22
|
-
[](https://github.com/neuronumcybernetics/neuronum)
|
|
23
|
-
[](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
|
-
```
|
neuronum-1.4.2.dist-info/RECORD
DELETED
|
@@ -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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|