@combomethod<EOL><INDENT>def signTransaction(self, transaction_dict, private_key):<DEDENT>
if not isinstance(transaction_dict, Mapping):<EOL><INDENT>raise TypeError("<STR_LIT>" % transaction_dict)<EOL><DEDENT>account = self.privateKeyToAccount(private_key)<EOL>if '<STR_LIT>' in transaction_dict:<EOL><INDENT>if transaction_dict['<STR_LIT>'] == account.address:<EOL><INDENT>sanitized_transaction = dissoc(transaction_dict, '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" % (<EOL>account.address,<EOL>transaction_dict['<STR_LIT>'],<EOL>))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>sanitized_transaction = transaction_dict<EOL><DEDENT>(<EOL>v,<EOL>r,<EOL>s,<EOL>rlp_encoded,<EOL>) = sign_transaction_dict(account._key_obj, sanitized_transaction)<EOL>transaction_hash = keccak(rlp_encoded)<EOL>return AttributeDict({<EOL>'<STR_LIT>': HexBytes(rlp_encoded),<EOL>'<STR_LIT>': HexBytes(transaction_hash),<EOL>'<STR_LIT:r>': r,<EOL>'<STR_LIT:s>': s,<EOL>'<STR_LIT:v>': v,<EOL>})<EOL>
Sign a transaction using a local private key. Produces signature details
and the hex-encoded transaction suitable for broadcast using
:meth:`w3.eth.sendRawTransaction() <web3.eth.Eth.sendRawTransaction>`.

Create the transaction dict for a contract method with
`my_contract.functions.my_function().buildTransaction()
<http://web3py.readthedocs.io/en/latest/contracts.html#methods>`_

:param dict transaction_dict: the transaction with keys:
  nonce, chainId, to, data, value, gas, and gasPrice.
:param private_key: the private key to sign the data with
:type private_key: hex str, bytes, int or :class:`eth_keys.datatypes.PrivateKey`
:returns: Various details about the signature - most
  importantly the fields: v, r, and s
:rtype: AttributeDict

.. code-block:: python

    >>> transaction = {
            # Note that the address must be in checksum format or native bytes:
            'to': '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
            'value': 1000000000,
            'gas': 2000000,
            'gasPrice': 234567897654321,
            'nonce': 0,
            'chainId': 1
        }
    >>> key = '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318'
    >>> signed = Account.signTransaction(transaction, key)
    {'hash': HexBytes('0x6893a6ee8df79b0f5d64a180cd1ef35d030f3e296a5361cf04d02ce720d32ec5'),
     'r': 4487286261793418179817841024889747115779324305375823110249149479905075174044,
     'rawTransaction': HexBytes('0xf86a8086d55698372431831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428'),  # noqa: E501
     's': 30785525769477805655994251009256770582792548537338581640010273753578382951464,
     'v': 37}
    >>> w3.eth.sendRawTransaction(signed.rawTransaction)