Python getting suggested_fee in v2

#/usr/bin/python3

import json

import time

import base64

import os

from algosdk.v2client import algod

from algosdk import mnemonic

from algosdk import transaction

from algosdk import encoding

from algosdk import account

utility to connect to node

def connect_to_network():

algod_token = 'eBlXRdLQNW6nbPb6grYp05BXsq0UHIz47nFik7sS'

algod_address = 'https://testnet-algorand.api.purestake.io/ps2'

purestake_token = {'X-Api-key': algod_token}

# Initialize an algod client

#algod_client = algod.AlgodClient(algod_token=algod_token, algod_address=algod_address)

algod_client = algod.AlgodClient(algod_token, algod_address, headers=purestake_token)

return algod_client

group transactions

def sample() :

# connect to node

acl = connect_to_network()

print(format(acl))

# get suggested parameters

params = acl.suggested_params()

gen = params.gen

gh = params.gh

last_round = params.last

fee = acl.suggested_fee().fee

print(fee)

run

sample()

Using above program i am not able to get the suggested fee

You should edit the post, remove everything but the last line, copy and paste again your code, select all the code and click that </> icon.

What’s the output of your error? That suggested_fee doesn’t exist in v2client package.

1 Like

params in the following code contains a min_fee property that you can examine.

# build transaction
from algosdk.future.transaction import PaymentTxn

    params = algod_client.suggested_params()
    receiver = "HZ57J3K46JIJXILONBBZOHX6BKPXEM2VVXNRFSUED6DKFD5ZD24PMJ3MVA"
    note = "Hello World".encode()

    unsigned_txn = PaymentTxn(my_address, params, receiver, 1000000, None, note)
1 Like

thanks …

I am not able execute teal file…

stdout, stderr = execute([“goal”, “clerk”, “compile”, “-o”, lsig_fname,
teal_file])

above line showing “no such file or directory goal”

how to install goal??

See How to install goal - #2 by fabrice