"""Makes the house agent's wallet key on this PC. The wallet holds the money. It signs the agent's session once; after that the agent trades with its own executor key, which Orblivion's signing service made and never lets out. """ import json import os from eth_account import Account from common import KEYS os.makedirs(KEYS, exist_ok=True) path = os.path.join(KEYS, "wallet.json") if not os.path.exists(path): # never replaces a key key = Account.create().key.hex() with open(path, "x", encoding="utf-8") as f: json.dump({"private_key": key if key.startswith("0x") else "0x" + key}, f) with open(path, encoding="utf-8") as f: print(f"wallet {Account.from_key(json.load(f)['private_key']).address}") print(f"\nThe key is in {KEYS}. It never leaves this PC and is never printed.")