I am trying to use pytezos to perform a transaction on Tezos testnet.

I am receiving a 'Gas Exhausted' error although it is suppose to autofill.

Python code:

native_key = await Key.from_mnemonic(words, curve=b"sp")
# Get account info
bal = pytezos.using(shell='https://rpc.ghostnet.teztnets.xyz').account(native_key.public_key_hash())  
print ("\nPK Hash: ", native_key.public_key_hash(), "\n")
print ("\nBalance: ", bal ["balance"], " mutez\n")
sourceAddr = native_key.public_key_hash()
targetAddr = "tz1VZGEWA3daTHj3tNvRf6SR3tSVrpWb2xN2"
targetAmt = Decimal('1.23')
print ("\nAmt: ", targetAmt, " tez\n")
tztx = pytezos.using(shell='https://rpc.ghostnet.teztnets.xyz', key=native_key).transaction(source=sourceAddr, destination=targetAddr, amount=targetAmt).autofill().sign().inject()


DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): rpc.ghostnet.teztnets.xyz:443
DEBUG:urllib3.connectionpool:https://rpc.ghostnet.teztnets.xyz:443 "POST /chains/main/blocks/head/helpers/scripts/run_operation HTTP/1.1" 200 None
DEBUG:pytezos:<<<<< 200
    "contents": [
            "kind": "transaction",
            "source": "tz2HBLPFd1wo7ebsm6P6y5M1hSUKgvXd8igV",
            "fee": "414",
            "counter": "11664705",
            "gas_limit": "1427",
            "storage_limit": "257",
            "amount": "1230000",
            "destination": "tz1VZGEWA3daTHj3tNvRf6SR3tSVrpWb2xN2",
            "metadata": {
                "balance_updates": [
                        "kind": "contract",
                        "contract": "tz2HBLPFd1wo7ebsm6P6y5M1hSUKgvXd8igV",
                        "change": "-414",
                        "origin": "block"
                        "kind": "accumulator",
                        "category": "block fees",
                        "change": "414",
                        "origin": "block"
                "operation_result": {
                    "status": "failed",
                    "errors": [
                            "kind": "temporary",
                            "id": "proto.013-PtJakart.gas_exhausted.operation"
    "signature": "sigUHx32f9wesZ1n2BWpixXz4AQaZggEtchaQNHYGRCoWNAXx45WGW2ua3apUUUAGMLPwAU41QoaFCzVSL61VaessLg4YbbP"
  • This is most likely an outdated pytezos version, pls update to 3.6.1 If it says "No matching distribution found" then you probably have an old python version, you need at least 3.8 Commented Sep 1, 2022 at 11:01

1 Answer 1


I think this is an estimation bug on pytezos side, which only seems to happen for transactions without parameters.

Try the following:

    gas_limit=1451, // Hard-coded gas_limit based on the latest transactions (not perfect, but should unlock you for now)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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