CRYPTO NEWS

web3.py constructor(address type)

I tried to deploy the contract on my testrpc, but I get error when my constructor using “address” type.

Here is my python code:

import json import web3 from solc import compile_source from web3.contract import ConciseContract from web3 import Web3, EthereumTesterProvider from web3.auto import w3  w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545"))  # Solidity source code contract_source_code = ''' pragma solidity ^0.4.23; contract Demo2{      address public owner = msg.sender;     address[] user;     address Bank1;      constructor (string _ID ,address _addr ) {     } }  '''  compiled_sol = compile_source(contract_source_code) # Compiled source code contract_interface = compiled_sol['<stdin>:Demo2'] w3.eth.defaultAccount = w3.eth.accounts[0] a=type(w3.eth.accounts[0]) print(a)  Demo2 = w3.eth.contract(abi=contract_interface['abi'], bytecode=contract_interface['bin']) ab=contract_interface['abi'] print(ab) # Submit the transaction that deploys the contract tx_hash = Demo2.constructor("abcde","0xc69d7e6739e30796f1cc7a1a01fd0c087c4e54fd").transact()  # Wait for the transaction to be mined, and get the transaction receipt tx_receipt = w3.eth.waitForTransactionReceipt(tx_hash)  # Create the contract instance with the newly-deployed address Demo2 = w3.eth.contract(     address=tx_receipt.contractAddress,     abi=contract_interface['abi'], ) 

web3.py constructor(address type)

Shopping cart
There are no products in the cart!
Continue shopping
0