Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signMessage costs gas fees #3135

Open
mikecot opened this issue Apr 8, 2024 · 3 comments
Open

signMessage costs gas fees #3135

mikecot opened this issue Apr 8, 2024 · 3 comments

Comments

@mikecot
Copy link

mikecot commented Apr 8, 2024

Environment
A react website using the signMessage api in the MyNearWallet/Web Wallet flow on mainnet.

Problem
Gas fee charges occur on the wallet

Expected Behaviour
No charges should happen as this function just verifies the owner of the wallet with a message.
on other wallets/blockchains this does not cost gas

Steps to reproduce

  1. setup the https://www.npmjs.com/package/@near-wallet-selector/my-near-wallet in a react app
  2. set it to use network: 'mainnet', - this is the only change from this flow:
    https://github.com/near/wallet-selector/tree/main/examples/react
  3. and this is the second change we did:
    export const NEAR_CONTRACT_ID = 'lavanetxyz.near' //'guest-book.testnet'
  4. then execute this after wallet login from the react website:
    localStorage.setItem(
      'message',
      JSON.stringify({
        message,
        nonce: [...Array.from(message)],
        recipient,
        callbackUrl: GetConnectionProgressUrlNearWallet(),
      }),
    )
    signedMessage = await wallet.signMessage({
      message,
      nonce,
      recipient,
    })
@mikecot
Copy link
Author

mikecot commented Apr 8, 2024

ok just tested again this behaviour happens when logging in with sender wallet - could not reproduce it with the webwallet. So this happens after the log in - without even using the signMessage api.
same flow using the connect your wallet as done in the example on the github.

Picture before login:
image

Picture after logging in:
image

The add key Txn which cost money:
https://nearblocks.io/address/8b868c694970076635394ce22f719b7f8eef3e18396d31c30ad7d85f26cc7b55

@mikecot
Copy link
Author

mikecot commented Apr 8, 2024

Ok I managed to reproduce the same issue in the web wallet with a new wallet (new account)
before doing the login flow / signMessage flow - the wallet had these funds

0.1927 NEAR
$1.42

and this is an after picture:
image
and again near was spent on an add key txn:
https://nearblocks.io/address/b7ecfa3320cc3e6588ee32c2cbbb519ced657faf5233d255fd7a5ad9938e35ef

@mikecot
Copy link
Author

mikecot commented Apr 8, 2024

Link to conversation on the neardev telegram:
https://t.me/neardev/43748

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant