Python getting suggested_fee in v2 - Algorand

Python getting suggested_fee in v2

post by sathiyakennedy on Aug 25, 2021

#/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_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

post by ipaleka on Aug 25, 2021

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.

post by JasonW on Aug 25, 2021

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)

post by sathiyakennedy on Aug 26, 2021

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??

post by fabrice on Aug 26, 2021

See How to install goal - #2 by fabrice