I have been looking through on how to get one transaction to pay for all fees of all transactions and can’t seem to find an example online.
params = algod_client.suggested_params()
# comment out the next two (2) lines to use suggested fees
params.flat_fee = True
params.fee = 1000
# create transactions
print("Creating transactions...")
# from account 1 to account 3
sender = account_1
receiver = account_3
amount = 1000000
txn_1 = transaction.PaymentTxn(sender, params, receiver, amount)
print("...txn_1: from {} to {} for {} microAlgos".format(sender, receiver, amount))
print("...created txn_1: ", txn_1.get_txid())
# from account 2 to account 1
sender = account_2
receiver = account_1
amount = 2000000
txn_2 = transaction.PaymentTxn(sender, params, receiver, amount)
print("...txn_2: from {} to {} for {} microAlgos".format(sender, receiver, amount))
print("...created txn_2: ", txn_2.get_txid())
# combine transations
print("Combining transactions...")
# the SDK does this implicitly within grouping below
print("Grouping transactions...")
# compute group id and put it into each transaction
group_id = transaction.calculate_group_id([txn_1, txn_2])
print("...computed groupId: ", group_id)
txn_1.group = group_id
txn_2.group = group_id
# split transaction group
print("Splitting unsigned transaction group...")
# this example does not use files on disk, so splitting is implicit above
# sign transactions
print("Signing transactions...")
stxn_1 = txn_1.sign(sk_1)
print("...account1 signed txn_1: ", stxn_1.get_txid())
stxn_2 = txn_2.sign(sk_2)
print("...account2 signed txn_2: ", stxn_2.get_txid())
# assemble transaction group
print("Assembling transaction group...")
signed_group = [stxn_1, stxn_2]
# send transactions
print("Sending transaction group...")
tx_id = algod_client.send_transactions(signed_group)
In the example code above, how would I get txn_1 to pay for all the fees?
Also, if the second transaction was an application inner transaction (hypothetically), would I need to write Teal code to have the fees payed by txn_1?