Transaction Group for multiple LogicSig signed transactions

Hi, is there any support in the python-sdk for submitting grouped transactions that have multiple LogicSigTransaction?

Was reading about this issue in Transaction Group support for LogicSig signed transactions · Issue #100 · algorand/js-algorand-sdk · GitHub, but not sure if there is any support for the python-sdk.

When I create a transaction group, with multiple LogicSigTransaction, sign it, then attempt to submit, I receive the following error AttributeError: 'NoneType' object has no attribute 'dictify'. If I submit these transactions as separate groups, it works fine (each group contains 1 logic sig transaction and other types of transactions in the group (e.g. payment transaction)). Wondering why I cannot submit a group with multiple logic sig transactions?

Any help would be appreciated! Thanks!

Can you share your code? I need more context.

I am using the tinyman sdk which can be found here

This code probably won’t work, but this is what I am trying to do in general. all_txns is a grouped transaction that contains the logicsig signed transactions from txn_group1 and txn_group2. I group these together, then sign with the private key, then submit through the algod client.

from tinyman.v1.client import TinymanMainnetClient

address = 'input_here'
private_key = 'input_here'
client = TinymanMainnetClient(user_address=address)

ALGO = client.fetch_asset(0)
USDC = client.fetch_asset(31566704)
USDT = client.fetch_asset(312769)

pool1 = client.fetch_pool(ALGO, USDC)
pool2 = client.fetch_pool(ALGO, USDT)

quote1 = pool1.fetch_fixed_input_swap_quote(ALGO(10000)) # 0.01 ALGO
quote2 = pool2.fetch_fixed_input_swap_quote(ALGO(10000)) # 0.01 ALGO

txn_group1 = pool1.prepare_swap_transactions_from_quote(quote1) # this signs the transactions with a logicsig
txn_group2 = pool2.prepare_swap_transactions_from_quote(quote2) # this signs the transactions with a logicsig

all_txns = txn_group1.signed_transactions + txn_gruop2.signed_transactions # combine the transactions from each group into 1 group
all_txns.sign_with_private_key(address, private_key)
result = client.submit(transaction_group, wait=True)

In the line:

all_txns = txn_group1.signed_transactions + txn_gruop2.signed_transactions # combine the transactions from each group into 1 group

  1. You seem to have misspelled txn_gruop2. It should be txn_group2 .

In the line:

result = client.submit(transaction_group, wait=True)
  1. You are referring to a transaction_group list that does not exist. It should be all_txns

Take a look at the Tinyman SDK prepare_swap_transactions function. It aggregates the 4 grouped transactions in a list and signs them using the sign_with_logicisg function.

Reference:

Yes, I know that there are mistakes in this code – this is not the actual code I am running. The program is more complex than this but this example more clearly demonstrates what the issue is.

In the example, I assume that the grouped transactions are already signed (successfully) with the sign_with_logicsig function. The issue is trying to combine two of these groups into 1 big group then sending this single big group.

The problem still remains – how can I submit a group transaction that contains multiple LogicSig transactions? Is it possible? In my original comment I posted a github issue link that has the same issue, but I don’t see much information on it.

First a general comment:

To my knowledge this issue is fixed in the JS SDK and never applied to the Python SDK.
Actually there is no issue signing with LogicSig multiple transactions in a group using the Algorand Python SDK.


Now, specifically to your use case.
It looks like you are using the TinyMan SDK (as opposed to the Algorand Python SDK) and trying to make 2 TinyMan swaps in a single group transactions.

  1. The TinyMan SDK does not seem to support this. Remark that prepare_swap_transactions_from_quote returns a TinyMan TransactionGroup. It does not look like TransactionGroup supports concatenation (https://github.com/tinymanorg/tinyman-py-sdk/blob/c922cba801e3bdab0f3a5a5e19a25c292f16a9fd/tinyman/utils.py#L89).
  2. Even if the TinyMan SDK supported the above, the TinyMan smart contract would actually reject a group composed of the concatenation of two swaps. Indeed, the smart contract expects transactions at a given position. See e.g., https://github.com/tinymanorg/tinyman-contracts-v1/blob/main/contracts/validator_approval.teal#L860

Why do you want to concatenate two groups of TinyMan transactions?

I modified the transaction group to be able to support concatenation, to be able to perform simultaneous swaps. I want to concatenate two groups of TinyMan transactions to be able to swap simultaneously as a group… if one transaction fails then I want to other to fail as well – i.e. I don’t want to swap 1 asset if I can’t swap the other as well.

So is there no way around this? Is the approval program requiring 2 transactions from the sender? and the other 2 from the pool address both checked by the NoOp call?

Yes the Tinyman contract checks for the group size of 4, so concatenating more transactions will fail.