Suppose I want users to answer surveys and that each response are hashed and sent to ethereum. My issue is the user experience of creating an account and login without metamask which is not user friendly enough for the population I am targeting. Is it possible to get for each user an public/private key created in the backend stored on a server, filling their account with gas, and then triggering the ethereum transactions on their behalf but in the same time, letting the private keys visible to none except the user. Is it possible ?

1 Answer 1


Generating and storing private keys at the server-side is leading the concept to ad absurdum. If you want to simplify the process for the users and let them work ether-free, then you can design your contract in the way that a function call requires user's signature as additional parameter. In this case, you can let your server call the function on behalf of the user

function storeResponse(bytes32 responseHash, uint8 v, bytes32 r, bytes32 s) {
   address msgSender = ecrecover(responseHash, v, r, s);
   responses[msgSender] = responseHash;

instead of

function storeResponse(bytes32 responseHash) {
   responses[msg.sender] = responseHash;

This will work, however, you'll have to handle two more issues:

  • spamming - how the server can decide for who to relay?
  • replay-attach - how to avoid replaying a transaction. E.g. solution would be to use the nonce.
  • thanks you for your response. What do you mean by "requires user's signature", how can the user sign, does he have to enter the private key when the transaction event is triggered ? or do you mean that all the private keys are managed by a single central entity ? Jan 23, 2019 at 11:19
  • Every user creates himself the private key. This private key can be used to sign the responseHash locally offchain and then the user can let the server submit this signature to the smart contract.
    – ivicaa
    Jan 23, 2019 at 11:30
  • thank you, the background of my thoughts is more on the UX side: here the user needs to create a key, to store it and then to use it to sign, which is not user friendly I think. Do you see a way to prevent from this ? Jan 24, 2019 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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