1

I read the web3.eth.API carefully and I typed the code in my project.

    signed_txn = self.web3.eth.account.signTransaction(
        {
            'nonce': self.web3.eth.getTransactionCount(Web3.toChecksumAddress(self.address)),
            'gasPrice': Web3.toWei(21, 'gwei'),
            'from': Web3.toChecksumAddress(self.address),
            'gas': 21000,
            'to': recipient,
            # 'chainId': 1,
            'value': Web3.toWei(amount, 'ether')
        },
        private_key
    )

This code doesn't run. Here what I can't understand is as follow.

  1. chainId: What value is this?
  2. private_key: I can't get this value. I created ethereum wallet using pywallet.

Wallet to be created using pywallet is HD Wallet. If anyone know about this, plz help me.

2

ChainID was introduced in EIP-155 to prevent replay attacks between the main ETH and ETC chains, which both have a networkID of 1.

For the Ethereum Mainnet the ChainID is 1 you can check the ChainId on the table at the end of EIP-155

When you create a new wallet with pywallet the output shows you the private key you can see this in the documentation

  • Hi @Abreu. In this document, the private key can't be used to send transaction. Because the length of private key to be used to send transaction is 32 bytes, but the above the length of private key is longer than 32 bytes. ??? – Coder HHC Jun 3 '18 at 4:05
  • Hi @Mickey102644, you have to convert this key to hex I see there is a util function on the pywallet for this but I never used this wallet github.com/ranaroussi/pywallet/… – Olivers De Abreu Jun 3 '18 at 14:02
  • Thanks @Olivers De Abreu. Under your guidance, I solved the issue. :) – Coder HHC Jun 5 '18 at 3:37
  • Great news @Mickey102644. It would be helpful if you post the steps for others that have the same doubt – Olivers De Abreu Jun 5 '18 at 20:16

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.