astreum 0.1.15__tar.gz → 0.1.16__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 (62) hide show
  1. {astreum-0.1.15/src/astreum.egg-info → astreum-0.1.16}/PKG-INFO +3 -2
  2. {astreum-0.1.15 → astreum-0.1.16}/pyproject.toml +1 -1
  3. astreum-0.1.16/src/astreum/node/crypto/ed25519.py +50 -0
  4. astreum-0.1.16/src/astreum/node/crypto/x25519.py +31 -0
  5. astreum-0.1.16/src/astreum/node/validation/transaction.py +90 -0
  6. astreum-0.1.16/src/astreum/utils/__init__.py +0 -0
  7. {astreum-0.1.15 → astreum-0.1.16/src/astreum.egg-info}/PKG-INFO +3 -2
  8. {astreum-0.1.15 → astreum-0.1.16}/src/astreum.egg-info/SOURCES.txt +4 -0
  9. {astreum-0.1.15 → astreum-0.1.16}/LICENSE +0 -0
  10. {astreum-0.1.15 → astreum-0.1.16}/README.md +0 -0
  11. {astreum-0.1.15 → astreum-0.1.16}/setup.cfg +0 -0
  12. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/__init__.py +0 -0
  13. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/__init__.py +0 -0
  14. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/expression.py +0 -0
  15. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/parser.py +0 -0
  16. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/__init__.py +0 -0
  17. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/definition.py +0 -0
  18. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/list/__init__.py +0 -0
  19. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/list/all.py +0 -0
  20. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/list/any.py +0 -0
  21. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/list/fold.py +0 -0
  22. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/list/get.py +0 -0
  23. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/list/insert.py +0 -0
  24. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/list/map.py +0 -0
  25. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/list/position.py +0 -0
  26. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/list/remove.py +0 -0
  27. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/number/__init__.py +0 -0
  28. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/special/number/addition.py +0 -0
  29. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/storage.py +0 -0
  30. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/tokenizer.py +0 -0
  31. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/lispeum/utils.py +0 -0
  32. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/machine/__init__.py +0 -0
  33. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/machine/environment.py +0 -0
  34. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/machine/error.py +0 -0
  35. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/__init__.py +0 -0
  36. {astreum-0.1.15/src/astreum/utils → astreum-0.1.16/src/astreum/node/crypto}/__init__.py +0 -0
  37. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/relay/__init__.py +0 -0
  38. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/relay/bucket.py +0 -0
  39. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/relay/envelope.py +0 -0
  40. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/relay/message.py +0 -0
  41. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/relay/peer.py +0 -0
  42. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/relay/route.py +0 -0
  43. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/storage/__init__.py +0 -0
  44. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/storage/merkle.py +0 -0
  45. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/storage/storage.py +0 -0
  46. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/storage/trie.py +0 -0
  47. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/storage/utils.py +0 -0
  48. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/utils.py +0 -0
  49. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/validation/__init__.py +0 -0
  50. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/validation/account.py +0 -0
  51. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/validation/block/__init__.py +0 -0
  52. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/validation/block/create.py +0 -0
  53. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/validation/block/model.py +0 -0
  54. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/validation/block/validate.py +0 -0
  55. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/validation/constants.py +0 -0
  56. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/validation/stake.py +0 -0
  57. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/validation/state.py +0 -0
  58. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/node/validation/vdf.py +0 -0
  59. {astreum-0.1.15 → astreum-0.1.16}/src/astreum/utils/bytes_format.py +0 -0
  60. {astreum-0.1.15 → astreum-0.1.16}/src/astreum.egg-info/dependency_links.txt +0 -0
  61. {astreum-0.1.15 → astreum-0.1.16}/src/astreum.egg-info/requires.txt +0 -0
  62. {astreum-0.1.15 → astreum-0.1.16}/src/astreum.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: astreum
3
- Version: 0.1.15
3
+ Version: 0.1.16
4
4
  Summary: Python library to interact with the Astreum blockchain and its Lispeum virtual machine.
5
5
  Author-email: "Roy R. O. Okello" <roy@stelar.xyz>
6
6
  Project-URL: Homepage, https://github.com/astreum/lib
@@ -14,6 +14,7 @@ License-File: LICENSE
14
14
  Requires-Dist: pycryptodomex==3.21.0
15
15
  Requires-Dist: cryptography==44.0.2
16
16
  Requires-Dist: blake3==1.0.4
17
+ Dynamic: license-file
17
18
 
18
19
  # lib
19
20
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "astreum"
3
- version = "0.1.15"
3
+ version = "0.1.16"
4
4
  authors = [
5
5
  { name="Roy R. O. Okello", email="roy@stelar.xyz" },
6
6
  ]
@@ -0,0 +1,50 @@
1
+ # EdDSA signature algorithm over Curve25519
2
+
3
+ # ed25519.py
4
+ from cryptography.hazmat.primitives.asymmetric import ed25519
5
+ from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey, Ed25519PublicKey
6
+ from cryptography.exceptions import InvalidSignature
7
+ from typing import Tuple
8
+
9
+ def generate_key_pair() -> Tuple[Ed25519PrivateKey, Ed25519PublicKey]:
10
+ """
11
+ Generate an Ed25519 private and public key pair.
12
+
13
+ Returns:
14
+ Tuple[Ed25519PrivateKey, Ed25519PublicKey]: The generated key pair.
15
+ """
16
+ private_key: Ed25519PrivateKey = ed25519.Ed25519PrivateKey.generate()
17
+ public_key: Ed25519PublicKey = private_key.public_key()
18
+ return private_key, public_key
19
+
20
+ def sign_message(private_key: Ed25519PrivateKey, message: bytes) -> bytes:
21
+ """
22
+ Sign a message using the provided Ed25519 private key.
23
+
24
+ Args:
25
+ private_key (Ed25519PrivateKey): The private key used for signing.
26
+ message (bytes): The message to sign.
27
+
28
+ Returns:
29
+ bytes: The signature.
30
+ """
31
+ signature: bytes = private_key.sign(message)
32
+ return signature
33
+
34
+ def verify_signature(public_key: Ed25519PublicKey, message: bytes, signature: bytes) -> bool:
35
+ """
36
+ Verify a message signature using the provided Ed25519 public key.
37
+
38
+ Args:
39
+ public_key (Ed25519PublicKey): The public key corresponding to the private key that signed.
40
+ message (bytes): The original message.
41
+ signature (bytes): The signature to verify.
42
+
43
+ Returns:
44
+ bool: True if the signature is valid, False otherwise.
45
+ """
46
+ try:
47
+ public_key.verify(signature, message)
48
+ return True
49
+ except InvalidSignature:
50
+ return False
@@ -0,0 +1,31 @@
1
+ # Diffie-Hellman key exchange over Curve25519
2
+
3
+ # x25519.py
4
+ from cryptography.hazmat.primitives.asymmetric import x25519
5
+ from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey, X25519PublicKey
6
+ from typing import Tuple
7
+
8
+ def generate_key_pair() -> Tuple[X25519PrivateKey, X25519PublicKey]:
9
+ """
10
+ Generate an X25519 private and public key pair.
11
+
12
+ Returns:
13
+ Tuple[X25519PrivateKey, X25519PublicKey]: The generated key pair.
14
+ """
15
+ private_key: X25519PrivateKey = x25519.X25519PrivateKey.generate()
16
+ public_key: X25519PublicKey = private_key.public_key()
17
+ return private_key, public_key
18
+
19
+ def generate_shared_key(private_key: X25519PrivateKey, peer_public_key: X25519PublicKey) -> bytes:
20
+ """
21
+ Generate a shared key using the provided private key and peer's public key.
22
+
23
+ Args:
24
+ private_key (X25519PrivateKey): Our private key.
25
+ peer_public_key (X25519PublicKey): The peer's public key.
26
+
27
+ Returns:
28
+ bytes: The shared key.
29
+ """
30
+ shared_key: bytes = private_key.exchange(peer_public_key)
31
+ return shared_key
@@ -0,0 +1,90 @@
1
+ from .account import Account
2
+
3
+ class Transaction:
4
+ def __init__(
5
+ self,
6
+ sender: Account,
7
+ recipient: Account,
8
+ amount: int,
9
+ data: bytes = None,
10
+ counter: int = 0
11
+ ):
12
+ self.sender = sender
13
+ self.recipient = recipient
14
+ self.amount = amount
15
+ self.data = data
16
+ self.counter = counter
17
+ self.timestamp = time.time()
18
+ self.signature = None
19
+
20
+
21
+ def get_tx_from_storage(hash: bytes) -> Optional[Transaction]:
22
+ """Resolves storage objects to get a transaction.
23
+
24
+ Args:
25
+ hash: Hash of the transaction and merkle root of the transaction
26
+
27
+ Returns:
28
+ Transaction object if found, None otherwise
29
+ """
30
+ return None
31
+
32
+
33
+ def put_tx_to_storage(transaction: Transaction):
34
+ """Puts a transaction into storage.
35
+
36
+ Args:
37
+ transaction: Transaction object to put into storage
38
+
39
+ Returns:
40
+ None
41
+ """
42
+ return None
43
+
44
+
45
+ def get_tx_hash(transaction: Transaction) -> bytes:
46
+ """Get the hash of a transaction.
47
+
48
+ Args:
49
+ transaction: Transaction object to get hash for
50
+
51
+ Returns:
52
+ Merkle root of the transaction body hash and signature
53
+ """
54
+ return hash_data(get_tx_body_hash(transaction) + hash_data(transaction.signature))
55
+
56
+ def get_tx_body_hash(transaction: Transaction) -> bytes:
57
+ """Get the hash of the transaction body.
58
+
59
+ Args:
60
+ transaction: Transaction object to get hash for
61
+
62
+ Returns:
63
+ Hash of the transaction body
64
+ """
65
+ return hash_data(transaction)
66
+
67
+ def sign_tx(transaction: Transaction, private_key: bytes) -> Transaction:
68
+ """Sign a transaction.
69
+
70
+ Args:
71
+ transaction: Transaction object to sign
72
+ private_key: Private key to sign with
73
+
74
+ Returns:
75
+ Signed transaction
76
+ """
77
+ transaction.signature = hash_data(get_tx_body_hash(transaction) + private_key)
78
+ return transaction
79
+
80
+
81
+ def verify_tx(transaction: Transaction) -> bool:
82
+ """Verify a transaction.
83
+
84
+ Args:
85
+ transaction: Transaction object to verify,with sender public key
86
+
87
+ Returns:
88
+ True if the transaction is valid, False otherwise
89
+ """
90
+ return True
File without changes
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: astreum
3
- Version: 0.1.15
3
+ Version: 0.1.16
4
4
  Summary: Python library to interact with the Astreum blockchain and its Lispeum virtual machine.
5
5
  Author-email: "Roy R. O. Okello" <roy@stelar.xyz>
6
6
  Project-URL: Homepage, https://github.com/astreum/lib
@@ -14,6 +14,7 @@ License-File: LICENSE
14
14
  Requires-Dist: pycryptodomex==3.21.0
15
15
  Requires-Dist: cryptography==44.0.2
16
16
  Requires-Dist: blake3==1.0.4
17
+ Dynamic: license-file
17
18
 
18
19
  # lib
19
20
 
@@ -31,6 +31,9 @@ src/astreum/machine/environment.py
31
31
  src/astreum/machine/error.py
32
32
  src/astreum/node/__init__.py
33
33
  src/astreum/node/utils.py
34
+ src/astreum/node/crypto/__init__.py
35
+ src/astreum/node/crypto/ed25519.py
36
+ src/astreum/node/crypto/x25519.py
34
37
  src/astreum/node/relay/__init__.py
35
38
  src/astreum/node/relay/bucket.py
36
39
  src/astreum/node/relay/envelope.py
@@ -47,6 +50,7 @@ src/astreum/node/validation/account.py
47
50
  src/astreum/node/validation/constants.py
48
51
  src/astreum/node/validation/stake.py
49
52
  src/astreum/node/validation/state.py
53
+ src/astreum/node/validation/transaction.py
50
54
  src/astreum/node/validation/vdf.py
51
55
  src/astreum/node/validation/block/__init__.py
52
56
  src/astreum/node/validation/block/create.py
File without changes
File without changes
File without changes