astreum 0.2.22__tar.gz → 0.2.23__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 (29) hide show
  1. {astreum-0.2.22/src/astreum.egg-info → astreum-0.2.23}/PKG-INFO +1 -1
  2. {astreum-0.2.22 → astreum-0.2.23}/pyproject.toml +1 -1
  3. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/models/block.py +40 -0
  4. {astreum-0.2.22 → astreum-0.2.23/src/astreum.egg-info}/PKG-INFO +1 -1
  5. {astreum-0.2.22 → astreum-0.2.23}/LICENSE +0 -0
  6. {astreum-0.2.22 → astreum-0.2.23}/README.md +0 -0
  7. {astreum-0.2.22 → astreum-0.2.23}/setup.cfg +0 -0
  8. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/__init__.py +0 -0
  9. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/crypto/__init__.py +0 -0
  10. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/crypto/ed25519.py +0 -0
  11. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/crypto/quadratic_form.py +0 -0
  12. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/crypto/wesolowski.py +0 -0
  13. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/crypto/x25519.py +0 -0
  14. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/format.py +0 -0
  15. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/lispeum/__init__.py +0 -0
  16. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/lispeum/parser.py +0 -0
  17. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/lispeum/tokenizer.py +0 -0
  18. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/models/__init__.py +0 -0
  19. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/models/account.py +0 -0
  20. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/models/accounts.py +0 -0
  21. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/models/merkle.py +0 -0
  22. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/models/patricia.py +0 -0
  23. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/models/transaction.py +0 -0
  24. {astreum-0.2.22 → astreum-0.2.23}/src/astreum/node.py +0 -0
  25. {astreum-0.2.22 → astreum-0.2.23}/src/astreum.egg-info/SOURCES.txt +0 -0
  26. {astreum-0.2.22 → astreum-0.2.23}/src/astreum.egg-info/dependency_links.txt +0 -0
  27. {astreum-0.2.22 → astreum-0.2.23}/src/astreum.egg-info/requires.txt +0 -0
  28. {astreum-0.2.22 → astreum-0.2.23}/src/astreum.egg-info/top_level.txt +0 -0
  29. {astreum-0.2.22 → astreum-0.2.23}/tests/test_node_machine.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astreum
3
- Version: 0.2.22
3
+ Version: 0.2.23
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "astreum"
3
- version = "0.2.22"
3
+ version = "0.2.23"
4
4
  authors = [
5
5
  { name="Roy R. O. Okello", email="roy@stelar.xyz" },
6
6
  ]
@@ -1,6 +1,10 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from typing import List, Dict, Any, Optional, Union
4
+
5
+ from astreum.models.account import Account
6
+ from astreum.models.accounts import Accounts
7
+ from astreum.models.patricia import PatriciaTrie
4
8
  from ..crypto import ed25519
5
9
  from .merkle import MerkleTree
6
10
 
@@ -128,3 +132,39 @@ class Block:
128
132
  return True
129
133
  except Exception:
130
134
  return False
135
+
136
+ @classmethod
137
+ def genesis(cls, validator_addr: bytes) -> "Block":
138
+ # 1 . validator-stakes sub-trie
139
+ stake_trie = PatriciaTrie()
140
+ stake_trie.put(validator_addr, (1).to_bytes(32, "big"))
141
+ stake_root = stake_trie.root_hash
142
+
143
+ # 2 . build the two Account bodies
144
+ validator_acct = Account.create(balance=0, data=b"", nonce=0)
145
+ treasury_acct = Account.create(balance=1, data=stake_root, nonce=0)
146
+
147
+ # 3 . global Accounts structure
148
+ accts = Accounts()
149
+ accts.set_account(validator_addr, validator_acct)
150
+ accts.set_account(b"\x11" * 32, treasury_acct)
151
+ accounts_hash = accts.root_hash
152
+
153
+ # 4 . constant body fields for genesis
154
+ body_kwargs = dict(
155
+ number = 0,
156
+ prev_block_hash = b"\x00" * 32,
157
+ timestamp = 0,
158
+ accounts_hash = accounts_hash,
159
+ transactions_total_fees = 0,
160
+ transaction_limit = 0,
161
+ transactions_root_hash = b"\x00" * 32,
162
+ delay_difficulty = 0,
163
+ delay_output = b"",
164
+ delay_proof = b"",
165
+ validator_pk = validator_addr,
166
+ signature = b"",
167
+ )
168
+
169
+ # 5 . build and return the block
170
+ return cls.create(**body_kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astreum
3
- Version: 0.2.22
3
+ Version: 0.2.23
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
File without changes
File without changes
File without changes
File without changes
File without changes