Ejemplo n.º 1
0
 def transaction(self,w3, from_address, to_address=None, value=100000000000000000000000000000000,
                 gas=91000000, gasPrice=9000000000):
     personal = Personal(self.w3_list[0])
     personal.unlockAccount(self.address, self.pwd, 666666)
     params = {
         'to': to_address,
         'from': from_address,
         'gas': gas,
         'gasPrice': gasPrice,
         'value': value
     }
     tx_hash = w3.eth.sendTransaction(params)
     return tx_hash
Ejemplo n.º 2
0
 def transaction(self,w3, from_address, to_address=None,value=1000000000000000000000000000000000,
                 gas=91000000, gasPrice=9000000000,pwd=conf.PASSWORD):
     """"
     转账公共方法
     """
     personal = Personal(w3)
     personal.unlockAccount(from_address, pwd, 666666)
     params = {
         'to': to_address,
         'from': from_address,
         'gas': gas,
         'gasPrice': gasPrice,
         'value': value
     }
     tx_hash = w3.eth.sendTransaction(params)
     result = w3.eth.waitForTransactionReceipt(HexBytes(tx_hash).hex())
     return result
Ejemplo n.º 3
0
 def generate_account_in_node(self, node, passwd, balance=0):
     personal = Personal(node.web3)
     address = personal.newAccount(passwd)
     # log.debug(address)
     if balance > 0:
         self.sendTransaction(node.web3, '',
                              self.account_with_money['address'], address,
                              node.eth.gasPrice, 40000, balance)
     account = {
         "node_id": node.node_id,
         "address": address,
         "nonce": 0,
         "balance": balance,
         "prikey": '',
         'passwd': passwd
     }
     self.accounts[address] = account
     return address
Ejemplo n.º 4
0
 def personal(self) -> Personal:
     return Personal(self.web3)
Ejemplo n.º 5
0
 def unlock_account(self, node, address):
     account = self.accounts[address]
     personal = Personal(node.web3)
     personal.unlockAccount(account['address'], account['passwd'])