def reg(self): try: Account.enable_unaudited_hdwallet_features() privatekey = self.ids['privatetext'].text acct = Account.from_key(privatekey) public = acct._address private_key = Web3.toHex(acct._key_obj.__dict__['_raw_key']) CteaPerceApp.private_key = private_key CteaPerceApp.public = public self.manager.current = 'PickPasswordSign' except: self.ids['stat'].text = 'Ключ введён неверно'
def add_account(self, *args): # Registration Account.enable_unaudited_hdwallet_features() acct, mnemonic = Account.create_with_mnemonic() # Get private key private_class = Account.from_mnemonic(mnemonic) private_dict = private_class.__dict__ private_key = str(private_dict['_key_obj']) CteaPerceApp.mnemonic = mnemonic CteaPerceApp.public = acct.address CteaPerceApp.private_key = private_key
def get_account_from_words(words: str, index: int = 0, hd_path: str = ETHEREUM_DEFAULT_PATH) -> LocalAccount: """ :param words: Mnemonic words(BIP39) for a Hierarchical Deterministic Wallet(BIP32) :param index: Index of account :param hd_path: BIP44 Path. By default Ethereum with 0 index is used :return: Ethereum Account :raises: eth_utils.ValidationError """ Account.enable_unaudited_hdwallet_features() if index: hd_path = f'{ETHEREUM_BASE_PATH}/{index}' return Account.from_mnemonic(words, account_path=hd_path)
def reg(self): try: Account.enable_unaudited_hdwallet_features() mnem = self.ids['mnemonictext'].text acct = Account.from_mnemonic(mnem) public = acct._address private_key = Web3.toHex(acct._key_obj.__dict__['_raw_key']) CteaPerceApp.private_key = private_key CteaPerceApp.mnemonic = mnem CteaPerceApp.public = public self.manager.current = 'PickPasswordSign' except: self.ids['stat'].text = 'Фраза введена неверно'
from web3 import Web3 from web3.types import TxReceipt from eth_account import Account import json from eth_sandbox import load_auth_key from hexbytes import HexBytes from uuid import UUID HTTP_PORT = os.getenv("HTTP_PORT", "8545") INTERNAL_URL = f'http://127.0.0.1:{HTTP_PORT}' PUBLIC_IP = os.getenv('PUBLIC_IP', '127.0.0.1') PUBLIC_URL = f'http://{PUBLIC_IP}:{HTTP_PORT}' Account.enable_unaudited_hdwallet_features() @dataclass class Action: name: str handler: Callable[[], int] GANACHE_UNLOCK = "evm_unlockUnknownAccount" GANACHE_LOCK = "evm_lockUnknownAccount" def send_tx(web3: Web3, tx: Dict, deployer: str) -> Optional[TxReceipt]: if "gas" not in tx: tx["gas"] = 9_500_000