Skip to content

Commit

Permalink
Export state to json (#94)
Browse files Browse the repository at this point in the history
* hash to hex

* rm print

* testing exported state as genesis
  • Loading branch information
duelingbenjos authored Apr 24, 2024
1 parent 1a1ebc2 commit de684a5
Show file tree
Hide file tree
Showing 2 changed files with 2,190 additions and 46 deletions.
3 changes: 1 addition & 2 deletions src/xian/tools/export_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def hash_genesis_block_state_changes(state_changes: list) -> str:
# Convert all non-serializable objects in state_changes to a serializable format
def serialize(obj):
if isinstance(obj, bytes):
print(obj)
return obj.hex() # Convert bytes to hex string
# return str(obj) # Fallback: convert other types to string

Expand Down Expand Up @@ -51,7 +50,7 @@ def build_genesis_block(founder_sk: str, contract_state: dict, run_state: dict):
}

print("Populating run state...")
genesis_block["hash"] = run_state["__latest_block.hash"].decode("utf-8")
genesis_block["hash"] = run_state["__latest_block.hash"].hex()
genesis_block["number"] = run_state["__latest_block.height"]

print('Populating genesis block...')
Expand Down
Loading

0 comments on commit de684a5

Please sign in to comment.