Best way to delegate gas usage + gas estimator

Hi Aeternity,

Mislav from AMPnet here. We’re working on an implementation for the AMPnet coop manager. We will be offering this software as a self-hosted solution to our clients. Within the AMPnet node will be an IPFS node, an Elixir webserver, an Aeternity node and a PostgreSQL database. Here is a diagram

AMPnet

However, only the cooperative IT department and/or other assigned persons will manage the transaction signing, gas payments etc… This enables us to delegate the “complicated” blockchain stuff to professionals. The trustless nature of the blockchain is used for communication between two separate coops. As shown here

https://imgur.com/ZKfn13l
(I have to put a link since the forum will let me upload only one image)

In order to achieve this, we need to be able to pay for the users gas cost. There are two paths we can take here, and need advice which one to take and how to implement it properly.

The first approach we have come up with:

  • The user makes a request to the AMPnet node running on the cooperatives server. The node has a master account connected to an Aeternity miner - this account always has enough funds to cover the transactions for all of its users. The node receives the signed transaction from the user and does two things:
    • Transfers an appropriate amount of AE tokens to the account of the caller
    • Calls the function

For this to work, we need to be able to excactly estimate gas costs of transactions - is there a tool in the Aeternity toolset ready for this?

This is the simplest, most naivé approach… If you know of a better way to delegate gas cost from one account to another please let us know (maybe a smart contract checking signed transactions and proxying to the blockchain - we thought of that but couldn’t come up with a smart solution).

Thanks in advance for the help,
Team AMPnet

Hey @mislav_ampnet,

Thank you very much for this question.

We’ve forwarded it to our dev team and they’ll get back to you.

Regards,
The AE Team