neuronum 1.4.0__tar.gz → 1.4.2__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.
Potentially problematic release.
This version of neuronum might be problematic. Click here for more details.
- neuronum-1.4.2/PKG-INFO +317 -0
- neuronum-1.4.2/README.md +299 -0
- neuronum-1.4.2/neuronum/neuronum.py +624 -0
- neuronum-1.4.2/neuronum.egg-info/PKG-INFO +317 -0
- {neuronum-1.4.0 → neuronum-1.4.2}/neuronum.egg-info/requires.txt +1 -0
- {neuronum-1.4.0 → neuronum-1.4.2}/setup.py +4 -3
- neuronum-1.4.0/PKG-INFO +0 -186
- neuronum-1.4.0/README.md +0 -169
- neuronum-1.4.0/neuronum/neuronum.py +0 -282
- neuronum-1.4.0/neuronum.egg-info/PKG-INFO +0 -186
- {neuronum-1.4.0 → neuronum-1.4.2}/LICENSE +0 -0
- {neuronum-1.4.0 → neuronum-1.4.2}/neuronum/__init__.py +0 -0
- {neuronum-1.4.0 → neuronum-1.4.2}/neuronum.egg-info/SOURCES.txt +0 -0
- {neuronum-1.4.0 → neuronum-1.4.2}/neuronum.egg-info/dependency_links.txt +0 -0
- {neuronum-1.4.0 → neuronum-1.4.2}/neuronum.egg-info/top_level.txt +0 -0
- {neuronum-1.4.0 → neuronum-1.4.2}/setup.cfg +0 -0
neuronum-1.4.2/PKG-INFO
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
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/README.md
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
[](https://neuronum.net)
|
|
4
|
+
[](https://github.com/neuronumcybernetics/neuronum)
|
|
5
|
+
[](https://www.youtube.com/@neuronumnet)
|
|
6
|
+
|
|
7
|
+
`Neuronum` is a cybernetic framework enabling businesses to build interconnected networks of Hardware and Software components
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
- **Cell**: Identity to connect and interact with the Neuronum Network
|
|
11
|
+
- **Transmitters (TX)**: Automate economic data transfer and storage
|
|
12
|
+
- **Circuits (CTX)**: Store data in a Key-Value-Label database
|
|
13
|
+
- **Streams (STX)**: Stream, synchronize and control data in real time
|
|
14
|
+
- **Nodes**: Hard-/Software components participating in the Network ecosystem
|
|
15
|
+
- **Contracts/Tokens**: Automate Contract-based authorization between Nodes
|
|
16
|
+
|
|
17
|
+
## Getting Started
|
|
18
|
+
To interact with the Network you will need to create a Neuronum Cell.
|
|
19
|
+
Create your Cell: [Create Cell](https://neuronum.net/createcell)
|
|
20
|
+
|
|
21
|
+
Start with installing the Neuronum library using pip:
|
|
22
|
+
```python
|
|
23
|
+
pip install neuronum
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Configure and test Cell connection:
|
|
27
|
+
```python
|
|
28
|
+
import neuronum
|
|
29
|
+
|
|
30
|
+
cell = neuronum.Cell(
|
|
31
|
+
host="host::cell", # specify your cell host
|
|
32
|
+
password="your_password", # enter your cell password
|
|
33
|
+
network="neuronum.net", # choose network
|
|
34
|
+
synapse="your_synapse" # provide the synapse (token)
|
|
35
|
+
)
|
|
36
|
+
cell.connect()
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Transmitters (TX)
|
|
40
|
+
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)
|
|
41
|
+
|
|
42
|
+
Create Transmitter (TX):
|
|
43
|
+
```python
|
|
44
|
+
descr = "Test Transmitter" # short description (max 25 characters)
|
|
45
|
+
key_values = { # predefined keys with example values
|
|
46
|
+
"key1": "value1",
|
|
47
|
+
"key2": "value2",
|
|
48
|
+
"key3": "value3",
|
|
49
|
+
}
|
|
50
|
+
ctx = "id::ctx" # target Circuit (CTX)
|
|
51
|
+
label = "key1:key2" # label data sent with the TX
|
|
52
|
+
partners = ["id::cell", "id::cell"] # authorized cells
|
|
53
|
+
txID = cell.create_tx(decr, key_values, ctx, label, partners)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Activate Transmitter (TX):
|
|
57
|
+
```python
|
|
58
|
+
TX = "id::tx" # specify the Transmitter (TX)
|
|
59
|
+
data = { # enter key values
|
|
60
|
+
"key1": "value1",
|
|
61
|
+
"key2": "value2",
|
|
62
|
+
"key3": "value3",
|
|
63
|
+
}
|
|
64
|
+
cell.activate_tx(TX, data)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Delete Transmitter (TX):
|
|
68
|
+
```python
|
|
69
|
+
TX = "id::tx" # specify the Transmitter (TX)
|
|
70
|
+
cell.delete_tx(TX)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
List Transmitter (TX) from cell:
|
|
74
|
+
```python
|
|
75
|
+
cell = "id::cell" # specify cell
|
|
76
|
+
txList = cell.list_tx(cell)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Circuits (CTX)
|
|
80
|
+
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
|
|
81
|
+
|
|
82
|
+
Create Circuit (CTX):
|
|
83
|
+
```python
|
|
84
|
+
descr = "Test Circuit" # short description of the circuit (max 25 characters)
|
|
85
|
+
partners = ["id::cell", "id::cell"] # authorized cells
|
|
86
|
+
ctxID = cell.create_ctx(decr, partners)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Store data on your private Circuit (CTX):
|
|
90
|
+
```python
|
|
91
|
+
label = "your_label" # define a unique label (tag)
|
|
92
|
+
data = { # store data as key-value pairs
|
|
93
|
+
"key1": "value1",
|
|
94
|
+
"key2": "value2",
|
|
95
|
+
"key3": "value3",
|
|
96
|
+
}
|
|
97
|
+
cell.store(label, data)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Store data on a public Circuit (CTX):
|
|
101
|
+
```python
|
|
102
|
+
CTX = "id::ctx" # specify the Circuit (CTX
|
|
103
|
+
label = "your_label" # define a unique label (tag)
|
|
104
|
+
data = { # store data as key-value pairs
|
|
105
|
+
"key1": "value1",
|
|
106
|
+
"key2": "value2",
|
|
107
|
+
"key3": "value3",
|
|
108
|
+
}
|
|
109
|
+
cell.store(label, data, CTX)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Load data from your private Circuit (CTX):
|
|
113
|
+
```python
|
|
114
|
+
label = "your_label" # load data by label
|
|
115
|
+
data = cell.load(label)
|
|
116
|
+
key1 = data["key1"] # get the data from the keys
|
|
117
|
+
key2 = data["key2"]
|
|
118
|
+
key3 = data["key3"]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Load data from a public Circuit (CTX):
|
|
122
|
+
```python
|
|
123
|
+
CTX = "id::ctx" # specify the CTX
|
|
124
|
+
label = "your_label" # load data by label
|
|
125
|
+
data = cell.load(label, CTX)
|
|
126
|
+
key1 = data["key1"] # get the data from the keys
|
|
127
|
+
key2 = data["key2"]
|
|
128
|
+
key3 = data["key3"]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Delete data from your private Circuit (CTX):
|
|
132
|
+
```python
|
|
133
|
+
label = "your_label" # delete data by label
|
|
134
|
+
cell.delete(label)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Delete data from a public Circuit (CTX):
|
|
138
|
+
```python
|
|
139
|
+
CTX = "id::ctx" # specify the CTX
|
|
140
|
+
label = "your_label" # delete data by label
|
|
141
|
+
cell.delete(label, CTX)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Empty your private Circuit (CTX):
|
|
145
|
+
```python
|
|
146
|
+
cell.clear()
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Empty a Circuit (CTX):
|
|
150
|
+
```python
|
|
151
|
+
CTX = "id::ctx" # specify the CTX
|
|
152
|
+
cell.clear(CTX)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Delete Circuit (CTX):
|
|
156
|
+
```python
|
|
157
|
+
CTX = "id::ctx" # specify the Circuit (CTX)
|
|
158
|
+
cell.delete_ctx(CTX)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
List Circuits (CTX) from cell:
|
|
162
|
+
```python
|
|
163
|
+
cell = "id::cell" # specify cell
|
|
164
|
+
ctxList = cell.list_ctx(cell)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Streams (STX)
|
|
168
|
+
Streams (STX) facilitate real-time data synchronization and interaction, ensuring seamless connectivity between all Nodes in the Neuronum network
|
|
169
|
+
|
|
170
|
+
Create Stream (CTX):
|
|
171
|
+
```python
|
|
172
|
+
descr = "Test Stream" # short description (max 25 characters)
|
|
173
|
+
partners = ["id::cell", "id::cell"] # authorized cells
|
|
174
|
+
stxID = cell.create_stx(decr, partners)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Stream data to your private Stream (STX):
|
|
178
|
+
```python
|
|
179
|
+
label = "your_label" # label your data
|
|
180
|
+
data = { # define data package (key-values)
|
|
181
|
+
"key1": "value1",
|
|
182
|
+
"key2": "value2",
|
|
183
|
+
"key3": "value3",
|
|
184
|
+
}
|
|
185
|
+
cell.stream(label, data)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Stream data to a public Stream (STX):
|
|
189
|
+
```python
|
|
190
|
+
STX = "id::stx" # specify the STX
|
|
191
|
+
label = "your_label" # label your data
|
|
192
|
+
data = { # define data package (key-values)
|
|
193
|
+
"key1": "value1",
|
|
194
|
+
"key2": "value2",
|
|
195
|
+
"key3": "value3",
|
|
196
|
+
}
|
|
197
|
+
cell.stream(label, data, STX)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Sync data from your private Stream (STX):
|
|
201
|
+
```python
|
|
202
|
+
stream = cell.sync() # retrieve stream data
|
|
203
|
+
for operation in stream: # iterate through each operation
|
|
204
|
+
label = operation.get("label") # get the operation details
|
|
205
|
+
key1 = operation.get("data").get("key1")
|
|
206
|
+
key2 = operation.get("data").get("key2")
|
|
207
|
+
key3 = operation.get("data").get("key3")
|
|
208
|
+
ts = operation.get("time")
|
|
209
|
+
stxID = operation.get("stxID")
|
|
210
|
+
operator = operation.get("operator")
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Sync data from a public Stream (STX):
|
|
214
|
+
```python
|
|
215
|
+
STX = "id::stx" # specify the STX
|
|
216
|
+
stream = cell.sync(STX) # retrieve stream data
|
|
217
|
+
for operation in stream: # iterate through each operation
|
|
218
|
+
label = operation.get("label") # get the operation details
|
|
219
|
+
key1 = operation.get("data").get("key1")
|
|
220
|
+
key2 = operation.get("data").get("key2")
|
|
221
|
+
key3 = operation.get("data").get("key3")
|
|
222
|
+
ts = operation.get("time")
|
|
223
|
+
stxID = operation.get("stxID")
|
|
224
|
+
operator = operation.get("operator")
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
List Streams (STX) from cell:
|
|
228
|
+
```python
|
|
229
|
+
cell = "id::cell" # specify cell
|
|
230
|
+
stxList = cell.list_stx(cell)
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Nodes
|
|
234
|
+
Neuronum Nodes are computing hardware running the Neuronum Client Library, enabling seamless data transmission, synchronization, and facilitating public Stream (STX) access
|
|
235
|
+
|
|
236
|
+
Register a Node with its associated Stream (STX):
|
|
237
|
+
```python
|
|
238
|
+
descr = "node_name" # short description (max 25 characters)
|
|
239
|
+
mode = "public" # set to "public or "private
|
|
240
|
+
STX = "id::stx" # specify the STX
|
|
241
|
+
nodeID = cell.register_node(descr, mode, STX)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Remove a Node:
|
|
245
|
+
```python
|
|
246
|
+
nodeID = "id::node" # get Node by ID
|
|
247
|
+
cell.delete_node(nodeID)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
### Contracts/Tokens
|
|
252
|
+
Contracts define rules for authorization, allowing users to sign and generate unique tokens for secure access
|
|
253
|
+
|
|
254
|
+
Create a Contract:
|
|
255
|
+
```python
|
|
256
|
+
descr = "Test Contract" # short description (max 25 characters)
|
|
257
|
+
details = { # define token details
|
|
258
|
+
"price_in_eur": 10, # token price in EUR
|
|
259
|
+
"max_usage": 10, # max number of uses
|
|
260
|
+
"validity_in_min": 10 # token expiration time (minutes)
|
|
261
|
+
}
|
|
262
|
+
partners = ["id::cell", "id::cell"]
|
|
263
|
+
contractID = cell.create_contract(descr, details, partners)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Sign a Contract:
|
|
267
|
+
```python
|
|
268
|
+
contractID = "id::contract" # specify the contract
|
|
269
|
+
token = cell.sign_contract(contractID)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Request a Token from another Cell to authorize a service:
|
|
273
|
+
```python
|
|
274
|
+
cp = "id::cell" # specify the counterparty cell
|
|
275
|
+
contractID = "id::contract" # specify the contract
|
|
276
|
+
cell.request_token(cp, contractID)
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Present a Token to another Cell to authorize a service:
|
|
280
|
+
```python
|
|
281
|
+
token = "token" # specify the token
|
|
282
|
+
cp = "id::cell" # specify the counterparty cell
|
|
283
|
+
contractID = "id::contract" # specify the contract
|
|
284
|
+
cell.present_token(token, cp, contractID)
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Validate a Token to authorize a service:
|
|
288
|
+
```python
|
|
289
|
+
token = "token" # specify the token
|
|
290
|
+
cp = "id::cell" # specify the counterparty cell
|
|
291
|
+
contractID = "id::contract" # specify the contract
|
|
292
|
+
cell.validate_token(token, cp, contractID)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
List Contracts from cell:
|
|
296
|
+
```python
|
|
297
|
+
cell = "id::cell" # specify cell
|
|
298
|
+
contractList = cell.list_contracts(cell)
|
|
299
|
+
```
|