waku-org / nwaku-compose

Deployment docker-compose files to deploy an nwaku node
13 stars 22 forks source link

Super high cost per registration #55

Closed Ivansete-status closed 8 months ago

Ivansete-status commented 8 months ago

It happened very regularly (Corey, Zoltán, a user (3dchemy | fam) ) that while registering (./register_rln.sh) the script shows the following error:

error while registering the member         topics="waku rln_relay onchain_group_manager" tid=1 file=group_manager.nim:154 msg="{"code":-32000,"message":"insufficient funds for gas * price + value: balance 99216339720388750, tx cost 155814912264000000, overshot 56598572543611250"}"
ERR 2024-02-21 14:19:21.185+00:00 failure while registering credentials on-chain topics="rln_keystore_generator" tid=1 file=rln_keystore_generator.nim:68 error="could not register the member: {"code":-32000,"message":"insufficient funds for gas * price + value: balance 99216339720388750, tx cost 155814912264000000, overshot 56598572543611250"}"

In the above example, the user had 0,099216339720388750 SepoliaEth but the tx cost shown was 0,155814912264000000 SepoliaETH.

The user tried the registration twice, separated by ~one minute, and it was relatively expensive in both cases.

Then, I decided to send 1 SepoliaEth to the user and I was surprised by a warning stating that the network was highly loaded and the tx fees were high, but in this case, the tx fee for sending 1 SepoliaEth was just 0.00056962 SepoliaETH or 0.00073904 SepoliaETH (almost 300 times cheaper than the registration cost .)

Is there a way to make the registration cost lower as a regular transaction?

alrevuelta commented 8 months ago

The cost of the transaction is measured in gas. Cost in $ of the transaction is measured multiplying the gas * gasPrice. The cost (in gas) is fixed and we have no control over gasPrice (subject to supply and demand), so nothing we can do here.

Note that in mainnet, tx fees are more stable than this.