astreum 0.1.20__tar.gz → 0.2.0__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 astreum might be problematic. Click here for more details.

Files changed (70) hide show
  1. astreum-0.2.0/PKG-INFO +144 -0
  2. astreum-0.2.0/README.md +126 -0
  3. {astreum-0.1.20 → astreum-0.2.0}/pyproject.toml +1 -1
  4. astreum-0.2.0/src/astreum/__init__.py +1 -0
  5. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/relay/envelope.py +1 -1
  6. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/relay/message.py +1 -1
  7. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/storage/merkle.py +3 -3
  8. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/storage/patricia.py +3 -3
  9. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/storage/storage.py +2 -0
  10. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/utils.py +1 -1
  11. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/validation/account.py +3 -3
  12. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/validation/transaction.py +3 -3
  13. astreum-0.2.0/src/astreum/lispeum/__init__.py +2 -0
  14. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/parser.py +1 -1
  15. astreum-0.2.0/src/astreum/machine/environment.py +4 -0
  16. astreum-0.2.0/src/astreum/node.py +1021 -0
  17. astreum-0.2.0/src/astreum.egg-info/PKG-INFO +144 -0
  18. astreum-0.2.0/src/astreum.egg-info/SOURCES.txt +60 -0
  19. astreum-0.1.20/PKG-INFO +0 -90
  20. astreum-0.1.20/README.md +0 -72
  21. astreum-0.1.20/src/astreum/__init__.py +0 -2
  22. astreum-0.1.20/src/astreum/machine/environment.py +0 -29
  23. astreum-0.1.20/src/astreum/node/validation/_block/__init__.py +0 -0
  24. astreum-0.1.20/src/astreum/utils/__init__.py +0 -0
  25. astreum-0.1.20/src/astreum.egg-info/PKG-INFO +0 -90
  26. astreum-0.1.20/src/astreum.egg-info/SOURCES.txt +0 -60
  27. {astreum-0.1.20 → astreum-0.2.0}/LICENSE +0 -0
  28. {astreum-0.1.20 → astreum-0.2.0}/setup.cfg +0 -0
  29. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/__init__.py +0 -0
  30. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/relay/__init__.py +0 -0
  31. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/relay/bucket.py +0 -0
  32. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/relay/peer.py +0 -0
  33. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/relay/route.py +0 -0
  34. {astreum-0.1.20/src/astreum/lispeum → astreum-0.2.0/src/astreum/_node/storage}/__init__.py +0 -0
  35. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/storage/utils.py +0 -0
  36. {astreum-0.1.20/src/astreum/lispeum/special → astreum-0.2.0/src/astreum/_node/validation}/__init__.py +0 -0
  37. {astreum-0.1.20/src/astreum/lispeum/special/list → astreum-0.2.0/src/astreum/_node/validation/_block}/__init__.py +0 -0
  38. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/validation/_block/create.py +0 -0
  39. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/validation/_block/model.py +0 -0
  40. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/validation/_block/validate.py +0 -0
  41. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/validation/block.py +0 -0
  42. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/validation/constants.py +0 -0
  43. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/validation/stake.py +0 -0
  44. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum/_node}/validation/vdf.py +0 -0
  45. {astreum-0.1.20/src/astreum/lispeum/special/number → astreum-0.2.0/src/astreum/crypto}/__init__.py +0 -0
  46. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum}/crypto/ed25519.py +0 -0
  47. {astreum-0.1.20/src/astreum/node → astreum-0.2.0/src/astreum}/crypto/x25519.py +0 -0
  48. /astreum-0.1.20/src/astreum/utils/bytes_format.py → /astreum-0.2.0/src/astreum/format.py +0 -0
  49. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/expression.py +0 -0
  50. {astreum-0.1.20/src/astreum/node/crypto → astreum-0.2.0/src/astreum/lispeum/special}/__init__.py +0 -0
  51. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/special/definition.py +0 -0
  52. {astreum-0.1.20/src/astreum/node/storage → astreum-0.2.0/src/astreum/lispeum/special/list}/__init__.py +0 -0
  53. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/special/list/all.py +0 -0
  54. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/special/list/any.py +0 -0
  55. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/special/list/fold.py +0 -0
  56. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/special/list/get.py +0 -0
  57. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/special/list/insert.py +0 -0
  58. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/special/list/map.py +0 -0
  59. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/special/list/position.py +0 -0
  60. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/special/list/remove.py +0 -0
  61. {astreum-0.1.20/src/astreum/node/validation → astreum-0.2.0/src/astreum/lispeum/special/number}/__init__.py +0 -0
  62. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/special/number/addition.py +0 -0
  63. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/storage.py +0 -0
  64. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/tokenizer.py +0 -0
  65. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/lispeum/utils.py +0 -0
  66. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/machine/__init__.py +0 -0
  67. {astreum-0.1.20 → astreum-0.2.0}/src/astreum/machine/error.py +0 -0
  68. {astreum-0.1.20 → astreum-0.2.0}/src/astreum.egg-info/dependency_links.txt +0 -0
  69. {astreum-0.1.20 → astreum-0.2.0}/src/astreum.egg-info/requires.txt +0 -0
  70. {astreum-0.1.20 → astreum-0.2.0}/src/astreum.egg-info/top_level.txt +0 -0
astreum-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: astreum
3
+ Version: 0.2.0
4
+ Summary: Python library to interact with the Astreum blockchain and its Lispeum virtual machine.
5
+ Author-email: "Roy R. O. Okello" <roy@stelar.xyz>
6
+ Project-URL: Homepage, https://github.com/astreum/lib
7
+ Project-URL: Issues, https://github.com/astreum/lib/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: pycryptodomex==3.21.0
15
+ Requires-Dist: cryptography==44.0.2
16
+ Requires-Dist: blake3==1.0.4
17
+ Dynamic: license-file
18
+
19
+ # Astreum Python Library
20
+
21
+ Python library to interact with the Astreum blockchain and its Lispeum virtual machine.
22
+
23
+ [View on PyPI](https://pypi.org/project/astreum/)
24
+
25
+ ## Configuration
26
+
27
+ When initializing an `astreum.Node`, pass a dictionary with any of the options below. Only the parameters you want to override need to be present – everything else falls back to its default.
28
+
29
+ ### Core Configuration
30
+
31
+ | Parameter | Type | Default | Description |
32
+ | -------------- | ---- | ------- | ----------- |
33
+ | `machine-only` | bool | `True` | When |
34
+
35
+ | |
36
+ | - |
37
+
38
+ | **True** the node starts in *machine‑only* mode: no storage subsystem and no relay networking – only the Lispeum VM. Set to **False** to enable storage and relay features. | | | |
39
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -------------- | ------------------------------------------------------------------------------------------------------------------------ |
40
+ | `relay_secret_key` | hex string | Auto‑generated | Ed25519 private key that identifies the node on the network. If omitted a fresh keypair is generated and kept in‑memory. |
41
+ | `validation_secret_key` | hex string | `None` | X25519 private key that lets the node participate in the validation route. Leave unset for a non‑validator node. |
42
+ | `storage_path` | string | `None` | Directory where objects are persisted. If *None* the node uses an in‑memory store. |
43
+ | `storage_get_relay_timeout` | float | `5` | Seconds to wait for an object requested from peers before timing‑out. |
44
+
45
+ ### Networking
46
+
47
+ | Parameter | Type | Default | Description |
48
+ | --------------- | ----------------------- | ------- | ----------------------------------------------------------------------------------- |
49
+ | `use_ipv6` | bool | `False` | Listen on IPv6 as well as IPv4. |
50
+ | `incoming_port` | int | `7373` | UDP port the relay binds to. |
51
+ | `bootstrap` | list\[tuple\[str, int]] | `[]` | Initial peers used to join the network, e.g. `[ ("bootstrap.astreum.org", 7373) ]`. |
52
+
53
+ > **Note**
54
+ > The peer‑to‑peer *route* used for object discovery is always enabled.
55
+ > If `validation_secret_key` is provided the node automatically joins the validation route too.
56
+
57
+ ### Example
58
+
59
+ ```python
60
+ from astreum.node import Node
61
+
62
+ config = {
63
+ "machine-only": False, # run full node
64
+ "relay_secret_key": "ab…cd", # optional – hex encoded
65
+ "validation_secret_key": "12…34", # optional – validator
66
+ "storage_path": "./data/node1",
67
+ "storage_get_relay_timeout": 5,
68
+ "incoming_port": 7373,
69
+ "use_ipv6": False,
70
+ "bootstrap": [
71
+ ("bootstrap.astreum.org", 7373),
72
+ ("127.0.0.1", 7374)
73
+ ]
74
+ }
75
+
76
+ node = Node(config)
77
+ # … your code …
78
+ ```
79
+
80
+ ## Lispeum Machine Quickstart
81
+
82
+ The Lispeum virtual machine (VM) is embedded inside `astreum.Node`. You feed it Lispeum source text, and the node tokenizes, parses, and **evaluates** the resulting AST inside an isolated *session* (lexical environment).
83
+
84
+ ```python
85
+ from astreum.node import Node
86
+ from astreum.machine.tokenizer import tokenize
87
+ from astreum.machine.parser import parse
88
+
89
+ # 1. Spin‑up a stand‑alone VM (machine‑only node).
90
+ node = Node({"machine-only": True})
91
+
92
+ # 2. Create a fresh session (environment).
93
+ session_id = node.machine_session_create()
94
+
95
+ # 3. Convert Lispeum source → Expr AST.
96
+ source = '(+ 1 (* 2 3))'
97
+ expr, _ = parse(tokenize(source))
98
+
99
+ # 4. Evaluate inside that session.
100
+ env = node.sessions[session_id] # fetch the Env
101
+ result = node.machine_expr_eval(env, expr) # -> Expr.Integer(7)
102
+
103
+ print(result.value) # 7
104
+ ```
105
+
106
+ ### Handling errors
107
+
108
+ Both helpers raise `ParseError` (from `astreum.machine.error`) when something goes wrong:
109
+
110
+ * Unterminated string literals are caught by `tokenize` fileciteturn1file1
111
+ * Unexpected or missing parentheses are caught by `parse` fileciteturn1file0
112
+
113
+ Catch the exception to provide developer‑friendly diagnostics:
114
+
115
+ ```python
116
+ try:
117
+ tokens = tokenize(bad_source)
118
+ expr, _ = parse(tokens)
119
+ except ParseError as e:
120
+ print("Parse failed:", e)
121
+ ```
122
+
123
+ Both helpers raise `ParseError` (from `astreum.machine.error`) when something goes wrong:
124
+
125
+ * Unterminated string literals are caught by `tokenize` fileciteturn1file1
126
+ * Unexpected or missing parentheses are caught by `parse` fileciteturn1file0
127
+
128
+ Catch the exception to provide developer‑friendly diagnostics:
129
+
130
+ ```python
131
+ try:
132
+ tokens = tokenize(bad_source)
133
+ expr, _ = parse(tokens)
134
+ except ParseError as e:
135
+ print("Parse failed:", e)
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Testing
141
+
142
+ ```bash
143
+ python3 -m unittest discover -s tests
144
+ ```
@@ -0,0 +1,126 @@
1
+ # Astreum Python Library
2
+
3
+ Python library to interact with the Astreum blockchain and its Lispeum virtual machine.
4
+
5
+ [View on PyPI](https://pypi.org/project/astreum/)
6
+
7
+ ## Configuration
8
+
9
+ When initializing an `astreum.Node`, pass a dictionary with any of the options below. Only the parameters you want to override need to be present – everything else falls back to its default.
10
+
11
+ ### Core Configuration
12
+
13
+ | Parameter | Type | Default | Description |
14
+ | -------------- | ---- | ------- | ----------- |
15
+ | `machine-only` | bool | `True` | When |
16
+
17
+ | |
18
+ | - |
19
+
20
+ | **True** the node starts in *machine‑only* mode: no storage subsystem and no relay networking – only the Lispeum VM. Set to **False** to enable storage and relay features. | | | |
21
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -------------- | ------------------------------------------------------------------------------------------------------------------------ |
22
+ | `relay_secret_key` | hex string | Auto‑generated | Ed25519 private key that identifies the node on the network. If omitted a fresh keypair is generated and kept in‑memory. |
23
+ | `validation_secret_key` | hex string | `None` | X25519 private key that lets the node participate in the validation route. Leave unset for a non‑validator node. |
24
+ | `storage_path` | string | `None` | Directory where objects are persisted. If *None* the node uses an in‑memory store. |
25
+ | `storage_get_relay_timeout` | float | `5` | Seconds to wait for an object requested from peers before timing‑out. |
26
+
27
+ ### Networking
28
+
29
+ | Parameter | Type | Default | Description |
30
+ | --------------- | ----------------------- | ------- | ----------------------------------------------------------------------------------- |
31
+ | `use_ipv6` | bool | `False` | Listen on IPv6 as well as IPv4. |
32
+ | `incoming_port` | int | `7373` | UDP port the relay binds to. |
33
+ | `bootstrap` | list\[tuple\[str, int]] | `[]` | Initial peers used to join the network, e.g. `[ ("bootstrap.astreum.org", 7373) ]`. |
34
+
35
+ > **Note**
36
+ > The peer‑to‑peer *route* used for object discovery is always enabled.
37
+ > If `validation_secret_key` is provided the node automatically joins the validation route too.
38
+
39
+ ### Example
40
+
41
+ ```python
42
+ from astreum.node import Node
43
+
44
+ config = {
45
+ "machine-only": False, # run full node
46
+ "relay_secret_key": "ab…cd", # optional – hex encoded
47
+ "validation_secret_key": "12…34", # optional – validator
48
+ "storage_path": "./data/node1",
49
+ "storage_get_relay_timeout": 5,
50
+ "incoming_port": 7373,
51
+ "use_ipv6": False,
52
+ "bootstrap": [
53
+ ("bootstrap.astreum.org", 7373),
54
+ ("127.0.0.1", 7374)
55
+ ]
56
+ }
57
+
58
+ node = Node(config)
59
+ # … your code …
60
+ ```
61
+
62
+ ## Lispeum Machine Quickstart
63
+
64
+ The Lispeum virtual machine (VM) is embedded inside `astreum.Node`. You feed it Lispeum source text, and the node tokenizes, parses, and **evaluates** the resulting AST inside an isolated *session* (lexical environment).
65
+
66
+ ```python
67
+ from astreum.node import Node
68
+ from astreum.machine.tokenizer import tokenize
69
+ from astreum.machine.parser import parse
70
+
71
+ # 1. Spin‑up a stand‑alone VM (machine‑only node).
72
+ node = Node({"machine-only": True})
73
+
74
+ # 2. Create a fresh session (environment).
75
+ session_id = node.machine_session_create()
76
+
77
+ # 3. Convert Lispeum source → Expr AST.
78
+ source = '(+ 1 (* 2 3))'
79
+ expr, _ = parse(tokenize(source))
80
+
81
+ # 4. Evaluate inside that session.
82
+ env = node.sessions[session_id] # fetch the Env
83
+ result = node.machine_expr_eval(env, expr) # -> Expr.Integer(7)
84
+
85
+ print(result.value) # 7
86
+ ```
87
+
88
+ ### Handling errors
89
+
90
+ Both helpers raise `ParseError` (from `astreum.machine.error`) when something goes wrong:
91
+
92
+ * Unterminated string literals are caught by `tokenize` fileciteturn1file1
93
+ * Unexpected or missing parentheses are caught by `parse` fileciteturn1file0
94
+
95
+ Catch the exception to provide developer‑friendly diagnostics:
96
+
97
+ ```python
98
+ try:
99
+ tokens = tokenize(bad_source)
100
+ expr, _ = parse(tokens)
101
+ except ParseError as e:
102
+ print("Parse failed:", e)
103
+ ```
104
+
105
+ Both helpers raise `ParseError` (from `astreum.machine.error`) when something goes wrong:
106
+
107
+ * Unterminated string literals are caught by `tokenize` fileciteturn1file1
108
+ * Unexpected or missing parentheses are caught by `parse` fileciteturn1file0
109
+
110
+ Catch the exception to provide developer‑friendly diagnostics:
111
+
112
+ ```python
113
+ try:
114
+ tokens = tokenize(bad_source)
115
+ expr, _ = parse(tokens)
116
+ except ParseError as e:
117
+ print("Parse failed:", e)
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Testing
123
+
124
+ ```bash
125
+ python3 -m unittest discover -s tests
126
+ ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "astreum"
3
- version = "0.1.20"
3
+ version = "0.2.0"
4
4
  authors = [
5
5
  { name="Roy R. O. Okello", email="roy@stelar.xyz" },
6
6
  ]
@@ -0,0 +1 @@
1
+ from node import Node
@@ -34,7 +34,7 @@ import os
34
34
  from dataclasses import dataclass
35
35
  from typing import Optional, Tuple, List
36
36
  from .message import Message, Topic
37
- from astreum.utils.bytes_format import encode, decode
37
+ from astreum.format import encode, decode
38
38
  from ..utils import hash_data
39
39
 
40
40
  @dataclass
@@ -6,7 +6,7 @@ import struct
6
6
  from enum import IntEnum, auto
7
7
  from dataclasses import dataclass
8
8
  from typing import Optional
9
- from astreum.utils.bytes_format import encode, decode
9
+ from astreum.format import encode, decode
10
10
 
11
11
  class Topic(IntEnum):
12
12
  """
@@ -1,6 +1,6 @@
1
1
  import blake3
2
2
  from .storage import Storage
3
- from astreum.utils import bytes_format
3
+ from astreum import format
4
4
 
5
5
  class MerkleNode:
6
6
  def __init__(self, leaf: bool, data: bytes):
@@ -27,7 +27,7 @@ class MerkleNode:
27
27
  :param data: The serialized node data.
28
28
  :return: A new MerkleNode instance.
29
29
  """
30
- leaf_flag, node_data = bytes_format.decode(data)
30
+ leaf_flag, node_data = format.decode(data)
31
31
  return cls(True if leaf_flag == 1 else False, node_data)
32
32
 
33
33
  @classmethod
@@ -52,7 +52,7 @@ class MerkleNode:
52
52
 
53
53
  :return: The serialized bytes representing the node.
54
54
  """
55
- return bytes_format.encode([1 if self.leaf else 0, self.data])
55
+ return format.encode([1 if self.leaf else 0, self.data])
56
56
 
57
57
  def hash(self) -> bytes:
58
58
  """
@@ -1,7 +1,7 @@
1
1
  import blake3
2
2
  from typing import Optional, List
3
3
  from .storage import Storage
4
- import astreum.utils.bytes_format as bytes_format bytes_format.decode, bytes_format.encode
4
+ import astreum.format as format format.decode, format.encode
5
5
 
6
6
 
7
7
  def common_prefix_length(a: bytes, b: bytes) -> int:
@@ -35,7 +35,7 @@ class PatriciaNode:
35
35
  Expected format: [key, value, children]
36
36
  where children is a list of child node hashes (bytes).
37
37
  """
38
- decoded = bytes_format.decode(data)
38
+ decoded = format.decode(data)
39
39
  key, value, children = decoded
40
40
  return cls(key, value, children)
41
41
 
@@ -59,7 +59,7 @@ class PatriciaNode:
59
59
 
60
60
  Structure: [key, value, children]
61
61
  """
62
- return bytes_format.encode([self.key, self.value, self.children])
62
+ return format.encode([self.key, self.value, self.children])
63
63
 
64
64
  def hash(self) -> bytes:
65
65
  """
@@ -39,6 +39,8 @@ class Storage:
39
39
  self.pending_requests = {} # hash -> (start_time, event)
40
40
  self.request_lock = threading.Lock()
41
41
 
42
+
43
+
42
44
  def put(self, data_hash: bytes, data: bytes) -> bool:
43
45
  """Store data with its hash. Returns True if successful, False if space limit exceeded."""
44
46
  data_size = len(data)
@@ -4,7 +4,7 @@ Utility functions for the Astreum blockchain.
4
4
 
5
5
  import blake3
6
6
 
7
- def hash_data(data: bytes) -> bytes:
7
+ def blake3_hash(data: bytes) -> bytes:
8
8
  """
9
9
  Hash data using BLAKE3.
10
10
 
@@ -1,7 +1,7 @@
1
1
  from typing import Optional
2
2
  from ..storage.patricia import PatriciaTrie
3
3
 
4
- import astreum.utils.bytes_format as bytes_format
4
+ import astreum.format as format
5
5
  class Account:
6
6
  def __init__(self, public_key: bytes, balance: int, code: bytes, counter: int, data: bytes, secret_key: Optional[bytes] = None):
7
7
  """
@@ -30,7 +30,7 @@ class Account:
30
30
 
31
31
  The public_key (and optional secret_key) must be provided separately.
32
32
  """
33
- decoded = bytes_format.decode(data)
33
+ decoded = format.decode(data)
34
34
  balance, code, counter, account_data = decoded
35
35
  return cls(public_key, balance, code, counter, account_data, secret_key=secret_key)
36
36
 
@@ -40,7 +40,7 @@ class Account:
40
40
 
41
41
  Format: [balance, code, counter, data]
42
42
  """
43
- return bytes_format.encode([
43
+ return format.encode([
44
44
  self.balance,
45
45
  self.code,
46
46
  self.counter,
@@ -1,7 +1,7 @@
1
1
  from typing import Optional
2
2
  import time
3
3
  from .account import Account, get_account_from_storage
4
- import astreum.utils.bytes_format as bytes_format
4
+ import astreum.format as format
5
5
 
6
6
  class Transaction:
7
7
  def __init__(
@@ -36,7 +36,7 @@ class Transaction:
36
36
  Returns:
37
37
  Transaction object
38
38
  """
39
- decoded = bytes_format.decode(data)
39
+ decoded = format.decode(data)
40
40
  sender_public_key, recipient_public_key, amount, tx_data, counter, timestamp, signature = decoded
41
41
 
42
42
  sender_account = None
@@ -63,7 +63,7 @@ class Transaction:
63
63
 
64
64
  Format: [sender_hash, recipient_hash, amount, data, counter, timestamp, signature]
65
65
  """
66
- return bytes_format.encode([
66
+ return format.encode([
67
67
  self.sender.public_key,
68
68
  self.recipient.public_key,
69
69
  self.amount,
@@ -0,0 +1,2 @@
1
+ from parser import parse
2
+ from tokenizer import tokenize
@@ -1,6 +1,6 @@
1
1
  from typing import List, Tuple
2
2
  from astreum.machine.error import ParseError
3
- from astreum.lispeum.expression import Expr
3
+ from astreum.node import Expr
4
4
 
5
5
 
6
6
  def parse(tokens: List[str]) -> Tuple[Expr, List[str]]:
@@ -0,0 +1,4 @@
1
+ from typing import Dict, Optional
2
+ from astreum.lispeum.expression import Expr
3
+
4
+