title: Hi, I have a Solidity beginner question: I am trying to deploy a contract with signed transaction
body: <pre><code>from solcx import compile_standard, install_solc
  import json
  from web3 import Web3
  import os
  from dotenv import load_dotenv
  
  load_dotenv()
  
  with open(&quot;./SimpleStorage.sol&quot;, &quot;r&quot;) as file:
      simple_storage_file = file.read()
      # print(simple_storage_file)
  # compile our solidity
  install_solc(&quot;0.6.0&quot;)
  
  
  compiled_sol = compile_standard(
      {
          &quot;language&quot;: &quot;Solidity&quot;,
          &quot;sources&quot;: {&quot;SimpleStorage.sol&quot;: {&quot;content&quot;: simple_storage_file}},
          &quot;settings&quot;: {
              &quot;outputSelection&quot;: {
                  &quot;*&quot;: {&quot;*&quot;: [&quot;abi&quot;, &quot;metadata&quot;, &quot;evm.bytecode&quot;, &quot;evm.sourceMap&quot;]}
              }
          },
      },
      solc_version=&quot;0.6.0&quot;,
  )
  # print(compiled_sol)
  
  
  with open(&quot;compiled_code.json&quot;, &quot;w&quot;) as file:
      json.dump(compiled_sol, file)
  
  
  bytecode = compiled_sol[&quot;contracts&quot;][&quot;SimpleStorage.sol&quot;][&quot;SimpleStorage&quot;][&quot;evm&quot;][
      &quot;bytecode&quot;
  ][&quot;object&quot;]
  
  
  # get abi
  
  abi = compiled_sol[&quot;contracts&quot;][&quot;SimpleStorage.sol&quot;][&quot;SimpleStorage&quot;][&quot;abi&quot;]
  
  # for connecting to ganache
  w3 = Web3(Web3.HTTPProvider(&quot;HTTP://127.0.0.1:7545&quot;))
  chain_id = 1337
  my_address = &quot;0x0fcFb4dBbacfD7AcE1829b228766cd39b4791347&quot;
  private_key = os.getenv(
      &quot;PRIVATE_KEY2&quot;
  )  # this is after you define private key in terminal s
  # print(private_key)  # private key gets
  
  # create contract in python
  SimpleStorage = w3.eth.contract(abi=abi, bytecode=bytecode)
  # print(SimpleStorage)
  nonce = w3.eth.getTransactionCount(my_address)
  # print(nonce)
  
  # 1 build a transaction
  # 2 sig  a transactiob
  # 3 send a transactjkns
  
  transaction = SimpleStorage.constructor().buildTransaction(
      {
          &quot;gasPrice&quot;: w3.eth.gas_price,
          &quot;chainid&quot;: chain_id,
          &quot;from&quot;: my_address,
          &quot;nonce&quot;: nonce,
      }
  )
  # print(transaction)
  
  signed_txn = w3.eth.account.sign_transaction(transaction, private_key=private_key)
  
  
  print(signed_txn) 
  </code></pre>
  <p>I get a traceback problem starting with  the signed transaction:
  signed_txn = w3.eth.account.sign_transaction(transaction, private_key=private_key)</p>
  <p><strong>strong text</strong></p>
  <ul>
  <li>**ganache ACCOUNT ADDRESS 0x0fcFb4dBbacfD7AcE1829b228766cd39b4791347</li>
  </ul>
  <p>on my .env file , I have defined  the PRIVATE KEY from ganache:</p>
  <pre><code>export const PRIVATE_KEY2 = &quot;some private key from ganache&quot;
  export const SOME_OTHER_VAR = 7**
  </code></pre>
  <p>I also have a gitnore file:
  .env</p>