def checkTransferAddress(): with open(config.csv_file) as f: for row in [row for row in csv.DictReader(f)]: try: checksum_encode(row["address"]) except Exception as e: print(e) return print("all address is valid")
def transfer_from(addr_from, addr_to, token_id, pk): addr_from = checksum_encode(addr_from) addr_to = checksum_encode(addr_to) tx_id = eth_client.contruct_Transaction( "wba", invoker=addr_from, method="transferFrom", args=[addr_from, addr_to, token_id], private_key=pk) return {"txId": tx_id}
def get_balance_of_erc20(self,contract_address, abi, address): """ :param contract_address: :param abi: :param address: :return: """ contract = self.get_contract_instance(checksum_encode(contract_address), abi) return contract.functions.balanceOf(checksum_encode(address)).call()/(10**8)
def transfer_from(addr_from, addr_to, token_id, pk): addr_from = checksum_encode(addr_from) addr_to = checksum_encode(addr_to) tx_id = eth_client.contruct_Transaction( "wba", invoker="0xBF3De70657B3C346E72720657Bbc75AbFc4Ec217", method="transferFrom", args=[addr_from, addr_to, token_id], private_key=pk) return {"txId": tx_id}
def confirm_tokens(self): eth_int = EthereumProvider().get_provider( network=self.contract.network.name) w3 = Web3(HTTPProvider(eth_int.url)) contract = w3.eth.contract(address=checksum_encode( self.eth_contract.address), abi=self.eth_contract.abi) tokens_to_confirm = list( map( checksum_encode, list( ApprovedToken.objects.filter( contract=self, is_confirmed=False).values_list('address', flat=True)))) print('tokens to confirm', tokens_to_confirm, flush=True) txn = contract.functions.addTokenType( tokens_to_confirm).buildTransaction({ 'from': checksum_encode( NETWORKS[self.contract.network.name]['address']), 'gas': self.get_gaslimit() }) print('txn', txn, flush=True) nonce = int( eth_int.eth_getTransactionCount( NETWORKS[self.contract.network.name]['address'], "pending"), 16) gas_price = ETH_COMMON_GAS_PRICES[ self.contract.network.name] * NET_DECIMALS['ETH_GAS_PRICE'] signed = sign_transaction( NETWORKS[self.contract.network.name]['address'], nonce, 3000000, self.contract.network.name, value=0, dest=self.eth_contract.address, contract_data=txn['data'][2:], gas_price=gas_price) print('signed', signed, flush=True) tx_hash = eth_int.eth_sendRawTransaction('0x' + signed) print('hash', tx_hash, flush=True)
def construct_erc20_tx(self, contract,addressFrom, addressTo,value, gasLimit=None, gasprice=None): tx_d = { 'gasPrice': self.web3.eth.gasPrice * 2 if not gasprice else gasprice, 'nonce': self.web3.eth.getTransactionCount(checksum_encode(addressFrom)), } if gasLimit: tx_d.update({"gas": gasLimit}) tx = contract.functions.transfer( checksum_encode(addressTo), int(value) ).buildTransaction(tx_d) return tx
def close_channel(self, invoker, channel_id, nonce, founder, founder_balance, partner, partner_balance, lock_hash, lock_secret, founder_signature, partner_signature, invoker_key, gwei_coef=1): """ Description: one side of the channel dismantle the channel unilaterally Description: channel partners have agreed to withdraw channel balance, but don't close the channel :param invoker: sender that trigger the transaction :param channel_id: channel identification code :param nonce: transaction nonce :param founder: closer that close the channel :param founder_balance: founder remaining assets amount :param partner: another partner address :param partner_balance: the partner remaining assets amount :param lock_hash: hash of lock_secret :param lock_secret: R value in HTLC transaction, default is all zero :param founder_signature: founder signature for above information :param partner_signature: partner signature for above information :param invoker_key: sender's key :return: transaction id """ founder = checksum_encode(founder) partner = checksum_encode(partner) try: tx_id = self.eth_client.contruct_Transaction( invoker, self.contract, "closeChannel", [ channel_id, nonce, founder, founder_balance, partner, partner_balance, lock_hash, lock_secret, founder_signature, partner_signature ], invoker_key, gwei_coef=gwei_coef) tx_msg = 'success' except Exception as e: tx_id = 'none' tx_msg = e return {"txData": tx_id, "txMessage": tx_msg}
def __init__(self, w3: Web3, owners: List[str], threshold: int, signature_s: int, master_copy: str, gas_price: int, funder: str, payment_token: str = None): assert 0 < threshold <= len(owners) self.owners = owners self.threshold = threshold self.s = signature_s self.master_copy = master_copy self.gas_price = gas_price self.funder = funder self.payment_token = payment_token self.gnosis_safe_contract = get_safe_team_contract(w3, master_copy) self.paying_proxy_contract = get_paying_proxy_contract(w3) safe_tx = self.get_initial_setup_safe_tx(owners, threshold) encoded_data = safe_tx['data'] self.gas = self._calculate_gas(owners, encoded_data) # Payment will be safe deploy cost + transfer fees for sending money to the deployer self.payment = self.gas * self.gas_price + 23000 self.contract_creation_tx_dict = self._build_proxy_contract_creation_tx( master_copy=self.master_copy, initializer=encoded_data, funder=self.funder, payment_token=self.payment_token, payment=self.payment, gas=self.gas, gas_price=self.gas_price) (self.contract_creation_tx, self.v, self.r) = self._generate_valid_transaction( gas_price, self.gas, self.contract_creation_tx_dict['data'], self.s) self.raw_tx = rlp.encode(self.contract_creation_tx) self.tx_hash = self.contract_creation_tx.hash self.deployer_address = checksum_encode( self.contract_creation_tx.sender) self.safe_address = checksum_encode( mk_contract_address(self.deployer_address, nonce=0))
def decode_owner(self, v: int, r: int, s: int, safe_tx_hash: EthereumBytes): if v == 0: # Contract signature # We don't need further checks contract_address = checksum_encode(r) return contract_address elif v == 1: # Approved hash return checksum_encode(r) elif v > 30: # Support eth_sign # defunct_hash_message preprends `\x19Ethereum Signed Message:\n32` message_hash = defunct_hash_message(primitive=safe_tx_hash) return get_signing_address(message_hash, v - 4, r, s) else: # EOA signature return get_signing_address(safe_tx_hash, v, r, s)
def get_balance_of_eth(self,address): """ :param address: :return: """ return self.web3.eth.getBalance(checksum_encode(address))/(10**18)
def __init__(self, private_key=create_private_key(), eth_provider=None): """ You need to provide a private key (to sign a transaction) and a node provider (to allow sending of transactions on the network). Example ## Main Network ## web3 = Web3(HTTPProvider('localhost:8545')) # need a local node, light node doesn't work and not enough space for full node web3 = Web3(HTTPProvider('https://api.myetherapi.com/eth')) # doesn't work, 403 error web3 = Web3(HTTPProvider('https://mainnet.infura.io/YOUR_API_KEY')) ## Ropsten ## web3 = Web3(HTTPProvider('https://api.myetherapi.com/rop')) # for Ropsten network, doesn't work web3 = Web3(HTTPProvider('https://ropsten.infura.io/YOUR_API_KEY')) """ if eth_provider is None: eth_provider = self.get_infura_node() self.web3 = Web3(HTTPProvider(eth_provider)) assert self.web3.isConnected() self.key = private_key raw = privtoaddr(private_key) self.address = checksum_encode(raw) assert self.web3.isAddress(self.address)
def contruct_Transaction(self, token_name, gasLimit=800000, **kwargs): """ :param token_name: 代币名称 :param args: 调用合约函数实参 :param method: 合约方法名称 :param invoker: 合约调用者(地址) :param private_key: 私钥 :return TX HASH """ invoker = kwargs["invoker"] args = kwargs["args"] method = kwargs["method"] private_key = kwargs["private_key"] contract_instance = self.get_contract_instance( setting.SmartContract[token_name][0], setting.SmartContract[token_name][1]) if not self.nonce_dict.get(invoker): self.nonce_dict[invoker] = self.web3.eth.getTransactionCount( checksum_encode(invoker)) tx = contract_instance.functions[method](*args).buildTransaction({ "gas": gasLimit, 'gasPrice': self.web3.eth.gasPrice, 'nonce': self.nonce_dict[invoker] }) # print(tx) signed = self.web3.eth.account.signTransaction(tx, private_key) tx_id = self.web3.eth.sendRawTransaction(signed.rawTransaction) self.nonce_dict[invoker] = self.nonce_dict[invoker] + 1 return "0x" + binascii.hexlify(tx_id).decode()
def invoke_contract(self, invoker, contract, method, args, gasLimit=800000): tx_dict = contract.functions[method](*args).buildTransaction({ "gas": gasLimit, 'gasPrice': self.web3.eth.gasPrice, 'nonce': self.web3.eth.getTransactionCount(checksum_encode(invoker)), }) tx = Transaction(nonce=tx_dict.get("nonce"), gasprice=tx_dict.get("gasPrice"), startgas=tx_dict.get("gas"), to=tx_dict.get("to"), value=tx_dict.get("value"), data=binascii.unhexlify(tx_dict.get("data")[2:])) UnsignedTransaction = Transaction.exclude(['v', 'r', 's']) unsigned_tx = rlp.encode(tx, UnsignedTransaction) return binascii.hexlify(unsigned_tx).decode()
def transfer_eth(self, addressFrom, addressTo, value, privtKey, data=b''): ''' eth转账 ''' dict_tx = { "from": addressFrom, "to": addressTo, "value": int(value * (10**18)), "data": data } if not self.nonce_dict.get(addressFrom): self.nonce_dict[addressFrom] = self.web3.eth.getTransactionCount( checksum_encode(addressFrom)) print(self.nonce_dict[addressFrom]) gas_limit = self.estimate_gas(dict_tx) * 2 print(gas_limit) tx = Transaction(nonce=self.nonce_dict[addressFrom], gasprice=self.web3.eth.gasPrice, startgas=gas_limit, to=addressTo, value=int(value * (10**18)), data=data) tx.sign(privtKey) raw_tx = self.web3.toHex(rlp.encode(tx)) tx_id = self.web3.eth.sendRawTransaction(raw_tx) self.nonce_dict[addressFrom] = self.nonce_dict[addressFrom] + 1 return {"txId": "0x" + binascii.hexlify(tx_id).decode()}
def get_contract_instance_erc721(self, contract_address): ''' 获取合约实例 ''' contract_address = checksum_encode(contract_address) contract = self.web3.eth.contract(address=contract_address, abi=ERC721_ABI) return contract
def genAddressAndCheck(searchWords, endOnly=False, verbose=False): privKey = utils.sha3(os.urandom(4096)) rawAddress = utils.privtoaddr(privKey) accAddress = utils.checksum_encode(rawAddress) accPrivateKey = utils.encode_hex(privKey) if verbose: print("Checking {}".format(accAddress)) # We search a lowercase version of the address for matches lowerAddress = accAddress.lower() found = False for word in searchWords: if endOnly: if (word in lowerAddress[1:len(word) + 2]) or (word in lowerAddress[-len(word):]): found = True else: if word in lowerAddress: found = True if found: return word, accAddress, accPrivateKey # No matches found return False
def __init__(self, private_key=None): self.private_key = private_key if private_key is None: self.private_key = SigningKey.generate( curve=SECP256k1).to_string().hex() self._raw_address = utils.privtoaddr(self.private_key) self.address = utils.checksum_encode(self._raw_address)
def send_erc20(self, asset, address_to, value, gasLimit=None, gasprice=None): """ :param asset: :param address_to: :param value: :param gasLimit: :param gasprice: :return: """ conract_address, abi, decimals = self.get_contract(asset) if not conract_address or not abi or not decimals: raise Exception("can not get asset %s info" % asset) contract_instance = settings.EthClient.get_contract_instance( conract_address, abi) address_to = checksum_encode(address_to) tx = settings.EthClient.construct_erc20_tx(contract_instance, self._key.address, address_to, int(value * 10**decimals), gasLimit, gasprice) rawdata = self.SignTX(tx) asset = "{}({})".format(asset, conract_address) return self._sendraw_and_recordhistory(rawdata, asset, address_to, value)
class SafeCreation2Factory(factory.DjangoModelFactory): class Meta: model = SafeCreation2 safe = factory.SubFactory( SafeContractFactory, address=factory.LazyAttribute(lambda o: checksum_encode( mk_contract_address(o.factory_parent.proxy_factory, 0)))) master_copy = factory.LazyFunction(lambda: Account.create().address) proxy_factory = factory.LazyFunction(lambda: Account.create().address) salt_nonce = factory.fuzzy.FuzzyInteger(1, 10000000) owners = factory.LazyFunction( lambda: [Account.create().address, Account.create().address]) threshold = 2 payment_token = None payment = factory.fuzzy.FuzzyInteger(100, 100000) payment_receiver = NULL_ADDRESS setup_data = factory.Sequence(lambda n: HexBytes('%x' % (n + 1000))) gas_estimated = factory.fuzzy.FuzzyInteger(100000, 200000) gas_price_estimated = factory.fuzzy.FuzzyInteger(Web3.toWei(1, 'gwei'), Web3.toWei(20, 'gwei')) tx_hash = factory.Sequence( lambda n: Web3.keccak(text='safe-creation-2-%d' % n)) block_number = None
class SafeCreationFactory(factory.DjangoModelFactory): class Meta: model = SafeCreation deployer = factory.LazyFunction(lambda: Account.create().address) safe = factory.SubFactory( SafeContractFactory, address=factory.LazyAttribute(lambda o: checksum_encode( mk_contract_address(o.factory_parent.deployer, 0)))) funder = factory.LazyFunction(lambda: Account.create().address) owners = factory.LazyFunction( lambda: [Account.create().address, Account.create().address]) threshold = 2 payment = factory.fuzzy.FuzzyInteger(100, 1000) tx_hash = factory.Sequence(lambda n: Web3.keccak(n)) gas = factory.fuzzy.FuzzyInteger(100000, 200000) gas_price = factory.fuzzy.FuzzyInteger(Web3.toWei(1, 'gwei'), Web3.toWei(20, 'gwei')) payment_token = None value = 0 v = factory.fuzzy.FuzzyInteger(SIGNATURE_V_MIN_VALUE, SIGNATURE_V_MAX_VALUE) r = factory.fuzzy.FuzzyInteger(SIGNATURE_R_MIN_VALUE, SIGNATURE_R_MAX_VALUE) s = factory.fuzzy.FuzzyInteger(SIGNATURE_S_MIN_VALUE, SIGNATURE_S_MAX_VALUE) data = factory.Sequence(lambda n: HexBytes('%x' % (n + 1000))) signed_tx = factory.Sequence(lambda n: HexBytes('%x' % (n + 5000)))
def __init__( self, contract_address, contract_abi_string, ethereum_chain_id, http_provider, websocket_provider, gas_price_gwei, gas_limit, ): self.abi_dict = json.loads(contract_abi_string) self.contract_address = utils.checksum_encode(contract_address) self.ethereum_chain_id = int(ethereum_chain_id) self.w3 = Web3(HTTPProvider(http_provider)) self.wsw3 = Web3(WebsocketProvider(websocket_provider)) self.contract = self.w3.eth.contract(address=self.contract_address, abi=self.abi_dict) self.decimals = self.get_decimals() self.gas_price = self.w3.toWei(gas_price_gwei, 'gwei') self.gas_limit = gas_limit self.transaction_max_value = self.gas_price * self.gas_limit
def player_roll_dice(self, bet_size_ether, chances, wallet_path, wallet_password): """ Work in progress: https://github.com/AndreMiras/EtherollApp/issues/1 """ roll_under = chances value_wei = w3.toWei(bet_size_ether, 'ether') gas = 310000 gas_price = w3.toWei(4, 'gwei') # since Account.load is hanging while decrypting the password # we set password to None and use `w3.eth.account.decrypt` instead account = Account.load(wallet_path, password=None) from_address_normalized = checksum_encode(account.address) nonce = self.web3.eth.getTransactionCount(from_address_normalized) transaction = { # 'chainId': ChainID.ROPSTEN.value, 'chainId': int(self.web3.net.version), 'gas': gas, 'gasPrice': gas_price, 'nonce': nonce, 'value': value_wei, } transaction = self.contract.functions.playerRollDice( roll_under).buildTransaction(transaction) encrypted_key = open(wallet_path).read() private_key = w3.eth.account.decrypt(encrypted_key, wallet_password) signed_tx = self.web3.eth.account.signTransaction( transaction, private_key) tx_hash = self.web3.eth.sendRawTransaction(signed_tx.rawTransaction) print("tx_hash:", tx_hash.hex()) return tx_hash
def batchTransfer(rows): transferNumber = transferNumberOfTransaction beginRow = 0 endRow = transferNumber transferCounts = len(rows) // transferNumber remainCounts = len(rows) % transferNumber if remainCounts > 0: transferCounts += 1 print("total accounts = %d, total transaction numbers = %d" %(len(rows), transferCounts)) now = time.strftime("%Y-%m-%d-%H_%M_%S",time.localtime(time.time())) out = open(now+"_patchTransfer.csv", 'w', newline='') csv_writer = csv.writer(out, dialect='excel') for sendCount in range(transferCounts): accounts = [] amounts = [] print("transaction NO:", sendCount) for row in rows[beginRow:endRow]: accounts.append(checksum_encode(row["address"])) amounts.append(int(row["value"])*pow(10,8)) csv_writer.writerow([row["address"], row["value"]]) txId = contructTransaction(accounts, amounts) csv_writer.writerow([txId]) if(txId == "0000000000000000000000000000000000000000000000000000000000000000"): return beginRow += transferNumber endRow += transferNumber
def construct_erc20_tx(self,addressFrom,addressTo,value,gasPrice=None): ''' 构造eth未签名交易 ''' contract_instance=self.get_contract_instance(CONTRACT_ADDRESS, CONTRACT_ABI) tx_dict = contract_instance.functions.transfer( checksum_encode(addressTo), int(value*(10**8)) ).buildTransaction({ 'from': addressFrom, 'nonce': self.web3.eth.getTransactionCount(addressFrom), }) tx = Transaction( nonce=tx_dict.get("nonce"), gasprice=tx_dict.get("gasPrice") if not gasPrice else gasPrice, startgas=tx_dict.get("gas"), to=tx_dict.get("to"), value=tx_dict.get("value"), data=binascii.unhexlify(tx_dict.get("data")[2:])) UnsignedTransaction = Transaction.exclude(['v', 'r', 's']) unsigned_tx = rlp.encode(tx, UnsignedTransaction) before_hash = utils.sha3(unsigned_tx) return binascii.hexlify(unsigned_tx).decode(),binascii.hexlify(before_hash).decode()
def deploy_and_initialize_contract(self, deployer_account: LocalAccount, constructor_data: bytes, initializer_data: bytes = b'', check_receipt: bool = True): contract_address = None for data in (constructor_data, initializer_data): # Because initializer_data is not mandatory if data: tx = { 'from': deployer_account.address, 'data': data, 'gasPrice': self.w3.eth.gasPrice, 'value': 0, 'to': contract_address if contract_address else b'' } tx['gas'] = self.w3.eth.estimateGas(tx) tx_hash = self.send_unsigned_transaction( tx, private_key=deployer_account.key) if check_receipt: tx_receipt = self.get_transaction_receipt(tx_hash, timeout=60) assert tx_receipt.status if not contract_address: contract_address = checksum_encode( mk_contract_address(tx['from'], tx['nonce'])) return EthereumTxSent(tx_hash, tx, contract_address)
def owner(self): """ :return: Address of contract signing. No further checks to get the owner are needed, but it could be a non existing contract """ contract_address = checksum_encode(self.r) return contract_address
def get_contract_instance(self, contract_address, abi): ''' 获取合约实例 ''' contract_address = checksum_encode(contract_address) contract = self.web3.eth.contract(address=contract_address, abi=abi) return contract
def transfer_erc20(self,addressFrom,addressTo,value,privtKey): ''' erc20转账 ''' contract_instance = self.get_contract_instance(CONTRACT_ADDRESS, CONTRACT_ABI) tx = contract_instance.functions.transfer( checksum_encode(addressTo), int(value*(10**8)) ).buildTransaction({ 'gasPrice': self.web3.eth.gasPrice, 'nonce': self.web3.eth.getTransactionCount(checksum_encode(addressFrom)), }) signed = self.web3.eth.account.signTransaction(tx, privtKey) tx_id=self.web3.eth.sendRawTransaction(signed.rawTransaction) return binascii.hexlify(tx_id).decode()
def get_address(self, private_key): try: private_key = self.web3.toBytes(private_key) raw_address = utils.privtoaddr(private_key) account_addr = utils.checksum_encode(raw_address) except Exception as err: return {'code': 103, 'error': str(err)}, None return None, account_addr
def withdraw(self, invoker, channel_id, founder, partner, lock_period, lock_amount, lock_hash, founder_signature, partner_signature, secret, invoker_key, gwei_coef=1): """ Description: it's for HLTC tranction, partner that have secret apply for withdraw asset :param invoker: applicant address :param channel_id: channel identification code :param founder: the transaction sender :param partner: the transaction receiver :param lockPeriod: absolute block height of the lock :param lock_amount: transfer asset amount :param lock_hash: secret's hash :param founder_signature: sender signature :param partner_signature: receiver signature :param secret: R value in HTLC transaction :param invoker_key: applicant's key :return: """ founder = checksum_encode(founder) partner = checksum_encode(partner) try: tx_id = self.eth_client.contruct_Transaction( invoker, self.contract, "withdraw", [ channel_id, founder, partner, lock_period, lock_amount, lock_hash, founder_signature, partner_signature, secret ], invoker_key, gwei_coef=gwei_coef) tx_msg = 'success' except Exception as e: tx_id = 'none' tx_msg = e return {"txData": tx_id, "txMessage": tx_msg}
def mk_validation_code(address): return serpent.compile(code_template % (utils.checksum_encode(address)))
from viper import compiler from ethereum.transactions import Transaction from ethereum import utils from ethereum.tools.tester import a0 from ethereum.abi import ContractTranslator import rlp gasprice = 25 * 10**9 casper_config = { "epoch_length": 5, # 5 blocks "withdrawal_delay": 100, # 100 epochs "owner": utils.checksum_encode(a0), # Backdoor address "base_interest_factor": 0.02, "base_penalty_factor": 0.002 } viper_rlp_decoder_tx = rlp.hex_decode("0xf90237808506fc23ac00830330888080b902246102128061000e60003961022056600060007f010000000000000000000000000000000000000000000000000000000000000060003504600060c082121515585760f882121561004d5760bf820336141558576001905061006e565b600181013560f783036020035260005160f6830301361415585760f6820390505b5b368112156101c2577f010000000000000000000000000000000000000000000000000000000000000081350483602086026040015260018501945060808112156100d55760018461044001526001828561046001376001820191506021840193506101bc565b60b881121561014357608081038461044001526080810360018301856104600137608181141561012e5760807f010000000000000000000000000000000000000000000000000000000000000060018401350412151558575b607f81038201915060608103840193506101bb565b60c08112156101b857600182013560b782036020035260005160388112157f010000000000000000000000000000000000000000000000000000000000000060018501350402155857808561044001528060b6838501038661046001378060b6830301830192506020810185019450506101ba565bfe5b5b5b5061006f565b601f841315155857602060208502016020810391505b6000821215156101fc578082604001510182826104400301526020820391506101d8565b808401610420528381018161044003f350505050505b6000f31b2d4f", Transaction) sig_hasher_tx = rlp.hex_decode("0xf9016d808506fc23ac0083026a508080b9015a6101488061000e6000396101565660007f01000000000000000000000000000000000000000000000000000000000000006000350460f8811215610038576001915061003f565b60f6810391505b508060005b368312156100c8577f01000000000000000000000000000000000000000000000000000000000000008335048391506080811215610087576001840193506100c2565b60b881121561009d57607f8103840193506100c1565b60c08112156100c05760b68103600185013560b783036020035260005101840193505b5b5b50610044565b81810360388112156100f4578060c00160005380836001378060010160002060e052602060e0f3610143565b61010081121561010557600161011b565b6201000081121561011757600261011a565b60035b5b8160005280601f038160f701815382856020378282600101018120610140526020610140f350505b505050505b6000f31b2d4f", Transaction) purity_checker_tx = rlp.hex_decode("0xf90467808506fc23ac00830583c88080b904546104428061000e60003961045056600061033f537c0100000000000000000000000000000000000000000000000000000000600035047f80010000000000000000000000000000000000000030ffff1c0e00000000000060205263a1903eab8114156103f7573659905901600090523660048237600435608052506080513b806020015990590160009052818152602081019050905060a0526080513b600060a0516080513c6080513b8060200260200159905901600090528181526020810190509050610100526080513b806020026020015990590160009052818152602081019050905061016052600060005b602060a05103518212156103c957610100601f8360a051010351066020518160020a161561010a57fe5b80606013151561011e57607f811315610121565b60005b1561014f5780607f036101000a60018460a0510101510482602002610160510152605e8103830192506103b2565b60f18114801561015f5780610164565b60f282145b905080156101725780610177565b60f482145b9050156103aa5760028212151561019e5760606001830360200261010051015112156101a1565b60005b156101bc57607f6001830360200261010051015113156101bf565b60005b156101d157600282036102605261031e565b6004821215156101f057600360018303602002610100510151146101f3565b60005b1561020d57605a6002830360200261010051015114610210565b60005b1561022b57606060038303602002610100510151121561022e565b60005b1561024957607f60038303602002610100510151131561024c565b60005b1561025e57600482036102605261031d565b60028212151561027d57605a6001830360200261010051015114610280565b60005b1561029257600282036102605261031c565b6002821215156102b157609060018303602002610100510151146102b4565b60005b156102c657600282036102605261031b565b6002821215156102e65760806001830360200261010051015112156102e9565b60005b156103035760906001830360200261010051015112610306565b60005b1561031857600282036102605261031a565bfe5b5b5b5b5b604060405990590160009052600081526102605160200261016051015181602001528090502054156103555760016102a052610393565b60306102605160200261010051015114156103755760016102a052610392565b60606102605160200261010051015114156103915760016102a0525b5b5b6102a051151561039f57fe5b6001830192506103b1565b6001830192505b5b8082602002610100510152600182019150506100e0565b50506001604060405990590160009052600081526080518160200152809050205560016102e05260206102e0f35b63c23697a8811415610440573659905901600090523660048237600435608052506040604059905901600090526000815260805181602001528090502054610300526020610300f35b505b6000f31b2d4f", Transaction) purity_checker_address = purity_checker_tx.creates purity_checker_abi = [{'name': 'check(address)', 'type': 'function', 'constant': True, 'inputs': [{'name': 'addr', 'type': 'address'}], 'outputs': [{'name': 'out', 'type': 'bool'}]}, {'name': 'submit(address)', 'type': 'function', 'constant': False, 'inputs': [{'name': 'addr', 'type': 'address'}], 'outputs': [{'name': 'out', 'type': 'bool'}]}] viper_rlp_decoder_address = viper_rlp_decoder_tx.creates sig_hasher_address = sig_hasher_tx.creates casper_code = open('simple_casper.v.py').read() casper_bytecode = compiler.compile(casper_code) casper_abi = compiler.mk_full_signature(casper_code)
def assertEqualAddr(self, *args, **kwargs): return self.assertEqual(checksum_encode(args[0]), checksum_encode(args[1]), *args[2:], **kwargs)