Delegate fee to another account

Hi

i’am trying to manage multiple accounts for my users and they will only have access to one asset.

my issue is that when an account wants to send that asset to another account, there will be no algo to pay for the fees. how can I delegate the fees to a central account ?

I just came across atomic transfer where by combining 2 tx, one tx can pay for the other. is that the best solution ?

i’am a web developer using JS SDK

thank you

Fee Pooling is likely what you’re looking for.

All transactions must be covered by a fee to be committed on the network, but pooling allows a transaction to be constructed with a fee of 0 Algo, as long as it’s grouped with another transaction that pays the fee to cover it.

The other transaction in the group could be a smart signature which which has strong restrictions on the types of transactions it can be grouped with. If done correctly, this dedicated smart signature could be used to pay for the transaction fees.

is this the same thing as grouping tx ? I was checking this example

Yes. The transactions must be part of the same atomic group.

So basically :
account 1 sends XYZ asset to account 2 but have no fees to pay for it. I need to combine the tx 1 with tx 2 where account 3 that can pay for the fees, will be sending x amount of algo to another account 4.

is there a solution to avoid using account 4 and just use account 3 to pay for the fees ?

thank you

Yeah, that’s pretty much it. Although the transaction that’s paying the increased fees to cover the whole group can be any transaction they like. I’ve previously made the “fee covering” transaction (tx 2 in your example) a payment transaction send 0 Algo to itself, but with twice the fees.

2 Likes

i have two accounts

  • the first account have 20 algo balance, and 100 “hello_world” asset
  • the second account have 0 algo balance and 0 “hello_world” asset

i’am trying to opt-in for the second account to receive the “hello_world” asset

so I created two tx, the first one signed by account 1 with sender=receiver and amount = 0 and fee = 2 * algosdk.ALGORAND_MIN_TX_FEE

the second one signed by account 2 with sender=receiver , amount = 0 and fee = 0 without forgetting to select the right asset id that I want to opt in for.

I tried to do the pooling but I get this error message :

transaction OPMX42QRKZ6PQF24JNOWGRWLTNZKXHUNM67IWFCFTWLAP6OWOKKQ: account 552Z2K2D7LSCV7DHWKCCV3M7VQNC5HPALZSME3ZHJ534ZKCNWT4V7ZYHCY balance 0 below min 200000 (1 assets)'

seems like because I have 0 algo on my second account, I can’t do the fee pooling.

Following this example, line 45, both accounts needs to be funded

is there any solution please ?

thank you

Opt-in requires minimum balance and not just payment of fees.
So you will need at least 0.2 Algos in the second account.

this applies to standalone alone account and also wallet derived accounts (if i choose this creation method) ?
the issue is that I want to manage multiple accounts for my users (to send and receive a specific asset) and can’t afford to fund each wallet.

so basically there is no other way ?

The blockchain does not differentiate between how the account was created.
As long as it’s a different on-chain account, you need this min balance.

1 Like