Hello @fabrice i have attached the code for your review, thanks.
import json
from algosdk.v2client import algod
from algosdk import transaction
algod_address = "https://mainnet-algorand.api.purestake.io/ps2" # network address
algod_token = "π" # api key
headers = {
"X-API-Key": algod_token,
}
# initiate a new client with the given parameters
algod_client = algod.AlgodClient(algod_token, algod_address, headers)
params = algod_client.suggested_params()
params.flat_fee = True
params.fee = 1000
fee = params.fee
gh = params.gh
# check node status
status = algod_client.status()
# to read json data
node_stat = json.dumps(status, indent=4)
node_stat = json.loads(node_stat)
current_round = int(node_stat["last-round"])
avg_block_time = 4.5
target_submission_time_in_seconds = 1200
avg_number_of_block_produced_within_time = int(target_submission_time_in_seconds/avg_block_time)
first_round = int(current_round + avg_number_of_block_produced_within_time)
last_round = int(first_round + 1000)
sender = 'I76WK5LC6JDKOIQ4AZ2BKGENET37AUR57V4NRKKDY3UARDTJ534LGPPVCE'
sender_key = 'π'
reciever = '7WEP4COP42SO6XPCIUIEXYPBYWL2K3QNEV73FPNSU5WC26JYTXMNSC6QJI'
amount = 100000
payit = transaction.PaymentTxn(sender, fee, first_round, last_round, gh, reciever, amount)
signed_txn = payit.sign(sender_key)
# submit the transaction
txid = algod_client.send_transaction(signed_txn) # send the transaction
print(f"Successfully sent transaction with txID: {txid}") # prints the transaction id