4

I am using web3 for users to sign some random string from web application. I give user string, he/she signs it after Metamask dialog's "Sign" button. but there is a problem when i want user to sign about 1000 random strings separately. there are unhandled amount of confirmation dialogs. what is the solution?

5

Signing a message is a privileged action, and MetaMask is correct to prompt the user every time they perform this action.

A signed message can be anything from a valid transaction to a "undeniable" message from the user. Any user signing messages which are being generated by a program should be fully aware of what exactly they are signing.

In your situation, it may make sense to not use MetaMask, but to use the private key of the Ethereum account you want to sign messages with to programmatically create these signed messages without any user input.

However, this would require that your users trust your application with their private key, and that would probably not be the best idea either... It might be best then to concatenate the messages in question and have the user sign a single longer message if possible.

1
  • so unlocking account isn't solution? Sep 16 '18 at 10:58
1

The only way to deal with this situation is to use unlockAccount first, so that you unlock the account and you already have a signing mechanism and no need to use metamask sign. Just unlock it first and then deal with it.

1

Have you taken a look at Fortmatic yet? It seems to be a pretty good alternative to MetaMask and may resolve the problem you are having.

They seem to provide both "personal_sign" and "eth_signTypedData" functionalities.

1
  • fyi for others, Fortmatic is custodial (hold your private keys) while MetaMask is not Jun 12 '19 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.