I am creating a private network with Ethereum following instructions from here . I managed to run the network but my problem is when try to deploy a contract following error comes:

{'code':-320000, 'message':'invalid sender'}

After research on forums, I understand this is an unauthroized key error or may be chainId is invalid. So I checked the .json file which was generated at the time of network creation and through which I initialised the network. In this file, the chainId is correct that is 58343 but when I try to print this chainId from web3 code , it is giving me chainId 0 that is mainnet. I have also setted up chain from transaction and sending contract transactions like this:

contract_data = contract_.constructor().buildTransactions({ 'from: acct.address', 'gas':1732233', 'gasPrice': web3.toWei('21','gwei'), 'chainId':58343})

Note: Above is the working code which I used to deploy several contracts on Ethereum Ropsten Testnet, for this project only added chainId after reading on forums.

Your help is much appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.