# What is the best approach to handle gas fees during zk login for submitting a transaction to obtain an ephemeral signature?

**URL:** <https://forums.sui.io/t/what-is-the-best-approach-to-handle-gas-fees-during-zk-login-for-submitting-a-transaction-to-obtain-an-ephemeral-signature/45718>\
**Category:** General\
**Created:** [June 16, 2024, 2:36pm UTC](https://forums.sui.io/t/what-is-the-best-approach-to-handle-gas-fees-during-zk-login-for-submitting-a-transaction-to-obtain-an-ephemeral-signature/45718 "2024-06-16T14:36:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bipin\_bhandari](https://dub1.discourse-cdn.com/sui/user_avatar/forums.sui.io/bipin_bhandari/32/30740_2.png) [@bipin\_bhandari](https://forums.sui.io/u/bipin_bhandari)\
**Post date:** [June 16, 2024, 2:36pm UTC](https://forums.sui.io/t/what-is-the-best-approach-to-handle-gas-fees-during-zk-login-for-submitting-a-transaction-to-obtain-an-ephemeral-signature/45718/1 "2024-06-16T14:36:46Z")

</div>

For example:  
final ephemeralSign = await txb.sign(SignOptions(signer: ephemeralKeypair, client: client));

To obtain ephemeralSign, the user needs to sign the transaction. However, for onboarding new users who are not familiar with web3, it is often necessary to manage the gas fees at the product level.

What is the recommended approach for handling gas fees during zk login implementation? Should we use sponsored transactions or is there a better alternative?

---

<div class="post-metadata">

**Author:** ![bipin\_bhandari](https://dub1.discourse-cdn.com/sui/user_avatar/forums.sui.io/bipin_bhandari/32/30740_2.png) [@bipin\_bhandari](https://forums.sui.io/u/bipin_bhandari)\
**Post date:** [June 16, 2024, 4:32pm UTC](https://forums.sui.io/t/what-is-the-best-approach-to-handle-gas-fees-during-zk-login-for-submitting-a-transaction-to-obtain-an-ephemeral-signature/45718/2 "2024-06-16T16:32:59Z")

</div>

I believe I’ve found my answer, i was slightly confused. Creating a fresh account via zk login is straightforward, as it can be decoded from the JWT:

```auto
for eg: var address = jwtToAddress(idToken, BigInt.parse(userSalt));

```

When a user wants to submit a transaction, they first generate a `partialZkLoginSignature`, followed by a complete `zkLoginSignature`. To execute the transaction, they need gas to top up their freshly created account, which applies to both zkLogin and any other account type.

```auto
const { bytes, signature: userSignature } = await txb.sign({
  client,
  signer: ephemeralKeyPair
});

const addressSeed: string = genAddressSeed(
  BigInt(userSalt),
  "sub",
  decodedJwt.sub,
  decodedJwt.aud
).toString();

const zkLoginSignature: SerializedSignature = getZkLoginSignature({
  inputs: {
    ...partialZkLoginSignature,
    addressSeed,
  },
  maxEpoch,
  userSignature,
});

```

Thanks team.
